Abdulla kh. Skip
Abdulla kh. Skip

Reputation: 101

React-native click button while keyboard is presented

I have several inputs fields that are presented one after the other using flatlist and smartView that represents each input, with the structure being like this:

    <View>
    <Dialog>
    <View >
    <KeyboardAvoidingView>
    <FlatList
    renderItem={({ item }) => (
    <SmartView //structure of view per input
 <SafeAreaView>
<View>
   <InputItem/>
 <TouchableNativeFeedback/> //button that must be clicked
</View>
 </SafeAreaView>
 />
    )}>
    </KeyboardAvoidingView>
    </View>
    </Dialog>
    </View >

The class <InputItem/> contains the <TextInput> in question and the <TouchableNativeFeedback/> is on the same level as the <InputItem/>

I just need for the button to register a click WHEN KEYBOARD is showing, as this app is running on iPad and keyboard do not come in they way of anything. Many thanks

Upvotes: 4

Views: 3277

Answers (2)

Abdulla kh. Skip
Abdulla kh. Skip

Reputation: 101

Fixed issue by adding keyboardShouldPersistTaps={"always"} to component <Dialog>.

Upvotes: 6

JAKE
JAKE

Reputation: 547

Add this prop to your FlatList so that touches will get detected even though the keyboard is opened: keyboardShouldPersistTaps="handled" or keyboardShouldPersistTaps="always"

Upvotes: 1

Related Questions