Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to clear the TextInput on React Native?

it is the state:
const[value, setValue]= useState();

it is the code:

    <View style={styles.messaginginputContainer}>
        <TextInput
        multiline
            style={styles.messaginginput}
            onChangeText={txt => setNote(txt)}
            value={value}
        />
        <Pressable
                onPress={()=>{
            clearValue('');
        }}
        >
            <View>
                <Text style={{ color: "#f2f0f1", fontSize: 20 }}>ok</Text>
            </View>
        </Pressable>
        
    </View>

i dont know how to do this functional

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Ok, i can search a little bit more, but i want to enable the vote on my account

>Solution :

This question has answer here:
https://stackoverflow.com/a/45250198/13490165

create a button, then use

<TextInput ref={input => { textInput = input }} />

and clear like this:

textInput.clear()
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading