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

TextInput can't be set to undefined programmatically #34862

Closed
Noitham opened this issue Oct 4, 2022 · 2 comments
Closed

TextInput can't be set to undefined programmatically #34862

Noitham opened this issue Oct 4, 2022 · 2 comments
Labels
Component: TextInput Related to the TextInput component. Resolution: Fixed A PR that fixes this issue has been merged.

Comments

@Noitham
Copy link

Noitham commented Oct 4, 2022

Description

Noticed that after updating to 0.70.1, our <TextInput> components weren't clearing their values when setting them programmatically to undefined.

This behaviour used to work on versions prior to the 0.70.x.

Version

0.70.x

Output of npx react-native info

npx react-native info                                                        1m 8s
info Fetching system and libraries information...
System:
    OS: macOS 12.6
    CPU: (10) arm64 Apple M1 Pro
    Memory: 1.65 GB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.6.0 - /opt/homebrew/bin/node
    Yarn: 3.2.0 - /opt/homebrew/bin/yarn
    npm: 8.13.2 - /opt/homebrew/bin/npm
    Watchman: 2022.07.04.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /Users/dmorales/.asdf/shims/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 16.0, macOS 12.3, tvOS 16.0, watchOS 9.0
    Android SDK: Not Found
  IDEs:
    Android Studio: 2021.3 AI-213.7172.25.2113.9014738
    Xcode: 14.0.1/14A400 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.16 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.1.0 => 18.1.0 
    react-native: 0.70.1 => 0.70.1 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to reproduce

Generate a project using react-native version 0.70.x.

  1. Add a <TextInput> component.
  2. Set its value to some string.
  3. Attempt to set its value to undefined programmatically

Result:

The value shown on the <TextInput> component will not be cleared and still show the value entered.

Prior to 0.70.x react-native version, the value shown on the <TextInput> would be cleared since it's been set to undefined.

Snack, code example, screenshot, or link to a repository

Created a repository having two different projects with the same setup.

One used react-native 0.69.6, and the other one 0.70.1.

https://github.com/Noitham/TextInputIssue

Screen.Recording.2022-10-04.at.15.00.22.mov
@react-native-bot react-native-bot added the Component: TextInput Related to the TextInput component. label Oct 4, 2022
@Noitham
Copy link
Author

Noitham commented Oct 4, 2022

Seems that this has already been taken care of with commit:

191eb62

@cortinico
Copy link
Contributor

Closing as this is fixed and will land in 0.71 👍

@cortinico cortinico added Resolution: Fixed A PR that fixes this issue has been merged. and removed Needs: Triage 🔍 labels Oct 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: TextInput Related to the TextInput component. Resolution: Fixed A PR that fixes this issue has been merged.
Projects
None yet
Development

No branches or pull requests

3 participants