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

App crashes when touching screen with 3 fingers on some OnePlus, Oppo, Xiaomi, Samsung devices #15059

Closed
brentvatne opened this issue Jul 17, 2017 · 75 comments
Labels
Bug Good first issue Interested in collaborating? Take a stab at fixing one of these issues. Help Wanted :octocat: Issues ideal for external contributors. 📮Known Issues This indicates an issue that refers to a bug or limitation of RN that is not currently being handled p: Expo Partner: Expo Partner Platform: Android Android applications. Ran Commands One of our bots successfully processed a command.

Comments

@brentvatne
Copy link
Collaborator

brentvatne commented Jul 17, 2017

Error: "Cannot record touch end without a touch start"

Environment

[skip envinfo]

Issue has been reproduced as far back as react-native@0.45.1, and up through react-native@0.57.1.

Steps to Reproduce

  1. Use "One Plus 2" phone
  2. Open React Native 0.45.1 app
  3. Use three-finger screenshot gesture

Expected Behavior

App does not crash

Actual Behavior

Red screen error

error screenshot

Reproducible Demo

Any project on this phone with this gesture

Known Affected Devices

OnePlus:

Oppo:

Samsung:

Wiko:

Xiaomi:

@csgsky

This comment has been minimized.

@alainib

This comment has been minimized.

@stale

This comment has been minimized.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Oct 29, 2017
@stale stale bot closed this as completed Nov 5, 2017
@brentvatne brentvatne reopened this Nov 15, 2017
@stale stale bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Nov 15, 2017
@ghidinelli

This comment has been minimized.

@imakshath

This comment has been minimized.

@illank86
Copy link

any solution for this problem??? i got the same problem with CRNA application, my application crash when try to take a screen shot wit 3 fingersgesture...

@femiveys

This comment has been minimized.

@ghidinelli
Copy link

This is happening more and more frequently. Here's a couple of stack traces:

https://sentry.io/share/issue/be6ff067877948cb9f68d1ef66c7082b/
https://sentry.io/share/issue/6ff3cd627faf4ccf80589c8cfed780b7/

The error appears to be happening in Libraries/Renderer/src/renderers/shared/shared/event/eventPlugins/ResponderTouchHistoryStore.js around line 203.

Here are devices we are seeing:

  • Samsung SM-G955U (NRD90M) on Android 7.0
  • OnePlus ONEPLUS A3000 (OPR6.170623.013) on Android 8.0.0
  • Samsung SM-G925I (NRD90M) on Android 7.0
  • Xiaomi Redmi 4X (N2G47H) on Android 7.1.2
  • Xiaomi Redmi Note 3 (MMB29M) on Android 6.0.1
  • OPPO F1f on Android 5.1.1
  • OPPO A1601 (LMY47I) on Android 5.1
  • OPPO A1603 (LMY47I) on Android 5.1
  • OPPO 1201 (LMY47I) on Android 5.1

@kaungmyatlwin
Copy link

The issue also persists on One Plus 5 phone (A5000, Android 7.1.1).

See issue -> expo/expo#1223

@zhangxiann

This comment has been minimized.

@ghidinelli
Copy link

ghidinelli commented Feb 4, 2018

This file is no longer (as of 3 days ago?) in React Native master. There seems to have been a major reorg due to React 0.16/Fiber(?) and the code for ResponderTouchHistoryStore is now in https://github.com/facebook/react-native/blob/13829751b11330f8e1400c5c70c59c49ac2f091f/Libraries/Renderer/ReactNativeRenderer-prod.js

We haven't tested yet to see if the behavior is different, but any patches would definitely have a new target.

@gregoriohc
Copy link

gregoriohc commented Feb 20, 2018

Ok, I have the same problem so I checked it out to try to find a solution. I figured out that:

What do you think? Can that changes be proposed as a solution?

@ghidinelli
Copy link

@gregoriohc in your testing, is this actually causing a crash or a failure in RN apps or is it simply that the logging is set to console.error? I was under the impression this was causing a crash in Android RN apps?

@gregoriohc
Copy link

@ghidinelli It's only that logging is set to console.error, that's the reason that I'm suggesting the change only in the dev file, because when you use Expo it shows console errors on that full red screen, so you can't capture an screenshot using the three fingers gesture.
But I realize that being such a specific error (OnePlus + Expo + Three fingers gesture), it is not worth changing anything in react-native or expo to solve it.
I guess that OnePlus' owners will have to disable the three fingers screenshot gesture, or wait for OnePlus to solve the problem in OxygenOS.

@ghidinelli
Copy link

@gregoriohc it isn't OnePlus only - see my list of devices we have seen this with at #15059 (comment). FWIW, we don't use Expo in our builds. I'm in favor of changing it from error to warn.

@brentvatne - if a PR changing the log from error to warn was submitted, would you accept?

@react-native-bot react-native-bot added Ran Commands One of our bots successfully processed a command. Stale There has been a lack of activity on this issue and it may be closed soon. and removed Android labels Feb 24, 2018
@stale stale bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Feb 24, 2018
@hramos hramos reopened this Feb 24, 2018
@gregoriohc
Copy link

@ghidinelli I agree with you. But changing from error to warn seems to be only a "temporary patch" because it doesn't solve the root of the problem.
Does anyone knows how Android native handles this? Does it ignores silently any touch event that doesn't follow the regular flow (start-move-end)?

@yodhadev01
Copy link

Put this in app.js or root file of your app.
console.reportErrorsAsExceptions = false;

working for oneplus 7 pro thanks mate

@ascorbic
Copy link

I've been looking at this on my Oneplus 6. If three finger screenshots are enabled, Android is firing two touchstart events, then a touchcancel with three touches. I can see in logcat that it gives the error D/ViewRootImpl: Gesture Screenshot triggered, ignore event. This is clearly a bug in the OS. It's worth noting that Flutter has run into the same bug: flutter/flutter#20517

I would suggest that the best approach here is to be more forgiving on these kind of touchcancel events. Is there a reason we have to throw an error? It isn't something that the developer can do anything with. I'd argue that particularly with touchcancel events, we should silently ignore if it tries to cancel an unknown touch. Even if we restrict it to cases where there are more than two touches it would solve this. If it's agreed that we should do this, I'm happy to do a PR to fix it.

@ascorbic
Copy link

I think the simplest solution here would be to change this to a console.warn, to match other similar touch event errors. The core problem is that the OS is only sending two touchStart events if TFS is enabled. We can't get around this.

I'm going to be bold and open a PR to do this. The main drawback here is that it's still going to give warnings for what is an OS bug, so we could consider ignoring it silently if it's a touchCancel event. I could add this if there's an agreement that this is the best approach. I don't think there's a problem using a "temporary fix" like this when the underlying problem is an OS bug that we can't fix.

@ThaJay
Copy link

ThaJay commented Aug 28, 2019

I completely agree with you but I'm afraid not everyone does so. I sincerely hope your pr makes it through!

perhaps some kind of state needs to be cleared when this happens to prevent further instability.

#15059 (comment)

At a glance, it seems like warning might be a good approach here, but as you said this seems to be a temporary patch that does not address the actual problem. You may also want to consider that warning instead of crashing might leave the response in an invalid state.

@ascorbic
Copy link

@ThaJay I hope so too. The problem here is that this is an OS bug. We can't do anything except work around it. Even if there were a fix available for the underlying bug, we'd still need to be able to handle cases where the fix wasn't applied. In any case, this is currently the only touch error that gets a console.error rather than a console.warn, and there doesn't seem to be any logic behind this.

I think we're ok without clearing state. By its nature, this error only happens when all of the touches have been ended. The whole problem is that we don't have any more touches to cancel.

@vikastechment
Copy link

this worked for me console.reportErrorsAsExceptions = false. I have written in root file that is in index.js file

@ThaJay
Copy link

ThaJay commented Aug 29, 2019

@vikassahutech
Obviously that works but it's not a fix. That setting will suppress all other exceptions as well. This is why I will not use this proposed solution and I hope others will not put it in production either.

@ghost
Copy link

ghost commented Aug 30, 2019

Put this in app.js or root file of your app.
console.reportErrorsAsExceptions = false;

Its work well

@Dylan0916
Copy link

Put this in app.js or root file of your app.
console.reportErrorsAsExceptions = false;

Would this result in some other exceptions not getting reported that should be?

@ascorbic
Copy link

The fix for this has now been merged into React, so hopefully we can close this soon.

@wenkangzhou
Copy link

hei,guys, you also can report errors to sentry

console.error = data => { Sentry.captureException(new Error(data), { logger: "console.error" }); };

@AleksandrZhukov
Copy link

@ascorbic can you add a link to PR with this fix?

@ascorbic
Copy link

@AleksandrZhukov It's the one referenced just above: facebook/react#16750

@HarshitMadhav
Copy link

This issue can be closed now. I am getting no crash when I am touching screen with 3 fingers in OnePlus device. I am using RN version 0.61.4

@isma4102
Copy link

The problem still persists for me in RN version 0.61.4.

@ankitgauravapporio
Copy link

hello everyone , can any have any update on this issues, i tried everything still getting crashed in released mode

@isma4102
Copy link

hello everyone , can any have any update on this issues, i tried everything still getting crashed in released mode

console.reportErrorsAsExceptions = false; is the only solution right now, but if exists another problem/error it's not show up.

@tabekg
Copy link

tabekg commented May 9, 2020

The same problem in MI 8 Lite, android 9 PKQ. Any solution?

@fantauz
Copy link

fantauz commented Aug 27, 2020

Happening in Redmi Note 8.

@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
@arjun1194
Copy link

is there any update on this issue ? Its marked as a good first issue , is it available to pick ?

@fabOnReact
Copy link
Contributor

fabOnReact commented Jan 31, 2024

@arjun1194 @cortinico This issue should be closed. It was fixed with facebook/react#16750 (see more info at #26170 (comment)). Thanks a lot.

Relevant flutter#20517 (comment)

@migueldaipre
Copy link
Collaborator

@arjun1194 @cortinico This issue should be closed. It was fixed with facebook/react#16750 (see more info at #26170 (comment)). Thanks a lot.

Relevant flutter#20517 (comment)

We're closing it because it's fixed, as we can see from this comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Good first issue Interested in collaborating? Take a stab at fixing one of these issues. Help Wanted :octocat: Issues ideal for external contributors. 📮Known Issues This indicates an issue that refers to a bug or limitation of RN that is not currently being handled p: Expo Partner: Expo Partner Platform: Android Android applications. Ran Commands One of our bots successfully processed a command.
Projects
None yet
Development

Successfully merging a pull request may close this issue.