question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Android] TextInput jerks up and down on focus and blur

See original GitHub issue

Describe the bug When using a TextInput in Modalize, focus and blur cause the modal to resize itself only after the keyboard appears. This only occurs on Android devices and it does not seem to matter which settings I choose unless I don’t set the height and have adjustContentToHeight={true}.

Example

<Modalize
    ref={modalRef}
    disableScrollIfPossible
    modalHeight={520}
    avoidKeyboardLikeIOS={false}
    keyboardAvoidingOffset={0}
    adjustToContentHeight={false}
>
    <View>
        <TextInput
            style={{ backgroundColor: "red" }}
        />
     </View>
</Modalize>

Another Example

<Modalize
    ref={modalRef}
    disableScrollIfPossible
    modalHeight={520}
    avoidKeyboardLikeIOS={true}
    keyboardAvoidingOffset={100}
    adjustToContentHeight={false}
>
    <View>
        <TextInput
            style={{ backgroundColor: "red" }}
        />
     </View>
</Modalize>

Dependencies:

  • react-native-modalize [2.0.6]
  • react-native [e.g. 0.62.2]
  • react-native-gesture-handler [1.6.0]
  • expo/react-navigation/react-native-navigation: [expo @38.0.0]

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:5

github_iconTop GitHub Comments

1reaction
JacksonLawcommented, Oct 11, 2020

Looks like a potential fix for this issue is using the new SDK 38 android setting as follows:

"android": {
  "softwareKeyboardLayoutMode": "pan"
}

I believe if you’re not using expo the same issue may be fixed with android:windowSoftInputMode=“adjustPan” in your android manifest.

Can anyone else confirm this is a suitable fix? I will close the issue if so

0reactions
JacksonLawcommented, Oct 13, 2020

what to do if using expo?

update to expo SDK 38 and add the code above to your app.json file

Read more comments on GitHub >

github_iconTop Results From Across the Web

React native text input blur/focus issue - Stack Overflow
In my case focus jumps from one textinput to another when option is enabled and it only happens for android api level <...
Read more >
Focusing: focus/blur - The Modern JavaScript Tutorial
The focus event is called on focusing, and blur – when the element loses the focus. Let's use them for validation of an...
Read more >
modal with text input display up and down when input ... - GitHub
Open a long page with some text and one button in the middle of page using Android Chrome browser. Scroll the page to...
Read more >
Handle input method visibility | Android Developers
When input focus moves in or out of an editable text field, Android shows or hides the input method—such as the on-screen keyboard—as ......
Read more >
Fixed header jumps down when keyboard opens on focus ...
I found a way around it. Here it is for future reference if anyone has a similar issue. First you need Modernizr to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found