React Native two time taps required for onPress event inside scrollview

Bha*_*ani 3 tap button reactjs react-native onpress

I'm using TextInput inside ScrollView and KeyboardAvoidingView but it require two time taps for submit text when keyboard is open.
for soluation i'm add keyboardShouldPersistTaps="always" but it not working.

render() {
    return (
        <View style={{flex: 1}}>
            <KeyboardAvoidingView style={{flex:1}}>
            <ScrollView keyboardShouldPersistTaps="always" 
                contentContainerStyle={{
                    paddingHorizontal: 10,
                    flexGrow : 1,
                    justifyContent : 'center',
                    alignItems:'center'}}>
                <View style={{backgroundColor:'green', width:'100%', borderRadius:8, overflow:'hidden'}}>
                    <TextInput style={{margin:10}}/>
                    <TouchableOpacity onPress={() => {alert('alert')}}>
                        <Text>Submit</Text>
                    </TouchableOpacity>
                </View>
            </ScrollView>
            </KeyboardAvoidingView>
        </View>
    )
}
Run Code Online (Sandbox Code Playgroud)

How to fire on press event on single tap?

小智 5

使用"handled"代替"always"keyboardShouldPersistTaps="handled"