@@ -5,6 +5,8 @@ import { Program } from './Program';
55import { forwardRef } from 'react' ;
66import { SpatialNavigationNodeRef } from '../../../../../lib/src/spatial-navigation/types/SpatialNavigationNodeRef' ;
77
8+ import Animated , { useAnimatedStyle , useSharedValue , withTiming } from 'react-native-reanimated' ;
9+
810type Props = {
911 programInfo : ProgramInfo ;
1012 onSelect ?: ( ) => void ;
@@ -15,20 +17,35 @@ type Props = {
1517
1618export const ProgramNode = forwardRef < SpatialNavigationNodeRef , Props > (
1719 ( { programInfo, onSelect, indexRange, label, variant } : Props , ref ) => {
20+ const rotationZ = useSharedValue ( 0 ) ;
21+
22+ const rotate360 = ( ) => {
23+ rotationZ . value = withTiming ( rotationZ . value + 360 ) ;
24+ } ;
25+
26+ const animatedStyle = useAnimatedStyle ( ( ) => {
27+ return {
28+ transform : [ { rotateZ : `${ rotationZ . value } deg` } ] ,
29+ } ;
30+ } ) ;
31+
1832 return (
1933 < SpatialNavigationFocusableView
2034 onSelect = { onSelect }
35+ onLongSelect = { rotate360 }
2136 indexRange = { indexRange }
2237 viewProps = { { accessibilityLabel : programInfo . title } }
2338 ref = { ref }
2439 >
2540 { ( { isFocused, isRootActive } ) => (
26- < Program
27- isFocused = { isFocused && isRootActive }
28- programInfo = { programInfo }
29- label = { label }
30- variant = { variant }
31- />
41+ < Animated . View style = { animatedStyle } >
42+ < Program
43+ isFocused = { isFocused && isRootActive }
44+ programInfo = { programInfo }
45+ label = { label }
46+ variant = { variant }
47+ />
48+ </ Animated . View >
3249 ) }
3350 </ SpatialNavigationFocusableView >
3451 ) ;
0 commit comments