react-native-keyboard-aware-scroll-view icon indicating copy to clipboard operation
react-native-keyboard-aware-scroll-view copied to clipboard

screen bouncing while focusing on of the input

Open ganesh-papola opened this issue 5 years ago • 25 comments

Screen is bouncing up and down when jumping to any text input

ganesh-papola avatar Jan 20 '20 12:01 ganesh-papola

I'm having the same problem

jpamarohorta avatar Jan 22 '20 17:01 jpamarohorta

have you got scrollEnabled={false} on the input? I took it off and it's working better

louisholley avatar Jan 31 '20 10:01 louisholley

@louisholley well that should work but i need scroll enabled, so can't turn it off

ganesh-papola avatar Feb 03 '20 12:02 ganesh-papola

Try replacing

setTimeout(() => {
  if (!this.mountedComponent) {
    return
  }
  const responder = this.getScrollResponder()
  responder &&
    responder.scrollResponderScrollNativeHandleToKeyboard(
      reactNode,
      extraHeight,
      true
    )
}, keyboardOpeningTime)

with

if (this.mountedComponent) {
  UIManager.measureLayout(
    reactNode,
    0,
    () => {},
    (x, y, width, height) => {
      findNodeHandle(this._rnkasv_keyboardView), (x, y, width, height) => {
        this._rnkasv_keyboardView.scrollToPosition(0, parseInt(y) - height - extraHeight, true);
    }
  });
}

inside KeyboardAwareHOC.scrollToFocusedInput()

thijs-qv avatar Apr 08 '20 08:04 thijs-qv

@thijs-qv solution worked for me, thank you!

peterson79 avatar Apr 13 '20 18:04 peterson79

Thanks @thijs-qv. Has a PR been submitted for this?

steve228uk avatar Apr 15 '20 17:04 steve228uk

I've just submitted a PR. Not sure if this library is actively maintained though.

thijs-qv avatar Apr 16 '20 06:04 thijs-qv

I managed to solve it by setting keyboardOpeningTime={Number.MAX_SAFE_INTEGER}, but it's just a workaround.

JoseLion avatar Apr 22 '20 00:04 JoseLion

I managed to solve it by setting keyboardOpeningTime={Number.MAX_SAFE_INTEGER}, but it's just a workaround.

Thank you very much, you saved my day

ntk0104 avatar Jul 15 '20 03:07 ntk0104

I managed to solve it by setting keyboardOpeningTime={Number.MAX_SAFE_INTEGER}, but it's just a workaround.

Solved! Thanks

serhiimahdiuk avatar Jul 23 '20 10:07 serhiimahdiuk

 <KeyboardAwareScrollView
      scrollEnabled={true}
      extraScrollHeight={-64}
      keyboardShouldPersistTaps="handled"
      enableAutoAutomaticScroll={false}
      enableOnAndroid={true}
      keyboardOpeningTime={Number.MAX_SAFE_INTEGER}
      {...props}>
      {props.children}
</KeyboardAwareScrollView>

it is work for me

cihanbas avatar Aug 18 '20 09:08 cihanbas

I managed to solve it by setting keyboardOpeningTime={Number.MAX_SAFE_INTEGER}, but it's just a workaround.

You saved our lives. Me and my pair friend spent a week for keyboards problems of react-native. We replaced the component <KeyboardAvoidingView> for android problem but in IOS we spent too many for bouncing problem. God bless you! 🚀 :godmode:

keremcubuk avatar Jan 27 '21 08:01 keremcubuk

I managed to solve it by setting keyboardOpeningTime={Number.MAX_SAFE_INTEGER}, but it's just a workaround.

This also solved it for me. I'd like to know what the root cause is though and how to avoid it though.

mgwedd avatar Mar 15 '21 15:03 mgwedd

I managed to solve it by setting keyboardOpeningTime={Number.MAX_SAFE_INTEGER}, but it's just a workaround.

WORKING :)

biz-kevin avatar Nov 22 '21 06:11 biz-kevin

I managed to solve it by setting keyboardOpeningTime={Number.MAX_SAFE_INTEGER}, but it's just a workaround.

Working, you saved my day

anhkieet avatar Mar 08 '22 10:03 anhkieet

For those of you wondering (just like me): Number.MAX_SAFE_INTEGER is defined as 2^53 - 1, that is, 9007199254740991

The keyboardOpeningTime prop receives a number as miliseconds, so setting keyboardOpeningTime={Number.MAX_SAFE_INTEGER} actually means:

  • 9007199254741 seconds
  • 150119987579 minutes
  • 2501999793 hours
  • 104249991 days
  • 3425051 months
  • 285421 years

So yea... that

luchozamora avatar Mar 09 '22 06:03 luchozamora

Although If you set an extraHeight , this issue goes away

sandipndev avatar Apr 04 '22 09:04 sandipndev

@JoseLion You should run for president! The world owes you for that fix!

Pat-Gekoski avatar Jun 03 '22 17:06 Pat-Gekoski

@JoseLion You sir you have my respect, thanks for the workaround 👍

vjoby-wavefin avatar Jun 24 '22 15:06 vjoby-wavefin

I managed to solve it by setting keyboardOpeningTime={Number.MAX_SAFE_INTEGER}, but it's just a workaround.

~this just makes the view not scroll for me... as in the view doesn't avoid the keyboard...~ I had scrollEnabled set to false. setting that to true did improve the behavior.

heyalexchoi avatar Aug 08 '22 14:08 heyalexchoi

I managed to solve it by setting keyboardOpeningTime={Number.MAX_SAFE_INTEGER}, but it's just a workaround.

I was about to go bald, thanks!

scott-dang avatar Jan 14 '23 05:01 scott-dang

I managed to solve it by setting keyboardOpeningTime={Number.MAX_SAFE_INTEGER}, but it's just a workaround.

After applying so many things it works finally Thanks 😊 🙏 . But can you explain how it works??

ahsanbhatti98 avatar Mar 01 '23 12:03 ahsanbhatti98

I managed to solve it by setting keyboardOpeningTime={Number.MAX_SAFE_INTEGER}, but it's just a workaround.

Wow! Thanks a bunch my superhero!

nibinb avatar Jul 01 '23 07:07 nibinb

keyboardOpeningTime={Number.MAX_SAFE_INTEGER} 🙇

pkayokay avatar Aug 30 '23 02:08 pkayokay

enableAutomaticScroll={Platform.OS === 'ios'} worked for me, keyboardOpeningTime={Number.MAX_SAFE_INTEGER} didn't

MasonTModea avatar Sep 14 '23 17:09 MasonTModea