Skip to content

Conversation

@rgngl
Copy link

@rgngl rgngl commented Jan 18, 2017

On Android, currently set default SOFT_INPUT_ADJUST_RESIZE for modal windows is ignored if the window is fullscreen and this usually breaks apps. So, with this property, it is possible to set how the window is treated when an input method is shown on Android. The mode nothing works like how it is on iOS, which doesn't do any resizing and the developer has to take care of it.

The default value for the property is resize as it was hardcoded before.

Test plan (required)

Open a modal window and set softInputMode property. Does nothing on iOS.

@facebook-github-bot
Copy link
Contributor

By analyzing the blame information on this pull request, we identified @andreicoman11 and @ericnakagawa to be potential reviewers.

@facebook-github-bot facebook-github-bot added GH Review: review-needed CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. labels Jan 18, 2017
@andreicoman11
Copy link
Contributor

On Android, currently set default SOFT_INPUT_ADJUST_RESIZE for modal windows is ignored if the window is fullscreen and this usually breaks apps.

I think this is incorrect. Do you have an example I can repro to check?

@rgngl
Copy link
Author

rgngl commented Jan 18, 2017

I can provide a test app too, but the documentation is quite clear:

Adjustment option for softInputMode: set to allow the window to be resized when an input method is shown, so that its contents are not covered by the input method. This can not be combined with SOFT_INPUT_ADJUST_PAN; if neither of these are set, then the system will try to pick one or the other depending on the contents of the window. If the window's layout parameter flags include FLAG_FULLSCREEN, this value for softInputMode will be ignored; the window will not resize, but will stay fullscreen.

https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#SOFT_INPUT_ADJUST_RESIZE

@andreicoman11
Copy link
Contributor

On Android, currently set default SOFT_INPUT_ADJUST_RESIZE for modal windows is ignored if the window is fullscreen and this usually breaks apps.

I tested this out in UIExplorer/Modal and the Modal and keyboard are working as expected.
I added a new TextInput underneath the Close Button:

<TextInput
  style={{
    backgroundColor: 'green',
    width: 300,
}}/>

and the following to the container style:

    borderWidth: 5,
    borderColor: 'red',

Upon the TextInput receiving focus, the Modal resizes correctly and the keyboard appears:
screen shot 2017-01-21 at 10 38 38 am

This eliminates the absolute necessity of having this prop set.
In addition to that, I strongly believe that the resize option should be set on the Modal. It provides the best behavior on Android, and the system takes care of everything for you. I understand that iOS behaves differently in this case, but if the OS gives you something like this for free, you should take it.
If we find out that more and more developers would really like to change this prop on Modals, and the hardcoded resize option is no longer the best, we will expose this prop. Other than that though, I recommend setting this prop manually in your project only.

@rgngl
Copy link
Author

rgngl commented Jan 21, 2017

Hi,

again you have misunderstood me. In this screenshot you provide the modal window is not fullscreen(i.e. has the status bar visible) so it will resize. If your application has a theme where status bar is not visible this is going to break things because the modal window is not going to resize.

@djhr
Copy link

djhr commented Jul 31, 2019

Hi @andreicoman11 I actually have a project where I need to customize the windowSoftInputMode in the modals, it uses adjustNothing and at the moment can't find a way to make it behave uniformly on modals. Any chance to reconsider this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants