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

[Touchable* + Text] "Touchable cannot transition" error about 20% of the time #1693

Closed
uoroaix opened this issue Jun 20, 2015 · 111 comments
Closed
Labels
Bug DX Issues concerning how the developer experience can be improved. Help Wanted :octocat: Issues ideal for external contributors. Platform: iOS iOS applications. Priority: Low

Comments

@uoroaix
Copy link

uoroaix commented Jun 20, 2015

Hi 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.

@uoroaix uoroaix changed the title when clicked on a TouchableOpacity/Highlight it will frequently throw an touchable cannot transition error when clicked on a TouchableOpacity/Highlight it will frequently throw a touchable cannot transition error Jun 20, 2015
@brentvatne brentvatne changed the title when clicked on a TouchableOpacity/Highlight it will frequently throw a touchable cannot transition error [Touchable* + Text] "Touchable cannot transition" error about 10% of the time Jun 20, 2015
@arypurnomoz
Copy link

+1

@uoroaix uoroaix changed the title [Touchable* + Text] "Touchable cannot transition" error about 10% of the time [Touchable* + Text] "Touchable cannot transition" error about 20% of the time Jun 20, 2015
@gkrimer
Copy link

gkrimer commented Jun 23, 2015

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?

@brentvatne
Copy link
Collaborator

@spicyj - assigned you because it seems related to responders 😄

@sophiebits
Copy link
Contributor

I don't actually know anything about this stuff… maybe @vjeux does.

@sophiebits sophiebits assigned vjeux and unassigned sophiebits Jun 25, 2015
@philharton
Copy link

I've been getting the same error with a TouchableHighlight wrapping an Image, so it doesn't seem related to Text. I've only seen this while debugging in Chrome thus far but will update if that changes.

@piyushchauhan2011
Copy link

It is same when i'm wrapping the <Icon /> from react-native-icons. I'm really stressed out with the production app we are building and the error keeps coming up 😢

@piyushchauhan2011
Copy link

@brentvatne @vjeux @spicyj The same error comes up when we try to use inspect element mode. It seems the elements there are also TouchableHighlight and when we press on one of them in random order the same error comes up. So I think this is really an issue needs to be handled immediately.

@piyushchauhan2011
Copy link

??

@palmovitsch
Copy link

I had the same issue with Image surrounded by TouchableHighlight. Also just coming up on a real device while debugging in Chrome. Thanks uoroaix. Surrounding the Image with View solved the problem.

@ilansas
Copy link

ilansas commented Aug 4, 2015

Do we have an official fix or explanation ? This error is so annoying !

@aleclarson
Copy link
Contributor

Any update on this, @vjeux? The error message is cryptic and the stack trace is useless to us.

@piyushchauhan2011
Copy link

👍

@vjeux
Copy link
Contributor

vjeux commented Aug 27, 2015

No update sorry, if anyone of you can investigate what is happening and figure out if you can make a fix that would be awesome!

@deanmcpherson
Copy link
Contributor

For reference, I was seeing a heap of these warnings, and it turned out I had removed the LaunchScreen from the project (also fixed #2018 for me). No idea why the LaunchScreen would be so important, but it fixed if for me.

@satya164
Copy link
Contributor

satya164 commented Oct 1, 2015

Also happening on Android, real device.

@ghost
Copy link

ghost commented Oct 2, 2015

Seeing this too on Nexus 6 + Chromium debugging. App is just a very simple test of Navigator, and it works without debugging, though route transitions are sluggish. As soon as I debug it, I get a red screen of death with the above message.

@satya164
Copy link
Contributor

satya164 commented Oct 2, 2015

@RoryHunter Check https://facebook.github.io/react-native/docs/performance.html#slow-navigator-transitions for the transitions issue

@kanerogers
Copy link

Encountered this same issue:

  • On iOS
  • Real device (iPhone 6 Plus)
  • Debugging in Chrome.

Only started happening to me this morning, but went through the following steps to resolve it:

  1. Wrapping text in a view (as mentioned above) - no success.
  2. Checking out to an earlier revision - no success.
  3. Cleaning project, quitting XCode, Chrome, etc - no success.
  4. Restarted device, re-opened app with inspector enabled - no success.
  5. Disabled inspector after restart - issue resolved.

Given that the restart and some further fiddling resolved the issue, could this be memory related?

Here's further details:

Stack Trace

Error: Touchable cannot transition from `RESPONDER_INACTIVE_PRESS_IN` to `LONG_PRESS_DETECTED` for responder `.r[1]{TOP_LEVEL}[0].2.1.0.1.0`
 stack: 
  TouchableMixin._receiveSignal           index.ios.bundle?…:41098
  TouchableMixin._handleLongDelay         index.ios.bundle?…:41077
  JSTimersExecution.callbacks.(anonymous  index.ios.bundle?…:6158
  JSTimersExecution.callTimer             index.ios.bundle?…:5942
  Object.JSTimersExecution.callTimers     index.ios.bundle?…:5965
  MessageQueue.__callFunction             index.ios.bundle?…:5574
  <unknown>                               index.ios.bundle?…:5512
  guard                                   index.ios.bundle?…:5467
  <unknown>                               index.ios.bundle?…:5512
 URL: undefined
 line: undefined
 message: Touchable cannot transition from `RESPONDER_INACTIVE_PRESS_IN` to `LONG_PRESS_DETECTED` for responder `.r[1]{TOP_LEVEL}[0].2.1.0.1.0`

Component source:

      <TouchableHighlight
        style={styles.container}
        underlayColor='#eee'
        onPress={this.props.handler}>

        <View style={styles.container}>
          <View style={styles.label}>
            <Text style={styles.labelText}>{this.props.label}</Text>
          </View>
          <View style={styles.icon}>
            <Icon name={this.props.icon} size={60} color="green" />
          </View>
        </View>

      </TouchableHighlight>

Inspector screenshot:

img_7911

Hope any of this helps!

@JAStanton
Copy link
Contributor

+1 I have been getting this a lot lately.

@piyushchauhan2011
Copy link

👍 same here

@theopolisme
Copy link

👍 have been encountering repeatedly.

@hramos hramos added Help Wanted :octocat: Issues ideal for external contributors. and removed Help Wanted :octocat: Issues ideal for external contributors. Community Responsibility labels Mar 8, 2018
@pacozaa
Copy link

pacozaa commented Mar 10, 2018

+1

1 similar comment
@hongbhuang
Copy link

+1

@tmehta2442
Copy link

I'm not sure if this will help, but I had the same error message (red box of death) that would sometimes pop up on my emulator and always cause my physical device to show a blank page.

I wasn't getting the log information needed via my emulator, so I realized I could get more from plugging in my device and logging out everything that is going on via Android Studio's "Logcat". In there I found that there was an issue with the way I was using componentDidMount (specifically "E/ReactNativeJS: TypeError: undefined is not an object (evaluating 'a.componentDidMount.bind')" ).

While your error may be different, seeing a very verbose log from your device may prove to be beneficial in narrowing down the issue :)

@Salakar
Copy link
Contributor

Salakar commented Mar 19, 2019

Hey, everyone, this looks like this a developer experience issue and is a bit of a low priority for us.

We are probably not going to tackle this soon, but; the ideal solution most likely would be that this should be a warning here instead of a thrown exception. We'd encourage sending a pull request for this issue.

@kelset kelset added DX Issues concerning how the developer experience can be improved. Priority: Low labels Mar 19, 2019
@japser36
Copy link

japser36 commented Jan 30, 2020

I can confirm that this issue is still happening on RN 0.60.3 on Android, Samsung Galaxy S7

@anastely
Copy link

I can confirm that this issue is still happening on RN 0.60.3 on Android, Samsung Galaxy S7

+1, xiaomi redmi 5 plus 🤷‍♂️

@simonkincaidkintronix
Copy link

simonkincaidkintronix commented Aug 16, 2020

Hi All

I had the same annoying error during debugging on a v0.57 app but I managed to hack/fix it.

This error occurs in

node_modules/react-native/Libraries/Components/Touchable/touchable.js

For me, you get

console.error( 'Attempted to transition from state ' +
curState +
'to' +
States.RESPONDER_ACTIVE_LONG_PRESS_IN +
', which is not supported. This is ' + 'most likely due to Touchable.longPressDelayTimeout not being cancelled.', );

on line 666 of all places!

This only gets called by touchableHandleResponderGrant()

So I just decided to remove/comment out the lines that called it:

this.longPressDelayTimeout = setTimeout( this._handleLongDelay.bind(this, e), longDelayMS + delayMS, );

Yes, this is a hack but I wanted to debug properly so I needed that error to go away.

If your app requires long presses I assume something will break, but then I think the new pressables in RN will supercede this anyway.

Hope this helps some people! o/

facebook-github-bot pushed a commit that referenced this issue Mar 1, 2023
Summary:
We realized lately that the bot has "too much to eat" and because by default it starts from the most recent things ([see default here](https://github.com/actions/stale#ascending)), I'm fixing the settings so that it would start from oldest.

This should make it start from [very old and inactive issues](https://github.com/facebook/react-native/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-asc+) such as such as #1693 (last comment from Aug 2020) or #10027 (last activity in May 2019) and make it do significant progress on the repo clean up :)

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[INTERNAL] [CHANGED] - set the stale bot to start from oldest

Pull Request resolved: #36337

Test Plan: N/A

Reviewed By: cortinico

Differential Revision: D43694724

Pulled By: cipolleschi

fbshipit-source-id: a7cc07e4669b1d7f5e0bfc31ff313767790e1f0f
@github-actions
Copy link

github-actions bot commented Mar 1, 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 github-actions bot added Stale There has been a lack of activity on this issue and it may be closed soon. and removed Stale There has been a lack of activity on this issue and it may be closed soon. labels Mar 1, 2023
OlimpiaZurek pushed a commit to OlimpiaZurek/react-native that referenced this issue May 22, 2023
Summary:
We realized lately that the bot has "too much to eat" and because by default it starts from the most recent things ([see default here](https://github.com/actions/stale#ascending)), I'm fixing the settings so that it would start from oldest.

This should make it start from [very old and inactive issues](https://github.com/facebook/react-native/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-asc+) such as such as facebook#1693 (last comment from Aug 2020) or facebook#10027 (last activity in May 2019) and make it do significant progress on the repo clean up :)

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[INTERNAL] [CHANGED] - set the stale bot to start from oldest

Pull Request resolved: facebook#36337

Test Plan: N/A

Reviewed By: cortinico

Differential Revision: D43694724

Pulled By: cipolleschi

fbshipit-source-id: a7cc07e4669b1d7f5e0bfc31ff313767790e1f0f
@fabOnReact
Copy link
Contributor

fabOnReact commented Jan 31, 2024

Anybody reproduces this issue on 0.73? I will implement the solution discussed #1693 (comment) Thanks

@teivienn
Copy link

Anybody reproduces this issue on 0.73? I will implement the solution discussed #1693 (comment) Thanks

I think this problem is obsolete and can be closed. I can confirm with 100% certainty that this problem does not occur, and I have not encountered anything like this since version 60

@shubhamguptadream11
Copy link
Collaborator

There hasn't been any recent activity on this issue for a while. Additionally, recent conversations suggest that it is no longer reproducible. Based on the findings shared above, it seems to occur mostly while debugging on Chrome.

I am closing this issue for now.

If anyone experiences this issue again, please feel free to reopen it or create a new issue with a valid reproducer using this template and steps to reproduce the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug DX Issues concerning how the developer experience can be improved. Help Wanted :octocat: Issues ideal for external contributors. Platform: iOS iOS applications. Priority: Low
Projects
None yet
Development

No branches or pull requests