-
-
Notifications
You must be signed in to change notification settings - Fork 982
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
Android Crash: Fatal Exception: java.lang.IllegalArgumentException: pointerIndex out of range #1679
Android Crash: Fatal Exception: java.lang.IllegalArgumentException: pointerIndex out of range #1679
Comments
React Native Issue: facebook/react-native#30320 |
try-catch block around call which intermittently throws an IllegalArgumentException Resolves Issues: - software-mansion#1679 - facebook/react-native#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 Here are a patch but I don't know if this could generate another issue. |
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 facebook/react-native#30320 (comment) did prevent the crash for me :)
|
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? |
@urbanclap-admin I'm using this patch and it works good. |
started getting this crash -> #1188 after using the above patch you mentioned |
Use the above code example to repro the issue. Steps to repro: repro.mp4 |
@shivamp2404 Thanks for the repro ❤️! Could you check if this PR: #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 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? (#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! |
## Description This PR solves two problems: - `ScrollView` wrapped with `NativeViewGestureHandler` wasn't canceling the root view handler, which in turn meant that [`shouldIntercept` flag was never set](https://github.com/software-mansion/react-native-gesture-handler/blob/355a82fd3cf39b1bd4a57af958f040b563a1823e/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootHelper.kt#L71) and event was [dispatched to both, the handler and the view](https://github.com/software-mansion/react-native-gesture-handler/blob/355a82fd3cf39b1bd4a57af958f040b563a1823e/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootView.kt#L35-L37). - After a handler was activated and the root handler was canceled (setting `shouldIntercept` to true), and a new pointer was added to the screen, the root handler would begin and set `shouldIntercept` back to false. Again, this meant dispatching events both to the handler and the view. Fixes #1679 ## Test plan Tested on the Example app and [reproduction from the issue](#1679 (comment))
…-mansion#2551) ## Description This PR solves two problems: - `ScrollView` wrapped with `NativeViewGestureHandler` wasn't canceling the root view handler, which in turn meant that [`shouldIntercept` flag was never set](https://github.com/software-mansion/react-native-gesture-handler/blob/355a82fd3cf39b1bd4a57af958f040b563a1823e/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootHelper.kt#L71) and event was [dispatched to both, the handler and the view](https://github.com/software-mansion/react-native-gesture-handler/blob/355a82fd3cf39b1bd4a57af958f040b563a1823e/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootView.kt#L35-L37). - After a handler was activated and the root handler was canceled (setting `shouldIntercept` to true), and a new pointer was added to the screen, the root handler would begin and set `shouldIntercept` back to false. Again, this meant dispatching events both to the handler and the view. Fixes software-mansion#1679 ## Test plan Tested on the Example app and [reproduction from the issue](software-mansion#1679 (comment)) (cherry picked from commit 8c41b09)
Issue still reproducible. This patch already merged as a changes to new version. Version react-native-gesture-handler2.13.4 Stacktrace:java.lang.IllegalArgumentException: pointerIndex out of range |
Description
Steps To Reproduce
Unknown
Expected behavior
Graceful error handling
Actual behavior
Crash
Package versions
The text was updated successfully, but these errors were encountered: