Closed escowart closed 7 months ago
React Native Issue: https://github.com/facebook/react-native/issues/30320
I have the same crash, any update?
Having the same issue in production
Sorry for the delay, but we still want to fix it.
I still having this issue in react-native-gesture-handler: 2.4.2
, any update?
Here are a patch but I don't know if this could generate another issue.
https://github.com/facebook/react-native/issues/30320#issuecomment-875476422
I could replicate this crash on the following component by starting a pull-to-refresh with one finger, then adding a second finger during the pull -
The patch at https://github.com/facebook/react-native/issues/30320#issuecomment-875476422 did prevent the crash for me :)
import {
RefreshControl as RNRefreshControl,
RefreshControlProps,
} from 'react-native';
import { FlatList as GestureHandlerFlatList } from 'react-native-gesture-handler';
const ReanimatedFlatList = Animated.createAnimatedComponent(
GestureHandlerFlatList,
);
const RefreshControl = createNativeWrapper(RNRefreshControl);
const CustomRefreshControl = (props: RefreshControlProps) => (
<RefreshControl {...props} />
);
...
<ReanimatedFlatList
ref={flatListRef}
onScroll={scrollHandler}
onLayout={(evt: LayoutChangeEvent) => {
listShellHeight.value = evt.nativeEvent.layout.height;
if (typeof props.onLayout === 'function') {
props.onLayout?.(evt);
}
}}
refreshControl={
<CustomRefreshControl
refreshing={Boolean(props?.refreshing)}
progressViewOffset={Number(props?.progressViewOffset ?? 0)}
onRefresh={() => {
setRefreshCount(val => val + 1);
if (typeof onRefresh === 'function') {
onRefresh();
}
}}
/>
}
{...props}
/>
Hi @robwalkerco 👋 I tried to reproduce the issue by completing the code you've provided. Unfortunately I was unable to do that. Could you please provide repro so that we can look further into this problem? Code below is the code I used, since some of the methods in yours are missing.
import React, { useState } from 'react';
import {
RefreshControl as RNRefreshControl,
RefreshControlProps,
} from 'react-native';
import {
createNativeWrapper,
FlatList as GestureHandlerFlatList,
} from 'react-native-gesture-handler';
import Animated from 'react-native-reanimated';
export default function App() {
const ReanimatedFlatList = Animated.createAnimatedComponent(
GestureHandlerFlatList
);
const RefreshControl = createNativeWrapper(RNRefreshControl);
const CustomRefreshControl = (props: RefreshControlProps) => (
<RefreshControl {...props} />
);
const [refreshCount, setRefreshCount] = useState(0);
const onScroll = () => {
console.log(refreshCount);
};
const onRefresh = () => {
console.log(refreshCount);
};
const onLayout = (e) => {
console.log(e);
};
return (
<ReanimatedFlatList
onScroll={onScroll}
onLayout={onLayout}
refreshControl={
<CustomRefreshControl
refreshing={false}
progressViewOffset={0}
onRefresh={() => {
setRefreshCount((val) => val + 1);
onRefresh();
}}
/>
}
data={undefined}
renderItem={undefined}
/>
);
}
any update on this? This issue still exists
@urbanclap-admin I'm using this patch and it works good. https://github.com/facebook/react-native/issues/30320#issuecomment-1170113452
@urbanclap-admin I'm using this patch and it works good. facebook/react-native#30320 (comment)
started getting this crash -> https://github.com/software-mansion/react-native-gesture-handler/issues/1188 after using the above patch you mentioned
@j-piasecki @piaskowyk
import {Modal, StyleSheet, Text, Pressable, View, FlatList, Dimensions} from 'react-native';
import Animated from 'react-native-reanimated';
import { GestureHandlerRootView, NativeViewGestureHandler } from "react-native-gesture-handler";
const DATA = []
for (let i=0;i<100;i++){
DATA.push({id:i, title:`hello - ${i}`})
}
const windowHeight = Dimensions.get('window').height;
const App = () => {
const [modalVisible, setModalVisible] = useState(false);
const Item = ({title}) => (
<View style={styles.item}>
<Text style={styles.title}>{title}</Text>
</View>
);
return (
<View style={styles.centeredView}>
<Modal
animationType="slide"
transparent={true}
visible={modalVisible}
>
<GestureHandlerRootView
style={{
width: '100%',
height: '100%'
}}
>
<Animated.View
style={
{
backgroundColor: 'white',
overflow: 'hidden',
flexShrink: 1,
width: '100%',
opacity: 1,
height: windowHeight/2
}}
>
<NativeViewGestureHandler>
<FlatList
data={DATA}
renderItem={({item}) => <Item title={item.title} />}
keyExtractor={item => item.id}
/>
</NativeViewGestureHandler>
</Animated.View>
</GestureHandlerRootView>
</Modal>
<Pressable
style={[styles.button, styles.buttonOpen]}
onPress={() => setModalVisible(true)}>
<Text style={styles.textStyle}>Show Modal</Text>
</Pressable>
</View>
);
};
const styles = StyleSheet.create({
centeredView: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
marginTop: 22,
},
button: {
borderRadius: 20,
padding: 10,
elevation: 2,
},
buttonOpen: {
backgroundColor: '#F194FF',
},
textStyle: {
color: 'white',
fontWeight: 'bold',
textAlign: 'center',
},
title:{
backgroundColor:'black'
}
});
export default App
Use the above code example to repro the issue.
Steps to repro: scroll the list and when the finger is on the list, try to scroll below the Modal when both the fingers are on screen, lift the first finger that was on the list, and the app will crash
@shivamp2404 Thanks for the repro ❤️! Could you check if this PR: https://github.com/software-mansion/react-native-gesture-handler/pull/2551 solves the problem for you (and doesn't break anything else)?
cc. @RodolfoGS
@j-piasecki we also see quite a bit of these errors in our app. Short of use patching the package with your changes, is there a pre-release version we could use? What are the chances these changes are published as a version in the near future?
Thanks again for helping out here
@dmregister There's no pre-release version with it 😞. The two options for using it right now are using patch-package
or installing Gesture Handler directly from the branch this PR is based on.
I would like to get confirmation that this PR actually fixes the underlying issues before merging & releasing. While the repro above no longer crashes, the full use case may be more complicated. Would it be possible for you to check it in your application?
Can anyone post the patch file?
Thanks @j-piasecki
@j-piasecki we deployed a patch into production and it seems like this has addressed the issue. The version deployed with the fix is only experiencing a few errors compared to over a thousand from previous versions.
Thanks again for all the hard work and support!
@dmregister how is it going with that patch? Are the crashes gone? You applied the last patch of @ j-piasecki, right? (https://github.com/software-mansion/react-native-gesture-handler/pull/2551)
@RodolfoGS yes the crashes are gone and we have not see any other side effects from this patch.
We upgraded to the latest version and applied the patch from that PR.
@dmregister awesome, thank you so much for your feedback! @j-piasecki looks like your PR is working! Thank you for fixing it
Issue still reproducible. This patch already merged as a changes to new version.
2.13.4
java.lang.IllegalArgumentException: pointerIndex out of range at android.view.MotionEvent.nativeGetAxisValue(MotionEvent.java) at android.view.MotionEvent.getY(MotionEvent.java:2445) at android.widget.ScrollView.onTouchEvent(ScrollView.java:895) at com.facebook.react.views.scroll.ReactScrollView.onTouchEvent(ReactScrollView.java:460) at com.swmansion.gesturehandler.core.NativeViewGestureHandler.onHandle(NativeViewGestureHandler.java:113) at com.swmansion.gesturehandler.core.GestureHandler.handle(GestureHandler.java:374) at com.swmansion.gesturehandler.core.GestureHandlerOrchestrator.deliverEventToGestureHandler(GestureHandlerOrchestrator.java:276) at com.swmansion.gesturehandler.core.GestureHandlerOrchestrator.deliverEventToGestureHandlers(GestureHandlerOrchestrator.java:231) at com.swmansion.gesturehandler.core.GestureHandlerOrchestrator.onTouchEvent(GestureHandlerOrchestrator.java:45) at com.swmansion.gesturehandler.react.RNGestureHandlerRootHelper.dispatchTouchEvent(RNGestureHandlerRootHelper.java:97) at com.swmansion.gesturehandler.react.RNGestureHandlerRootView.dispatchTouchEvent(RNGestureHandlerRootView.java:35) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3173) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2823) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3173) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2823) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3173) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2823) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3173) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2823) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3173) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2823) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3173) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2823) at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:502) at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1890) at android.app.Activity.dispatchTouchEvent(Activity.java:4195) at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:70) at com.dynatrace.android.window.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:79) at com.contentsquare.android.sdk.cf.dispatchTouchEvent(cf.java:4) at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:460) at android.view.View.dispatchPointerEvent(View.java:14837) at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:6617) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:6392) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5866) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5923) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5889) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:6054) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5897) at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:6111) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5870) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5923) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5889) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5897) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5870) at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:8931) at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:8871) at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:8828) at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:9063) at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:259) at android.os.MessageQueue.nativePollOnce(MessageQueue.java) at android.os.MessageQueue.next(MessageQueue.java:335) at android.os.Looper.loopOnce(Looper.java:161) at android.os.Looper.loop(Looper.java:288) at android.app.ActivityThread.main(ActivityThread.java:7888) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:568) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1045)
Description
Steps To Reproduce
Unknown
Expected behavior
Graceful error handling
Actual behavior
Crash
Package versions