File tree Expand file tree Collapse file tree 1 file changed +1
-43
lines changed
apps/common-app/src/apps/reanimated/examples Expand file tree Collapse file tree 1 file changed +1
-43
lines changed Original file line number Diff line number Diff line change 1- import React , { useEffect } from 'react' ;
1+ import React from 'react' ;
22import { StyleSheet , Text , View } from 'react-native' ;
3- import Animated , {
4- interpolateColor ,
5- useAnimatedStyle ,
6- useSharedValue ,
7- withRepeat ,
8- withTiming ,
9- } from 'react-native-reanimated' ;
103
114export default function EmptyExample ( ) {
12- const sv = useSharedValue ( 0 ) ;
13-
14- const eStyle = useAnimatedStyle ( ( ) => ( {
15- backgroundColor : interpolateColor (
16- sv . value ,
17- [ 0 , 1 ] ,
18- [ 'yellow' , 'transparent' ]
19- ) ,
20- } ) ) ;
21-
22- useEffect ( ( ) => {
23- sv . value = 0 ;
24- sv . value = withRepeat ( withTiming ( 1 , { duration : 3000 } ) , - 1 , true ) ;
25- } , [ sv ] ) ;
26-
275 return (
286 < View style = { styles . container } >
297 < Text > Hello world!</ Text >
30- < Animated . View
31- style = { [
32- styles . box ,
33- eStyle ,
34- // {
35- // animationName: {
36- // from: { backgroundColor: 'yellow' },
37- // to: { backgroundColor: 'transparent' },
38- // },
39- // animationDuration: '3000ms',
40- // animationIterationCount: 'infinite',
41- // animationDirection: 'alternate',
42- // },
43- ] }
44- />
458 </ View >
469 ) ;
4710}
4811
4912const styles = StyleSheet . create ( {
50- box : {
51- width : 100 ,
52- height : 100 ,
53- backgroundColor : 'red' ,
54- } ,
5513 container : {
5614 flex : 1 ,
5715 alignItems : 'center' ,
You can’t perform that action at this time.
0 commit comments