when i press the PencilButton, i want my texinput disabled. but when i press, text in textInput fade.
how to i get the original text?
but another way came to my mind. are you recommend this?
const [press,setPress] = useState(false) // when i press button: true
<PencilButton onPress={()=>{setPress(!press)}}
<TextArea press={press}/>
const TextArea = ({press}) => {
if (press) {
return <Text>value</Text>
}
else{
return <TextInput/>
}
}
this is when i press button, replace TextInput with Text.
CodePudding user response:
Use the editable prop to handle disable in react native TextInput. It won't change the text color.
<TextInput editable={press} />