gpt4 book ai didi

How to change disabled color(如何更改禁用的颜色)

转载 作者:bug小助手 更新时间:2023-10-28 10:57:28 31 4
gpt4 key购买 nike



React native changing text color when passing props editable=false.
screenshot of text input

当传递道具可编辑=FALSE时,反应原生更改文本颜色。



How i can change that color of text input ?, i have read the documentation https://reactnative.dev/docs/textinput but not getting helped

如何更改文本输入颜色?我已经阅读了文档https://reactnative.dev/docs/textinput,但没有得到帮助


更多回答
优秀答案推荐

If you are changing the text input color you can update the style based on the prop:

如果您要更改文本输入颜色,则可以基于道具更新样式:



<TextInput style={{ color: editable ? 'red' : 'blue' }} ... />


If you are trying to change the place holder color, you can do it in a similar manner but with the placeHolderTextColor prop instead:

如果您尝试更改占位符颜色,则可以使用类似的方式进行更改,但使用的是placeHolderTextColor道具:



<TextInput placeHolderTextColor={ editable ? 'red' : 'blue' } ... />


do not use editable={false}.

不要使用EDITABLE={FALSE}。


Place your input inside a simple view and use the props pointerEvents="none", so your input won't be touched.

将您的输入放在一个简单的视图中,并使用道具pointerEvents=“None”,这样您的输入就不会被触动。




<S. onPress={handleOpenModalFuel}>
<View pointerEvents="none">
<S.LabelInput>Fuel</S.LabelInput>
<MyInput
placeholder="Fuel"
value={selectFuel.value}
defaultValue={formatFuel(vehicle?.fuel_type_id)}
/>
</View>
</S.ContainerInputSelect>




更多回答

Thanks !! you are awesome, i done with props.editable == false && { color: undefined } because i have use default color of text input value

谢谢!你是真棒,我做了道具.editable == false && { color:undefined }因为我已经使用文本输入值的默认颜色

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com