react-native-animatable icon indicating copy to clipboard operation
react-native-animatable copied to clipboard

TextInput focus lost after the very first animation

Open TexxUkr opened this issue 7 years ago • 4 comments

I use "animatable" to shake the TextInput. TextInput has autoFocus=true. The problem is - when animation is done then TextInput focus is lost and keyboard disappears. This happens only for the very first time of animation call. If after the first animation call I return the focus by tapping TextInput and call animation again the focus stays on TextInput and keyboard stays on the screen. I tried to bind autoFocus with some internal state but did not help. Looks like after the first animation autoFocus value for TextInput element is totally ignored even if change it. I there any way to keep focus on the TextInput after the animation call?

react-native: 0.56.0 react-native-animatable: 1.3.0 android

... <View> <Animatable.View ref={this.handleViewRef} useNativeDriver={Platform.OS === 'android'}> <TextInput autoFocus={true} value="SOME TEXT INPUT WITH AUTOFOCUS"/> </Animatable.View> </View> <TouchableOpacity onPress={this.animate}> <Text> Shake It! </Text> </TouchableOpacity> ...

Thanks

automatable text input focus loosing

TexxUkr avatar Jul 16 '18 13:07 TexxUkr

Have you managed to find a solution for this?

rodrigofeijao avatar Jan 23 '19 22:01 rodrigofeijao

I managed it in the way of returning focus to the text input after the shake I did this.textInput.blur(); setTimeout(() => this.textInput.focus(), 50); so keyboard disappears and appears again on focus here this.textInput is the result of TextInput ref

hope this could help

TexxUkr avatar Jan 24 '19 03:01 TexxUkr

I have the same problem, does anyone have a solution?

minhdat97 avatar Apr 12 '20 09:04 minhdat97

same problem here any solution ?

FadiAboMsalam avatar Jan 08 '22 18:01 FadiAboMsalam