React-native-keyboard-aware-scroll-view: Double click

Created on 6 Mar 2018  Â·  10Comments  Â·  Source: APSL/react-native-keyboard-aware-scroll-view

I have created a TextInput and a Button, after setting the text i want to click on the button but the behavior is weird. I have to click 2 times on the button, the first time is to close the keyboard, the second click is then calling the onPress. Is there a workaround for this?

React Native question

Most helpful comment

@NikoMontana, Property keyboardShouldPersistTaps='always' should solve your problem.

https://facebook.github.io/react-native/docs/scrollview.html#keyboardshouldpersisttaps

All 10 comments

@NikoMontana, Property keyboardShouldPersistTaps='always' should solve your problem.

https://facebook.github.io/react-native/docs/scrollview.html#keyboardshouldpersisttaps

I have tried this back in time when I was having problems with it. There was something else weird going on for this solution @antofa.

I finally decided not to use this lib. I went for KeyboardAvoidingView from React Native itself. Here is a short snippet if anyone else would ever need it.

<TouchableWithoutFeedback onPress={() => Keyboard.dismiss()}> <KeyboardAvoidingView behavior="position"> ....

You have to set keyboardShouldPersistTaps='always' on KeyboardAwareScrollView component

@GoshaEgorian but set keyboardShouldPersistTaps to always make touch outsite keyboard cant dismiss , how can i make only its working on my button .

@GoshaEgorian The button works but keyboard does not dismiss!

Set keyboardShouldPersistTaps='always'

onPress={() => {
    Keyboard.dismiss()
}}

On my side the following line of code really do the job :
<KeyboardAwareScrollView keyboardShouldPersistTaps="handled">
I can click on buttons only once when the keyboard is open and the keyboard dismiss when I click outside text fields

In my case I fixed the double tap issue by passing this prop to ScrollableTabView component.
contentProps={{keyboardShouldPersistTaps: 'always'}}

pass "keyboardShouldPersistTaps: 'always'" to contentProps inside
ScrollableTabView Component

contentProps={{keyboardShouldPersistTaps: 'always'}}

On Tue, 4 May 2021, 13:58 Abdulla Skiplino, @.*>
wrote:

@rajitha302 https://github.com/rajitha302
can you please elaborate on you solution? how did you pass the prop to
ScrollableTabView and what did you pass?
many thanks

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/APSL/react-native-keyboard-aware-scroll-view/issues/233#issuecomment-831770217,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AF52DM3ZZNGGHXBGHHAXYXDTL6V3RANCNFSM4ET2ILXQ
.

Was this page helpful?
0 / 5 - 0 ratings