Skip to content

Instantly share code, notes, and snippets.

@spencerfeng
Last active August 8, 2020 05:32
Show Gist options
  • Save spencerfeng/b5f142a5c1f407ce28984a884bf159c8 to your computer and use it in GitHub Desktop.
Save spencerfeng/b5f142a5c1f407ce28984a884bf159c8 to your computer and use it in GitHub Desktop.
This gist is used in this medium article: When React Native Reanimated nodes get evaluated
const MyOpacityComponent = () => {
const [toggled, setToggled] = useState(false)
const opacity = useRef<Value<number>>(new Value(0))
useCode(() => [set(opacity.current, runOpacityTimer())], [])
return (
<Animated.View style={{ opacity: opacity.current }}>
<Text>Hello World</Text>
</Animated.View>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment