4

In my react-native app, I need different screen behaviour on different screens when keyboard pops up.
In some screens i need the screen to move up, and in some screens i do not want to change the screen position etc.

Individual behaviours can be achieved by setting values of android:windowSoftInputMode to adjustNothing or adjustResize in AndroidManifest.xml file.

But setting these values in the manifest file changes the behaviour for all the screens.

Is there a way to change it programmatically within different screens ?

In android code it looks achievable using a getWindow() call. How to do it in react-native ?

kernelman
  • 992
  • 1
  • 13
  • 28

2 Answers2

1

try use ScrollView instead of View then wrap it on KeyboardAvoidingView

Praya
  • 99
  • 5
  • ScrollView also pushes the view Up. on Some screens i do not want any screen change (i want lower part of the screen to get hidden when keyboard pops up, and upper part, which is a map, should not move at all, its possible with "adjustNothing" value, but it should be dynamically set on this screen only) – kernelman Oct 21 '20 at 01:54
1

Try this component react-native-android-keyboard-adjust

When the component in which you don't want to move up views mounts, set AndroidKeyboardAdjust.setAdjustPan() and when that component unmount reset it to AndroidKeyboardAdjust.setAdjustResize() or whatever option that suits your criteria

See this answer