React Native - @emotion/native - TextInput 占位符文本颜色属性
React Native - @emotion/native - TextInput placeholder text color attribute
我正在尝试通过 styled.TextInput.attrs
函数传递 placeholderTextColor
属性。我这样做的原因是我可以访问主题 props
.
这是我的:
const TextInput = styled.TextInput.attrs(props => ({
placeholderTextColor: "red",
type: "password"
}))`
color: ${({ theme }) => theme.colors.text};
`
但我收到以下错误:
_native.default.TextInput.attrs is not a function. (In '_native.default.TextInput.attrs(function (props) {
return {
placeholderTextColor: "red",
type: "password"
};
})', '_native.default.TextInput.attrs' is undefined)
我猜想 @emotion/native
还不支持 attrs
功能,所以我转到了 styled-components
。
我正在尝试通过 styled.TextInput.attrs
函数传递 placeholderTextColor
属性。我这样做的原因是我可以访问主题 props
.
这是我的:
const TextInput = styled.TextInput.attrs(props => ({
placeholderTextColor: "red",
type: "password"
}))`
color: ${({ theme }) => theme.colors.text};
`
但我收到以下错误:
_native.default.TextInput.attrs is not a function. (In '_native.default.TextInput.attrs(function (props) {
return {
placeholderTextColor: "red",
type: "password"
};
})', '_native.default.TextInput.attrs' is undefined)
我猜想 @emotion/native
还不支持 attrs
功能,所以我转到了 styled-components
。