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.

TextInput color issue in full screen editing

See original GitHub issue

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

Environment: OS: macOS High Sierra 10.13 Node: 8.7.0 Yarn: 1.2.1 npm: 5.5.1 Watchman: 4.9.0 Xcode: Xcode 9.0.1 Build version 9A1004 Android Studio: 2.3 AI-162.4069837

Packages: (wanted => installed) react: 16.0.0-beta.5 => 16.0.0-beta.5 react-native: 0.49.3 => 0.49.3

Target Platform: Android 7.1.1

Steps to Reproduce

  1. Create a TextInput with text color white
  2. Rotate phone to use full keyboard

Expected Behavior

The text color should change to black (or similar) in order to be visible on full keyboard layout.

Actual Behavior

If you have set a dark color for the background and your TextInput has a bright color, when you rotate to use the full keyboard layout, the android text input has a white background, but the text color stills bright.

Portrait mode: portraitMode

Landscape Mode: landscapeMode

P.S. The images are from a StackOverflow post which had no answers.

Reproducible Demo

import React from 'react';
import {
  StyleSheet,
  TextInput,
  View,
} from 'react-native';

const black = 'rgb(53, 52, 53)';
const white = 'rgb(244, 243, 243)';

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: black,
  },
  TextInputStyle: {
    color: white,
  },
});

export default () => (
  <View style={styles.container}>
    <TextInput
      placeholder="Placeholder"
      placeholderTextColor="white"
      style={styles.TextInputStyle}
    />
  </View>
);

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:9

github_iconTop GitHub Comments

2reactions
sintylapsecommented, Jan 29, 2018

@hoscarcito Hi. Store your text in state and use handler function to change it. In this case, color will change automatically.

export default class App extends React.Component {

    state = {
        value: ''
    }

    onChangeText = value => {
        this.setState({ value })
    }

    render(){


        return (
            <View style={styles.container}>
                <TextInput
                    placeholder="Placeholder"
                    placeholderTextColor="white"
                    style={styles.TextInputStyle}
                    value = {this.state.value}
                    onChangeText = {this.onChangeText}
                />
            </View>

        )
    }
}
1reaction
hoscarcitocommented, Jan 29, 2018

Oh you saved me!! It’s working in 0.52!!

Thank you so much!!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

React-native Text input color issue in full screen editing
In my case I only want the normal input editing and don't show the Fullscreen editor. <TextInput disableFullscreenUI={true} />.
Read more >
React Native TextInput color issue in fullscreen landscape ...
Coding example for the question React Native TextInput color issue in fullscreen landscape mode-React Native.
Read more >
Solved: Text Input's Text Color in "Disabled" Display Mode...
Solved: The text color of Text Input in Disabled Display Mode is rendered wrongly on iPhone PowerApps mobile app. When it is set...
Read more >
TextInput · React Native Paper
Changed text is passed as an argument to the callback handler. selectionColor. Type: string. Selection color of the input.
Read more >
<input>: The Input (Form Input) element - HTML
A field for editing an email address. Looks like a text input, but has validation parameters and relevant keyboard in supporting browsers and ......
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