Quantcast
Channel: Unfocus a TextInput in React Native - Stack Overflow
Browsing latest articles
Browse All 13 View Live

Answer by bogan27 for Unfocus a TextInput in React Native

Noah's answer above works well, but using string refs is now discouraged in React, and is likely going to be deprecated soon. Instead, you should use a callback function that gets called when the...

View Article



Answer by Adrian for Unfocus a TextInput in React Native

I managed to solve this with this.ref reference. First, you assign to the TextInput a ref, like this: <input ref="myInput" /> Then, you call the blur() method to this.refs.myInput from a function...

View Article

Answer by F. Huang for Unfocus a TextInput in React Native

You can use Keyboard API. import { Keyboard, TextInput } from 'react-native'; <TextInput onSubmitEditing={Keyboard.dismiss} /> Please see the full example in react native offical document.

View Article

Answer by Meysam Izadmehr for Unfocus a TextInput in React Native

I think a better way is to use * ScrollView*, Keyboard.dismiss. By using * ScrollView* when the user taps outside of textInput, keyboard dismissed. It's done because ScrollView default property for...

View Article

Answer by Noah Mendoza for Unfocus a TextInput in React Native

Found it actually.It doesn't look as pretty and my intuition says this isn't a very "react" solution but if you want it here it is. <TextInput style={styles.input} ref="email_input"...

View Article


Unfocus a TextInput in React Native

I'm building an Android app with React Native. How can you force a TextInput to "unFocus", meaning the cursor is blinking inside the text field. There are functions for isFocused() and onFocus(), but...

View Article

Answer by Keno Clayton for Unfocus a TextInput in React Native

My use case was a little different. The user wouldn't enter a value directly in the input field. The field was mainly used to capture the user's attempt at entering a value and open a modal instead. I...

View Article

Answer by Darkleon for Unfocus a TextInput in React Native

If you want to lose focus after submiting, use blurOnSubmit property.<TextInput blurOnSubmit={true} //other props/>

View Article


Answer by Ali El-Helbawi for Unfocus a TextInput in React Native

I used the below code and it worked perfect for me:i wrap all the view inside TouchableWithoutFeedback andonPress={() => {Keyboard.dismiss();}} import {View,TouchableWithoutFeedback,Keyboard,} from...

View Article


Answer by David Florencio Boss for Unfocus a TextInput in React Native

It does what it needsfunction TextInputCustom({ placeholder, style }) { React.useEffect(() => { const keyboardHide = Keyboard.addListener('keyboardDidHide', () => { Keyboard.dismiss(); }); return...

View Article

Answer by Collins Olix for Unfocus a TextInput in React Native

I made Keyboard dismiss on outside tap like so<View onTouchStart={()=>Keyboard.dismiss()} style={{flex: 1, width: "100%"}}><KeyboardAvoidingView style={{flex:...

View Article

Answer by Trung Kiên Nguyễn for Unfocus a TextInput in React Native

I made Keyboard dismiss on outside tap like so<View onTouchStart={()=>Keyboard.dismiss()} style={{flex: 1, width: "100%"}}><KeyboardAvoidingView style={{flex:...

View Article
Browsing latest articles
Browse All 13 View Live




Latest Images