reactjs - 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)
解决方案
我猜@emotion/native
还不支持这个attrs
功能,所以我搬到了styled-components
.
推荐阅读
- python - 为什么我尝试安装 Python 包时找不到它?
- android - 通过 android studio 中的 USB 连接设备将文本从 android 应用程序发送到 PC 浏览器
- scala - 我无法从 scala 中的 properties.conf 加载属性
- php - Laravel关于更新的独特规则忽略当前id不同型号同一张表
- kubernetes - 如何调试 K8s 中启动时卡住的服务?
- r - 向 ggplot2 自动绘图功能添加(或覆盖)填充美学
- html - 屏幕缩小时如何使图像缩小?
- html - React Fullcallendar v5 事件定位到光标问题 [更新]
- firebase - 无法将 Storage Firebase 映像正确链接到 Cloud Firestore
- python - 关于熊猫部分字符串合并的另一个问题