Thursday, August 16, 2018

react-native `keyboardShouldPersistPanGesture` event that prevents the keyboard from dismissing on fast swipe events

Leave a Comment

I am building a keyboard accessory component where there will be a scroll through option above the keyboard, very similar to Twitter's keyboard. My view hiearchy is:

<InputAccessoryView>     <View style={myStyle}>         <ScrollView horizontal={true} keyboardShouldPersistTaps={'always'}            {[...Array(n).keys()].map(uid => this.renderBubble(uid) })}         </ScrollView>    </View> </InputAccessoryView> 

By putting keyboardShouldPersistTaps as always, I can make sure the press event does not dismiss the keyboard. However when I scroll through the items in ScrollView, the keyboard dismisses if I scroll too quickly, the keyboard does not dismiss if I scroll slowly. The docs here: https://facebook.github.io/react-native/docs/gesture-responder-system and here: https://facebook.github.io/react-native/docs/scrollview#onmomentumscrollbegin do not give me a way to capture a long pan event. Is there an API to do this so I scroll through the ScrollView items as fast as I want, and the keyboard will not dismiss?

1 Answers

Answers 1

check some of these sources:

https://geekhub.co.kr/react-native/releases/0.37/docs/scrollview.html

Dismissing the keyboard in a UIScrollView

https://medium.com/react-native-training/todays-react-native-tip-keyboard-issues-in-scrollview-8cfbeb92995b

https://geekhub.co.kr/react-native/releases/0.37/docs/scrollview.html

https://rebolt.callstack.com/docs/scroll-view.html

UITextView keyboardDismissMode Bug

hopefully this makes it easier for you. I know this isnt a solution that you may be looking for, but it will give you a starting point, i will continue working on this and if i find something will come back here and edit my answer.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment