[Solved] React native ScrollView keyboardShouldPersistTaps not working Android

I have the following code, which works on my iOS app and keeps the keyboard open when clicking anywhere on the screen, but on Android it still closes the keyboard, any ideas?

return (
            <ScrollView
                style={ styles.flex }
                automaticallyAdjustContentInsets={ false }
                keyboardShouldPersistTaps={ true }
                contentInset={{ 'bottom':20 }}
                keyboardDismissMode='on-drag'
                >
                <View>...</View>
            </ScrollView>
        );

Solution #1:

Can you please try this. keyboardShouldPersistTaps=”handled”

Respondent: 6face

Solution #2:

Value true was deprecated for this option, use always instead:

keyboardShouldPersistTaps="always"

Docs

Respondent: zishe

Solution #3:

I am expecting above answers would have fixed your problem, here is the doc

Just a side note, you should provide keyboardShouldPersistTaps to the first ScrollView on the screen.

Respondent: Furquan

Solution #4:

if your ScrollView/FlatList is inside another ScrollView/Flatlist you have to set keyboardShouldPersistTaps to parent ScrollView/Flatlist as well as all nested ones

Respondent: Nikhil bhatia

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Leave a Reply

Your email address will not be published.