React Native-@ emotion / native-TextInput占位符文本颜色属性

我正在尝试通过placeholderTextColor函数传递styled.TextInput.attrs属性。我这样做的原因是可以访问主题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)
xuehua1911 回答:React Native-@ emotion / native-TextInput占位符文本颜色属性

我猜@emotion/native还不支持attrs功能,所以我移到了styled-components

本文链接:https://www.f2er.com/3088761.html

大家都在问