I want to do some task when I click the "Do some work" button, but after the onBlur event of any focused TextInput is called.
Here is my sample code: -
'use strict'; var React = require('react-native'); var {AppRegistry,View,Text,ScrollView,TextInput,TouchableOpacity} = React; var MyApp = React.createClass({ doSomeWork: function () { console.log("doSomeWork called...."); }, render: function () { return ( <View> <TouchableOpacity style={{padding:10,alignItems:"center",backgroundColor:"blue"}} onPress={this.doSomeWork}> <Text>Do Some Work</Text> </TouchableOpacity> <View style={{height:400}}> <ScrollView keyboardShouldPersistTaps={true}> <View> <TextInput ref="first" onBlur={()=>{console.log("TextInput 1 blurred....")}}/> </View> <View> <TextInput ref="second" onBlur={()=>{console.log("TextInput 2 blurred....")}}/> </View> <View> <TextInput ref="third" onBlur={()=>{console.log("TextInput 3 blurred....")}}/> </View> </ScrollView> </View> </View> ); } }); AppRegistry.registerComponent('nativeApp', () => MyApp);
I tried to call
this.refs.first.blur()
manually, but it's in async, and I don't know what the TextInput event raised or not.
Any help would be appreciated.
source share