-
-
Notifications
You must be signed in to change notification settings - Fork 338
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
Expo crashing when running the code in the usage section #769
Comments
Hey @qwertynik! I'm here to help you with any bugs, questions, or contributions you have. Let's squash those bugs together! 🤖 The issue you're experiencing with the Expo app crashing on an iOS simulator and showing an error related to the Reanimated library on an Android emulator might be due to a precision error in the React Native Reanimated Carousel. This is a known issue that occurs when starting to drag the carousel, especially when using the 'mode' property. To resolve this, you can modify the zIndex calculation in the const zIndex = Math.round(interpolate(value, [-1, 0, 1], [0, size, 0])); This fix addresses the precision error and prevents the crash on both iOS and Android platforms. Additionally, ensure that your environment is up to date with versions like To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other |
This line was present |
If adding Additionally, ensure that all dependencies are correctly installed and configured, especially To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other |
I can confirm that using the 4.0.0.canary release fixed the issue as suggested in #715 |
Describe the bug
Expo app crashes within a few seconds when started inside an iOS simulator
To Reproduce
Steps to reproduce the behavior:
Run this below piece of code:
`
import * as React from "react";
import { Dimensions, Text, View } from "react-native";
import { useSharedValue } from "react-native-reanimated";
import Carousel, {
ICarouselInstance,
Pagination,
} from "react-native-reanimated-carousel";
const data = [...new Array(6).keys()];
const width = Dimensions.get("window").width;
function App() {
const ref = React.useRef(null);
const progress = useSharedValue(0);
const onPressPagination = (index: number) => {
ref.current?.scrollTo({
/**
* Calculate the difference between the current index and the target index
* to ensure that the carousel scrolls to the nearest index
*/
count: index - progress.value,
animated: true,
});
};
return (
<View style={{ flex: 1 }}>
<Carousel
ref={ref}
width={width}
height={width / 2}
data={data}
onProgressChange={progress}
renderItem={({ index }) => (
<View
style={{
flex: 1,
borderWidth: 1,
justifyContent: "center",
}}
>
<Text style={{ textAlign: "center", fontSize: 30 }}>{index}
)}
/>
);
}
export default App;
`
It is available at this link
Expected behavior
A carousel as shown in the documentation site should come.
Versions (please complete the following information):
Smartphone (please complete the following information):
Additional context
When the same code is run on android, the following error is shown:
Warning from logs:
(NOBRIDGE) WARN [Reanimated] Reading from
value
during component render. Please ensure that you do not access thevalue
property or useget
method of a shared value while React is rendering a component.The text was updated successfully, but these errors were encountered: