[Reanimated] Reading from
value
during component render. Please ensure that you do not access the value
property or use get
method of a shared value while React is rendering a component.
This is happening over and over. Is it a problem with the library itself? I don’t think I’m doing anything weird in my code:
import Carousel, { ICarouselInstance } from ‘react-native-reanimated-carousel’;
<Carousel
ref={ref as MutableRefObject<ICarouselInstance | null>}
data={data || []}
renderItem={({ item }) => (
<View style={styles.featuredSlide}>
<Image
style={[styles.featuredImage, { width: imageWidth, height: imageHeight }]}
source={{ uri: item.photos?.[0] || 'https://via.placeholder.com/350x480' }}
/>
{
showOverlaidText && (
<>
<Text style={styles.a}>{item.a}</Text>
<Text style={styles.b}>{item.b}</Text>
</>
)
}
</View>
)}
width={width}
height={height}
scrollAnimationDuration={scrollAnimationDuration}
autoPlay={autoPlay}
loop={loop}
panGestureHandlerProps={{
activeOffsetX: [-10, 10],
}}
/>
I tried the code above. It renders fine. But Im getting thousands of these errors : [Reanimated] Reading from value
during component render. Please ensure that you do not access the value
property or use get
method of a shared value while React is rendering a component.
2
Answers
Make sure you are using the latest version of react-native-reanimated and react-native-reanimated-carousel. Sometimes, bugs in earlier versions may cause issues that have been resolved in updates.
also this part of your code can be causing the problem :
panGestureHandlerProps
is used only when thre is a flatlist or scrollview inside your CarouselI resolved this issue by updating the version of the react-native-reanimated-carousel library to the following:
"react-native-reanimated-carousel": "4.0.0-canary.20"