facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
118.97k stars 24.31k forks source link

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

Open brentvatne opened 7 years ago

brentvatne commented 7 years ago

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 commented 7 years ago

how can we fix this problem, i meet this problem too

alainib commented 7 years ago

i got the same problem on android with a wiko pure. any solution ?

stale[bot] commented 7 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions.

ghidinelli commented 6 years ago

Happening to me too, captured by Sentry's RN logging

imakshath commented 6 years ago

I got the same problem.

illank86 commented 6 years ago

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 commented 6 years ago

I have this issue on a OnePlus 3

ghidinelli commented 6 years ago

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:

kaungmyatlwin commented 6 years ago

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

See issue -> https://github.com/expo/expo/issues/1223

zhangxiann commented 6 years ago

The issue also persists on One Plus 3T phone

ghidinelli commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

@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 commented 6 years ago

@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 commented 6 years ago

@gregoriohc it isn't OnePlus only - see my list of devices we have seen this with at https://github.com/facebook/react-native/issues/15059#issuecomment-354553812. 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?

gregoriohc commented 6 years ago

@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)?

hramos commented 6 years ago

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.

ThaJay commented 6 years ago

This should not crash the app, it also happens when the app lags and the user touches in the meantime. Surely there is a way to clear the state and continue working with a warning @hramos ?

lmaddio commented 6 years ago

Same with OnePlus 3t oxygenOS 5.0.1, Android 8.0.0 Happens when touching a View with flexDirection: 'column' "react-native": "~0.54.1"

import React, {Component} from 'react';
import { StyleSheet, Text, View, Image } from 'react-native';

export default class App extends React.Component {
  render() {
    return (
      <View style={styles.container}>
        <Image source={{uri: 'https://upload.wikimedia.org/wikipedia/commons/d/de/Bananavarieties.jpg'}} style={{width: 193, height: 110}}/>
        <View style={{flex: 1, backgroundColor: 'red'}} >
          <Text>Another text1</Text>
        </View>
        <View style={{flex: 3, backgroundColor: 'powderblue'}} >
          <Text>Another text3</Text>
        </View>
        <View style={{flex: 2, backgroundColor: 'blue'}} >
          <Text>Another text2</Text>
        </View>
        <Text>This is text</Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
    flexDirection: 'column'
  }
});
sanren1024 commented 6 years ago

The same problem on Mi.Any Solutions???!!

iliaoni commented 6 years ago

Happens on Oneplus 6 also.

sadhu05 commented 6 years ago

Did anyone solved this problem

trungtran92 commented 6 years ago

The same problem on version 0.55.2

alexwaeseperlman commented 6 years ago

Same issue on Oneplus 5. I think its a problem on all one plus phones.

duynguyenhoang commented 6 years ago

Same issue on Xiaomi Redmi Note 5 (Global Version) MIUI 9.6.4.0

I suppose it happens to all Xiaomi's devices

FYI: I enabled screen capture which is supported by MIUI by touching screen with 3 fingers

hramos commented 6 years ago

Thanks for letting us know which devices are affected by this. At this point, we should start talking about potential solutions. Please link back to this issue on any PR that attempts to fix this.

If you run into this issue on a device that is already covered by the comments above, don't feel pressured into commenting here.

vinaysikarwar commented 6 years ago

so are we getting any solution in this issue. I am also facing same issue when developing app and testing in oneplus 5t

iamAliRaza commented 6 years ago

The same problem on version 0.57.1

0yewk

blaues0cke commented 6 years ago

Can confirm that this also happens on a OnePlus6 running Android 9

oniseun commented 6 years ago

Happens on xiaomi redmi not 5 plus Android 8 Also

Velua commented 6 years ago

Also on Oppo A73

iamAliRaza commented 6 years ago

There is no issue on simple/plain static screen. I am facing this error only on those screens where we are using thread. ` Like do something continuously or change UI with setinterval () Use of setTimeout()

on these screens where i start or use thread when i take screenshot my application giving me this error.

Ended a touch event which was not which was not counted in 'trackedTouchcount'

reyanshmishra commented 6 years ago

Even I am facing the same issue while taking screenshots. Mi note 4 Samsung note 5

akashnigam08 commented 5 years ago

This is issue is happening on the newly released OnePlus 6T as well.

rasmuswoelk commented 5 years ago

Did anyone find a fix for this? I tried the above suggestions but no dice.

Ares513 commented 5 years ago

Samsung SM-G950U same problem, android 8.0.0.

mohsinnaqvi110 commented 5 years ago

This issue has been under discussion for more than a year... Did anyone find a fix? please share thanks.

rasmuswoelk commented 5 years ago

I found on another thread that this only happens in development mode 🤔Can anyone confirm? I will test it out myself when I have time.

sebastiangrebe commented 5 years ago

@rasmuswoelk Yes for me the error does not occur when using a production build

mirse commented 5 years ago

Can someone summarize the solution about this?

guillobits commented 5 years ago

Some on one plus 5

hramos commented 5 years ago

Hey folks, thanks for chiming in with information about the devices you are seeing this on. I've edited the original post with a list of known affected devices. I think it's safe to say this affects several devices from manufacturers such as OnePlus, Xiaomi, Oppo, and Samsung. At this point, adding a comment mentioning this can be reproduced on a device covered above is of diminishing returns.

Following up on my earlier comment, please limit comments to any efforts to fix the underlying issue. Otherwise, we may find the need to limit comments to collaborators. Thanks for your understanding.

wbrickner commented 5 years ago

I can verify that the production build of my Expo app (which of course relies on React Native) does not encounter this sort of issue On my OnePlus 5, or if it does it's silent and the screenshot is captured successfully.

In development mode however, I get an error identical to the issue reported in this thread.

My device is running Android v8.1 (Oxygen OS v5.1.7)

zerbinidamata commented 5 years ago

Hey guys, having same problem on One Plus 6, any fix ?

Vikas2408 commented 5 years ago

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

shuiRong commented 5 years ago

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

It does works. Thank you.

AleksandrZhukov commented 5 years ago

Maybe will be useful for someone - this issue can be fixed/hidden for release builds by adding transform-remove-console babel plugin https://facebook.github.io/react-native/docs/performance#using-consolelog-statements

ghost commented 5 years ago

@brentvatne console.reportErrorsAsExceptions = false; this worked for me!

arabbott commented 5 years ago

Seeing this as well on Samsung SM-G950U Android 9.0 using pinch to zoom. I've turned off the console logs as mentioned in earlier posts.

I get this in an image gallery component I've made using react-native-image-view. It doesn't appear to crash the app now that I've turned the console logs off but pinch to zoom stops working until I open a new image.

benjiekibblewhite commented 5 years ago

Are there any implications to adding console.reportErrorsAsExceptions = false;? Would this result in some other exceptions not getting reported that should be?