@@ -21,11 +21,11 @@ For example, a container view that fades in when it is mounted may look like thi
2121<TabItem value =" javascript " >
2222
2323``` SnackPlayer ext=js&supportedPlatforms=ios,android
24- import React, {useRef, useEffect} from 'react';
25- import {Animated, Text, View} from 'react-native';
24+ import React, {useEffect} from 'react';
25+ import {Animated, Text, View, useAnimatedValue } from 'react-native';
2626
2727const FadeInView = props => {
28- const fadeAnim = useRef(new Animated.Value(0)).current // Initial value for opacity: 0
28+ const fadeAnim = useAnimatedValue(0); // Initial value for opacity: 0
2929
3030 useEffect(() => {
3131 Animated.timing(fadeAnim, {
@@ -74,15 +74,15 @@ export default () => {
7474<TabItem value =" typescript " >
7575
7676``` SnackPlayer ext=tsx
77- import React, {useEffect} from 'react';
78- import {Animated, Text, View, useAnimatedValue } from 'react-native';
77+ import React, {useRef, useEffect} from 'react';
78+ import {Animated, Text, View} from 'react-native';
7979import type {PropsWithChildren} from 'react';
8080import type {ViewStyle} from 'react-native';
8181
8282type FadeInViewProps = PropsWithChildren<{style: ViewStyle}>;
8383
8484const FadeInView: React.FC<FadeInViewProps> = props => {
85- const fadeAnim = useAnimatedValue(0); // Initial value for opacity: 0
85+ const fadeAnim = useRef(new Animated.Value(0)).current // Initial value for opacity: 0
8686
8787 useEffect(() => {
8888 Animated.timing(fadeAnim, {
0 commit comments