2

TextInput in android is not working when i click on the input and start typing, no text is shown as input. I tested it on android 8.1 and 7.1.

react-native-cli : 2.0.1 react-native : 0.55.4

class LoginForm extends Component{
    state={text: ''};
    render(){

        return(
            <Card>
                <CardSection>
                    <TextInput
                        value={this.state.text}
                        onChangeText={(text)=>this.setState({text})}

                        style={{height: 20, width: 1.0}}
                    />
                </CardSection>
                <CardSection/>

                <CardSection>
                    <Button>Log In</Button>
                </CardSection>
            </Card>
        );
    }
}
9
  • 1
    Welcome to SO. You should provide a minimal example so that others can reproduce your problem. Please see here Commented May 13, 2018 at 16:21
  • Please mention react-native version also and if possible share some sample code. Commented May 13, 2018 at 16:21
  • Can you provide expo snack link? Commented May 13, 2018 at 16:21
  • @gus27 thanks for the advice i will remember it in future Commented May 13, 2018 at 17:09
  • @PrasunPal here is the code and the react-native version. Commented May 13, 2018 at 17:09

3 Answers 3

5

We can give padding: 0;. For me its working fine.

Sign up to request clarification or add additional context in comments.

1 Comment

I tried doubling height and take care of darkmode but this paddgin: 0 what truly solved my issue.
4

Try doubling the height of the text input style. I was having the same issue, and doubling the height to 40 fixed it for me. Seems to be an issue with android specifically.

Where I found this solution

1 Comment

This worked for me on Android, but doesn't feel like a solution, now the text input field is really tall, seems that we should be able to specify a smaller height for the TextInput and still see the text in the box that the user enters.
1

implementation 'androidx.appcompat:appcompat:1.6.0' // remove this library and it works from build.gradle in app file

1 Comment

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.