-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
iOS dictation is adding OBJ to string value #36521
Comments
#22139 may be related:
Reading discussion at that issue, it looks like the React Native team confirmed it as a real issue in 2019 but decided to stop tracking it in the issue tracker. I think a good first debugging step would be to check and see if |
#22139 having any solutions. Please provide a solution.
|
please provide a solution. |
onPress has nothing to do with this. The "OBJ" character bug OR duplicate text bug only appears on iOS 16+ only and is due to "continuous dictation" introduced in iOS 16, - @Facebook/react-native/issues/36045 This issue has open peer review on React Native - @Facebook/react-native/pull/37188 Also, you can verify this by logging text.codePointAt(...) within the onChange method, which returns the value 65532, corresponding to the U+FFFC character. The solution, for now, is to remove that char from the input: handleOnChangeText = (text: string) => {
const { onChangeText } = this.props;
if (onChangeText) {
onChangeText(isIos ? text.replace(/\uFFFC/g, '') : text);
}
}
<TextInput>
...
onChangeText={this.handleOnChangeText}
...
</TextInput> |
Maybe it's because of the iOS saves If you are using iOS native app, It will also have this \uFFFC, but when the dictation recognition ends, or you click other buttons, such as the send message button, the system will forcibly end the dictation, and this So I think #37188 may be able to solve your problem, because it can make the behavior consistent with iOS native |
@zhurylo - I replaced the OBJ value with an empty string using your example. Any other solution? |
Noting that this is also an issue in the WordPress mobile app, which we've worked around via the following code: Following this issue so we can remove the hack when this is resolved. |
I'm encountering this exact same problem. My current workaround involves eliminating the problematic character when the data is received on the server side. I accomplish this using the PHP function below. The second replacement operation includes the "[OBJ]" character, which might not be visible if you're viewing this on an iOS/MacOS device.
|
@stharvey - Thanks for the reply. I worked on this example. The below one is working fine. handleOnChangeText = (text: string) => { if (onChangeText) { |
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
This issue was closed because it has been stalled for 7 days with no activity. |
Do you still experience this issue? I have four years of experience maintaining facebook/react-native and I specialize in the Text and TextInput components. I currently have 58 facebook/react-native PRs. If you still experience this issue, I will prepare a patched release with the fix. Thanks a lot |
I tested the Textinput component on iOS 17, the react-native version:0.68.7.
I didn’t face this iOS dictation issue. Are any fixes done?
Thanks a lot.
|
Description
Hi,
When I use dictation adding text to TextInput in iOS.
OBJ is added to the text input value.
I am using iOS 16.
Please find the attached screenshot.
Thanks,

React Native Version
0.71.4
Output of
npx react-native info
System:
OS: macOS 13.2.1
CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
Memory: 118.30 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 19.8.1 - /usr/local/bin/node
Yarn: Not Found
npm: 9.5.1 - /usr/local/bin/npm
Watchman: 2023.03.13.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.12.0 - /Users/gopi/.rvm/gems/ruby-2.7.6/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
Android SDK:
API Levels: 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33
Build Tools: 28.0.3, 29.0.2, 30.0.2, 30.0.3, 31.0.0, 32.0.0, 32.1.0, 33.0.0
System Images: android-30 | Google APIs Intel x86 Atom, android-32 | Google APIs Intel x86 Atom_64, android-32 | Google Play Intel x86 Atom_64, android-33 | Google APIs Intel x86 Atom_64, android-33 | Google Play Intel x86 Atom_64
Android NDK: Not Found
IDEs:
Android Studio: 2021.2 AI-212.5712.43.2112.8609683
Xcode: 14.2/14C18 - /usr/bin/xcodebuild
Languages:
Java: 11.0.15 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.2.0 => 18.2.0
react-native: 0.71.4 => 0.71.4
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found
Steps to reproduce

A unique character OBJ is added to the text input value.Snack, code example, screenshot, or link to a repository
import React, { Component } from 'react';
import { StyleSheet, View, Text, TouchableOpacity, TextInput } from 'react-native';
export default class App extends Component {
constructor(props) {
super(props);
this.state = {
}
render() {
return (<View style={{ flex: 1 }}>
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
padding: 30,
justifyContent: 'center',
alignItems: 'center',
},
textareaContainer: {
height: 180,
padding: 5,
backgroundColor: '#F5FCFF',
},
textarea: {
textAlignVertical: 'top', // hack android
height: 170,
fontSize: 14,
color: '#333',
backgroundColor: 'white'
},
});
The text was updated successfully, but these errors were encountered: