iOS textContentType suggestion are trimmed with maxLength, and can't be overridden.
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 127k
- Forks
- 25.3k
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 4
Description
Description
When adding textContentType in iOS with maxLength=10 the tap on suggestion gives irrelevant results.
Steps to reproduce
In TextInput try adding below props;
textContentType={'telephoneNumber'},
maxLength={10}
This will give mobile number suggestion to you, the mobile number sometimes have country code and spaces in between, when user tap on the mobile number the autofill results are not suitable.
For example:
If mobile number is 88844 33322 having 11 characters the last digit will be trimmed
suggestion: 88844 33322
result: 88844 3332
So we need a mechanism to trim out the spaces/country code before filling the same in the textinput. Currently onChangeText is called with trimmed result, so no way to format before calling onChangeText, when maxLength is set.
React Native Version
0.73.1
Affected Platforms
Runtime - iOS
Output of npx react-native info
System:
OS: macOS 14.4.1
CPU: (8) arm64 Apple M1
Memory: 68.98 MB / 16.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 18.16.1
path: ~/.nvm/versions/node/v18.16.1/bin/node
Yarn:
version: 1.22.22
path: ~/.nvm/versions/node/v18.16.1/bin/yarn
npm:
version: 9.5.1
path: ~/.nvm/versions/node/v18.16.1/bin/npm
Watchman:
version: 2023.12.04.00
path: /usr/local/bin/watchman
Managers:
CocoaPods:
version: 1.15.2
path: /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 23.4
- iOS 17.4
- macOS 14.4
- tvOS 17.4
- visionOS 1.1
- watchOS 10.4
Android SDK:
API Levels:
- "17"
- "23"
- "27"
- "28"
- "29"
- "30"
- "31"
- "33"
- "34"
Build Tools:
- 29.0.2
- 30.0.0
- 30.0.1
- 30.0.2
- 30.0.3
- 31.0.0
- 33.0.0
- 33.0.1
- 34.0.0
System Images:
- android-26 | Google APIs ARM 64 v8a
- android-28 | Google ARM64-V8a Play ARM 64 v8a
- android-29 | Google Play ARM 64 v8a
- android-30 | Google APIs ARM 64 v8a
- android-31 | Google APIs ARM 64 v8a
- android-32 | Google Play ARM 64 v8a
- android-34 | Google APIs ARM 64 v8a
Android NDK: Not Found
IDEs:
Android Studio: 2023.2 AI-232.10300.40.2321.11668458
Xcode:
version: 15.3/15E204a
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.6
path: /usr/bin/javac
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
N/A
Reproducer
Snack (https://snack.expo.dev/coZ_oQ_slq87v8yIMImV4)
Screenshots and Videos
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the TextInput implementation and reproduce the issue using the linked Snack, focusing on the interaction between textContentType, maxLength, and iOS autofill. Done means an autofilled telephone number is handled before maxLength truncates it, while onChangeText receives a usable value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, javascript, react-native
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100