Using useAnimatedStyle with contentContainerStyle inside Animated.ScrollView
See original GitHub issueDescription
I want to update the height of my ScrollView when adding an item but I keep getting Property is not configurable
.
What is the correct way to pass this value ?
Code
const height = useDerivedValue(() => {
return items.length * 200
}, [items])
const style = useAnimatedStyle(() => ({
height: height.value
}))
return <Animated.ScrollView contentContainerStyle={[style]}> ... </Animated.ScrollView>
Package versions
- React: 16.13.1
- React Native: 0.63.2
- React Native Reanimated: 2.0.0-alpha.7
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (7 by maintainers)
Top Results From Across the Web
scrollHandler and scrollTo in animated scrollview
Try this one: link. You can simply add another animated variable and set it to true before scrolling and set it to false...
Read more >useAnimatedKeyboard | React Native Reanimated
With the useAnimatedKeyboard hook, you can create animations based on current keyboard position. On Android, make sure to set android:windowSoftInputMode in ...
Read more >ScrollView
Component that wraps platform ScrollView while providing integration with touch locking "responder" system. Keep in mind that ScrollViews must have a ...
Read more >Chanel Scroll Animation - “Can it be done in React Native?”
Learn React Native Gestures and Animations at https://start-react-native.dev/Source code: ...
Read more >How to smoothly animate your react native app
React native comes with a built-in library called animated. ... To do so, we'll use the scroll event from our ScrollView to make...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Oh, I guess this won’t work, I didn’t read carefully your description, sorry.
The contentContainerStyle is a prop that is passing to the underlying view that wraps the content of Scroll view. That view is not animated - that’s why you can’t pass animated styles to it. But you can create your own container - just wrap the children of the ScrollView with your own animated view.
seems like it’s related to the limitations of capturing object to be used on UI Thread. It doesn’t capture prototype property which causes iterations on these objects to not work.