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 (IOS) : maxLength & multiline true = onChangeText multiple call #44566

Open
mlcpro opened this issue May 14, 2024 · 4 comments
Open
Labels

Comments

@mlcpro
Copy link

mlcpro commented May 14, 2024

Description

I have noticed that when we have maxLength={number} and multiline={true}, if I manually modify my state with a long sentence, the onChangeText function is called 5 times, and furthermore, it modifies the initial value. Please take a look at the snack link I provided and see for yourself the value assigned to setDescription1 and the output value in the console.

Steps to reproduce

  1. In the snack link that I provided, put it on the IOS part and click on the "Change text" button

React Native Version

0.74.1

Affected Platforms

Runtime - iOS

Output of npx react-native info

System:
  OS: macOS 14.4
  CPU: (8) arm64 Apple M3
  Memory: 448.80 MB / 24.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 21.5.0
    path: /opt/homebrew/opt/node/bin/node
  Yarn:
    version: 1.22.21
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.2.4
    path: /opt/homebrew/opt/node/bin/npm
  Watchman:
    version: 2023.12.04.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.14.3
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.2
      - iOS 17.2
      - macOS 14.2
      - tvOS 17.2
      - visionOS 1.0
      - watchOS 10.2
  Android SDK: Not Found
IDEs:
  Android Studio: Not Found
  Xcode:
    version: 15.2/15C500b
    path: /usr/bin/xcodebuild
Languages:
  Java: Not Found
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.1
    wanted: 0.73.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Stacktrace or Logs

Before :

In the Shadow of Young Girls in Flowers, published in 1913, second volume of In Search of Lost Time, won the Goncourt Prize in 1919. For Marcel Proust (1871-1922), it was the rebirth of a work

After :

In the SIn the Shadow of Young Girls in Flowers, published in 1913, second volume of In Search of Lost Time, won the Goncourt Prize in 1919. For Marcel Proust (1871-1922), it was the rebirth of a work

Reproducer

https://snack.expo.dev/MAi9wJ0nAa6mk3BlwkFF-

Screenshots and Videos

No response

Copy link

⚠️ Newer Version of React Native is Available!
ℹ️ You are on a supported minor version, but it looks like there's a newer patch available - 0.73.8. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.

@github-actions github-actions bot added Newer Patch Available Component: TextInput Related to the TextInput component. Platform: iOS iOS applications. labels May 14, 2024
@Daha62
Copy link

Daha62 commented May 14, 2024

Having the same issue on react-native 0.72.13 with multiline

@lorenc-tomasz
Copy link

Very annoying bug. You can check this topic: #36494 I guess it's the same, and there are some workarounds for this issue.

@mlcpro
Copy link
Author

mlcpro commented May 15, 2024

Very annoying bug. You can check this topic: #36494 I guess it's the same, and there are some workarounds for this issue.

Yes I have already seen this issue, as it is closed I re-opened the subject because the problem is still present

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants