Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android doesn't respect autoCapitalize when secureTextEntry is set #17099

Closed
joshhornby opened this issue Dec 6, 2017 · 2 comments
Closed

Android doesn't respect autoCapitalize when secureTextEntry is set #17099

joshhornby opened this issue Dec 6, 2017 · 2 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@joshhornby
Copy link

joshhornby commented Dec 6, 2017

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

Environment:
  OS: macOS Sierra 10.12.6
  Node: 8.4.0
  Yarn: 1.2.1
  npm: 5.3.0
  Watchman: 4.9.0
  Xcode: Xcode 9.1 Build version 9B55
  Android Studio: 3.0 AI-171.4408382

Packages: (wanted => installed)
  react: 16.0.0 => 16.0.0
  react-native: 0.50.1 => 0.50.1

Steps to Reproduce

<View style={styles.container}>
        <TextInput
          placeholder="Text"
          secureTextEntry={true}
          autoCapitalize="none"
          underlineColorAndroid="rgba(0, 0, 0, 0)"
        />
      </View>

Expected Behavior

Keyboard shouldn't be auto capitalized. It seems when autoCapitalize and secureTextEntry are both set autoCapitalize is ignored. If I remove secureTextEntry then autoCapitalize works as expected. This only happens on Android.

Actual Behavior

Keyboard is auto capitalized when secureTextEntry is set

Reproducible Demo

https://snack.expo.io/ByoIR0rbG

@Sommerfeld
Copy link

Sommerfeld commented Dec 7, 2017

I just made a project with react-native init foo and pasted your code. My actual behaviour is not a auto capitalized keyboard. (Android Emulator - Nexus 5X API25)
Additionally (just to clarify) the first character is lower cased if I start typing without pressing shift before.

Also downgraded to your react-native version. Same result.

Edit: Even in Expo the keyboard is lowercased for me.


Even so I can not reproduce this behaviour: As far as I see react-native does not unset any input type flags set by autoCapitalize when setting secureTextEntry (or other way around). So I don't think we could call it a react-native bug. This might be a problem with some versions of android?

@ReactProp(name = "secureTextEntry", defaultBoolean = false)
public void setSecureTextEntry(ReactEditText view, boolean password) {
updateStagedInputTypeFlag(
view,
password ? 0 :
InputType.TYPE_NUMBER_VARIATION_PASSWORD | InputType.TYPE_TEXT_VARIATION_PASSWORD,
password ? InputType.TYPE_TEXT_VARIATION_PASSWORD : 0);
checkPasswordType(view);
}
@ReactProp(name = "autoCapitalize")
public void setAutoCapitalize(ReactEditText view, int autoCapitalize) {
updateStagedInputTypeFlag(
view,
InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_CAP_WORDS |
InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS,
autoCapitalize);
}

@joshhornby
Copy link
Author

Thanks for the response @Sommerfeld.

I updated to the latest React Native and seemed to work on my Android device. So putting it down to something strange in Android, thanks.

@facebook facebook locked as resolved and limited conversation to collaborators Dec 8, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Dec 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

3 participants