[Touchable* + Text] "Touchable cannot transition" error about 20% of the time
See original GitHub issueHi I am not really sure if this is an issue or not, but I thought i posted here so if anyone have the same problem, they know what was going on.
Apparently if you render some touchablebutton to be like this
render: function() {
return (
<View style={styles.contentContainer}>
<TouchableOpacity onPress={this._onPressQRCode}>
<Text style={styles.scanButtonText}>Click To Start Scanning</Text>
</TouchableOpacity>
</View>
);
},
you will run into this error very frequently
Error: Touchable cannot transition from `RESPONDER_INACTIVE_PRESS_IN` to `LONG_PRESS_DETECTED` for responder `.r[1]{TOP_LEVEL}[0].0.0.$nav2.0.1`
stack:
TouchableMixin._receiveSignal index.ios.bundle:33197
TouchableMixin._handleLongDelay index.ios.bundle:33176
JSTimers.setTimeout.JSTimersExecution.callbacks.(anonymous index.ios.bundle:8273
JSTimersExecution.callTimer index.ios.bundle:8062
Object.JSTimersExecution.callTimers index.ios.bundle:8085
jsCall index.ios.bundle:7511
MessageQueueMixin._callFunction index.ios.bundle:7774
<unknown> index.ios.bundle:7801
URL: undefined
line: undefined
message: Touchable cannot transition from `RESPONDER_INACTIVE_PRESS_IN` to `LONG_PRESS_DETECTED` for responder `.r[1]{TOP_LEVEL}[0].0.0.$nav2.0.1`
To solve the problem just wrap the text inside the touchableopacity/touchablehighlight with a child view like this
render: function() {
return (
<View style={styles.contentContainer}>
<TouchableOpacity onPress={this._onPressQRCode}>
<View>
<Text style={styles.scanButtonText}>Click To Start Scanning</Text>
</View>
</TouchableOpacity>
</View>
);
and seems to not run into that error anymore.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:73
- Comments:107 (23 by maintainers)
Top Results From Across the Web
React Native touchable vs. pressable components
Learn the difference between touchable and pressable components in React Native, and how to implement different effects with each kind.
Read more >TouchableOpacity not working inside an absolute positioned ...
Basically any TouchableOpacity component that ended up in the bottom 20% of the screen did not work because the parent had been moved...
Read more >TouchableHighlight - React Native
A wrapper for making views respond properly to touches. On press down, the opacity of the wrapped view is decreased, which allows the ......
Read more >justify-content - CSS: Cascading Style Sheets - MDN Web Docs
This only applies to flex layout items. For items that are not children of a flex container, this value is treated like start...
Read more >Edit layer masks in Photoshop - Adobe Support
In Adobe Photoshop, learn how to edit layer masks.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This happens for me with regularity but only when running on the device and debugging in Chrome. If I run on the device without debugging this error does not occur. Anyone seeing the same behavior?
Hey,
I’ve been doing some digging on this issue. Found out that it’s because of a bug with setTimeout. When using chrome debugging they can fire in the incorrect order. (See dedicated issue and example in #4470).
What happens with this one is in the function
touchableHandleResponderGrant
inComponents/Touchable/Touchable.js
you setup two setTimeouts and when they fire in the incorrect order the touch responder graph drops out to an error state which causes the red screen of death.I’ve got very much a ‘paint over the cracks’ fix, which most probably has unforeseen side-effects but will at least enable you to debug in chrome again. I definitely remove this before deploying to production In
Components/Touchable/Touchable.js
change…to be
Again I definitely remove this before deploying to production