我使用原生基础Input Component,我尝试自定义占位符字体样式,如下例所示,但它不会更改占位符。它改变了用户输入值的样式。如何更改占位符字体样式?
<Input
style={{color:"blue", fontFamily:"Arial"}}
placeholder="I am blue and Arial font"
/>
更新
我已经尝试了placeholderStyle
,如下例所示,但它不起作用。
<Input
placeholderStyle={{color:"blue", fontFamily:"Arial"}}
placeholder="I am blue and Arial font"
/>
答案 0 :(得分:6)
文本输入和占位符的字体系列是相同的,但我认为你的意思是占位符的颜色没有变化,这就是解决方案。
这样做:
<Input
style={{color:"blue", fontFamily:"Arial"}}
placeholderTextColor="blue"
placeholder="I am blue and Arial font"
/>