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.

[KeyboardAvoidingView] Possible bug on android when typing on text input

See original GitHub issue

Is this a bug report?

Yes

Have you read the Bugs section of the Contributing to React Native Guide?

Yes

Environment

react-native-cli: 2.0.1 react-native: 0.46.1 npm 5.0.3 node 8.1.3 0.27.5

Target Platform: Android 7.1.1 and 8.0 OS: OSX 10.12.5

Steps to Reproduce

  1. Place an input inside a flex: 1
  2. Type something
  3. IT breaks

Expected Behavior

Keep the ui consistent while i’m typing

Actual Behavior

When Input value is not empty the ui looks different

Here a gif that shows the issue: https://cl.ly/1Y2z0J1p1i2L

Reproducible Demo

Code:

Render return

      <View style={{flex: 1}}>
        <Animatable.View animation="scaleDown" easing="ease-out" delay={150} style={[styles.wrapper, {backgroundColor: 'red'}]}>
          
          <View style={styles.overlay} />
        </Animatable.View>
        <View style={styles.screen}>
          <View style={styles.top}>
            <Animatable.View animation={this.state.entryAnimationEnd ? 'fadeIn' : null} style={styles.welcomeWrapper}>
              <Text style={[styles.welcomeText, styles.welcomeTitle]}>Welcome</Text>
              <Text style={styles.welcomeText}>test</Text>
            </Animatable.View>
          </View>
          <KeyboardAvoidingView style={styles.bottom} behavior="padding">

            <View style={[styles.inputsBg, {top: triangleHeight}]} />
            <TextInput
              ref={(textInput) => this.textInput = textInput}
              autoCapitalize="none"
            
              validator="url"
              tintColor="#999"
              containerStyle={styles.textField}
              label={I18n.t('login.Platform URL')} />
            <View style={styles.buttonWrapper}>
              <Button
                fullWidth
                onPress={this.bootstrapAttempt}
                disabled={this.props.appConfig.remoteFetching === 'LOADING'}
                type="neutral">
                Go to login
              </Button>
            </View>
          </KeyboardAvoidingView>
        </View>
      </View>

style

export default StyleSheet.create({
  screen: {
    flex: 1,
    flexDirection: 'column',
    justifyContent: 'space-around'
  },
  textField: {
    marginLeft: 16,
    marginRight: 16
  },
  overlay: {
    ...StyleSheet.absoluteFillObject,
    backgroundColor: 'black',
    opacity: 0.4,
    zIndex: 1
  },
  bgImage: {
    ...StyleSheet.absoluteFillObject,
    width: null,
    height: null,
    resizeMode: 'cover',
    zIndex: 0
  },
  wrapper: {
    ...StyleSheet.absoluteFillObject
  },
  top: {
    flex: 1
  },
  bottom: {
    flex: 1
  },
  inputsBg: {
    backgroundColor: '#f5f5f5',
    ...StyleSheet.absoluteFillObject
  }
});

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

8reactions
404sand808scommented, Feb 12, 2018

Did you ever end up solving this issue?

1reaction
Nickersoftcommented, Jul 16, 2017

I’m currently experiencing a similar issue on my app… the behavior of my KeyboardAvoidingView is set to “position”, and it behaves perfectly on iOS but results in a rather large gap on Android. Would love to hear more about the progress of this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

KeyboardAvoidingView not Working Properly - Stack Overflow
This is a known issue with KeyboardAvoidingView and Android. ... opening the keyboard to a specific element then (for example a text input)....
Read more >
Avoid Keyboard in React Native Like a Pro - Netguru
Learn how to make text fields accessible with visible keyboard in React Native apps based on keyboard avoiding view, keyboard events and ...
Read more >
react native keyboard avoiding view not working - You.com
Hi, I'm using View as a custom keyboard. Is it possible that default Keyboard is not showing when TextInput is in focus? Open...
Read more >
How to make your React Native app respond gracefully when ...
I found that the keyboard avoiding view doesn't quite work with the ... import React from 'react'; import { View, TextInput, Image }...
Read more >
TextInput - React Native
A foundational component for inputting text into the app via a keyboard. Props provide configurability for several features, ...
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