0

I have a single page with a scrollView and a lot of TextInputs, like :

<ScrollView>
   <TextInput/>
   <TextInput/>
   <TextInput/>
   <TextInput/>
   ...
</ScrollView>

The problem is : when the Keyboard shows, the Textinput is covered by the keyboard

Half-Solution found on Ios, that doesn't work with Android is to use a .measure() called on the Textinput which receive focus (OnFocus) And then scroll to the textInput

As you may now, .measure is used like :

element.measure( (fixed_x, fixed_y, width, height, page_x, page_y) => {callback} );

But fixed_x and y returns 0 everytime with Android (I've already tried https://github.com/facebook/react-native/issues/12966 with opacity and collapsable false)

I also tried this : React native: get current scroll position of scrollview

to get the scrollView current scroll and add what's missing to make the TextInput visible. No success (doesn't work ios/android)

https://github.com/Andr3wHur5t/react-native-keyboard-spacer is also not relevant because it creates a component which size changes, but doesn't help in scrolling to the correct TextInput

And last : https://github.com/APSL/react-native-keyboard-aware-scroll-view is absolutely perfect with ios, but very sadly don't work with android too

Do someone have a lead?

ide
  • 19,942
  • 5
  • 64
  • 106
ColdK
  • 1
  • 1
  • I do not understand your problem. In English, `Problem : Keyboard shows, Textinput is under keyboard` does not make sense. – Alex Jul 27 '17 at 17:59
  • Try this: https://facebook.github.io/react-native/docs/keyboardavoidingview.html – Henrik R Jul 27 '17 at 18:55
  • True Alex, I apologies for being not as verbose as I should have, this part is now edited. HenrikR => I have also tried this, but it is not quite adapted because the view contain more textinputs that you can fit in one screen and we need to be able to scroll between them. Even using a ScrollView inside this keyboardAvoidingView element isn't a viable solution. – ColdK Jul 27 '17 at 20:36
  • Next time do some research. – Khalil Khalaf Jul 27 '17 at 22:27

0 Answers0