Repository navigation
Closed
Closed
Copy link
Labels
BugComponent: TextInputRelated to the TextInput component.Related to the TextInput component.Impact: RegressionDescribes a behavior that used to work on a prior release, but stopped working recently.Describes a behavior that used to work on a prior release, but stopped working recently.Platform: AndroidAndroid applications.Android applications.Ran CommandsOne of our bots successfully processed a command.One of our bots successfully processed a command.StaleThere has been a lack of activity on this issue and it may be closed soon.There has been a lack of activity on this issue and it may be closed soon.
Description
On 0.53.0 and later, including 0.54.2, if I input an emoji into a TextInput via auto-complete, the app crashes.
I've tracked down the root cause; I'll put more details in a follow-up comment.
Environment
Environment:
OS: macOS High Sierra 10.13.3
Node: 9.7.1
Yarn: 1.5.1
npm: 5.6.0
Watchman: 4.9.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: Not Found
Packages: (wanted => installed)
react: 16.2.0 => 16.2.0
react-native: 0.53.3 => 0.53.3
Expected Behavior
No crash!
Actual Behavior
Crash stack:
Error calling RCTEventEmitter.receiveEvent
Failed to create Value from JSON:
run
NativeRunnable.java
handleCallback
Handler.java:790
dispatchMessage
Handler.java:99
dispatchMessage
MessageQueueThreadHandler.java:31
loop
Looper.java:164
run
MessageQueueThreadImpl.java:194
run
Thread.java:764
Steps to Reproduce
Fortunately, this repros with the example project from #18262 .
- Clone and run this repo https://github.com/lxcid/ReactNative-AndroidKeyPress
- Make sure you have an Android device attached for debugging.
- react-native run-android
- select the TextInput
- type 'potato'
- tap the potato emoji that shows up in autocomplete.
Reacted by Michael Mason, Nick Partridge, Yarian Luisson, Trenton, Douglas M. Barcellos, Tan Dat, fufuninja, elliscwc and Jan Czizikow
Metadata
Metadata
Assignees
Labels
BugComponent: TextInputRelated to the TextInput component.Related to the TextInput component.Impact: RegressionDescribes a behavior that used to work on a prior release, but stopped working recently.Describes a behavior that used to work on a prior release, but stopped working recently.Platform: AndroidAndroid applications.Android applications.Ran CommandsOne of our bots successfully processed a command.One of our bots successfully processed a command.StaleThere has been a lack of activity on this issue and it may be closed soon.There has been a lack of activity on this issue and it may be closed soon.

Activity
react-native-bot commentedon Mar 16, 2018
Thanks for posting this! It looks like your issue may refer to an older version of React Native. Can you reproduce the issue on the latest release, v0.54.0?
Thank you for your contributions.
How to Contribute • What to Expect from Maintainers
akalin-keybase commentedon Mar 16, 2018
Yes, I can repro with 0.54.2.
akalin-keybase commentedon Mar 16, 2018
So the "Failed to create value from JSON: " exception is thrown from: https://github.com/facebook/react-native/blob/0ee502d1254b828efb119cc06bcd213c3d843269/ReactCommon/jschelpers/Value.cpp#L74 (i.e., it's trying to parse JSON from an empty string)
Debugging this code, this is called from:
https://github.com/facebook/react-native/blob/0ee502d1254b828efb119cc06bcd213c3d843269/ReactCommon/jschelpers/Value.cpp#L98
The conversion to JSON produces the string:
(I'm not 100% sure if the �, which is supposed to be the potato emoji, is messed up because of the JSON conversion messing up or my debugging output.)
It is the
String(ctx, json.c_str())conversion that is failing and returning an empty string. This leads to the linehttps://github.com/facebook/react-native/blob/0ee502d1254b828efb119cc06bcd213c3d843269/ReactCommon/jschelpers/Value.h#L32
so it looks like
JSC_JSStringCreateWithUTF8CStringis having problems with the emoji character.akalin-keybase commentedon Mar 16, 2018
Digging into the git history, this C++ code has been around forever. So why is it only showing up now? I'm almost certain it's because of this commit included in 0.53.0: c9ff0bc . It implements the onKeyPress events for Android, and this line c9ff0bc#diff-6bb282dadefaebe4c849ce7b47fa47a0R44 triggers the C++ code above.
Paging @joshyhargreaves who implemented the above commit. Do you know of any way to work around this bug, i.e. turn off the Android keypress events?
akalin-keybase commentedon Mar 16, 2018
Also, if I set
USE_FAST_FOLLY_DYNAMIC_CONVERSIONto make the C++ code go through this path: https://github.com/facebook/react-native/blob/0ee502d1254b828efb119cc06bcd213c3d843269/ReactCommon/jschelpers/Value.cpp#L84and comment out everything in that block but https://github.com/facebook/react-native/blob/0ee502d1254b828efb119cc06bcd213c3d843269/ReactCommon/jschelpers/Value.cpp#L92 , that fixes the problem. I don't know all the consequences of turning that on in general, though.
38 remaining items
Diego-Franco commentedon Oct 18, 2018
@danielreuterwall did you tried on a Pixel device? I'm still seeing this crash on a Pixel phone, I Tested on Motorola and is working
NicWickman commentedon Nov 2, 2018
Upgrading to 0.56 is not an option for me at the moment. Is there a fix I can do myself?
yogini-bende commentedon Jul 11, 2019
Any updates on this issue @joshjhargreaves @akalin-keybase ? I am still searching to find some workaround for this issue. I am using react-native 0.55.2.
"React Native sync for revisions b5c6dd2...a437f3f"
github-actions commentedon Mar 2, 2023
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.
github-actions commentedon Mar 9, 2023
This issue was closed because it has been stalled for 7 days with no activity.