@@ -7,52 +7,12 @@ import {
77} from 'react-native' ;
88import { NavigationContainer } from '@react-navigation/native' ;
99import { createStackNavigator } from '@react-navigation/stack' ;
10- import RiveFileLoadingExample from './pages/RiveFileLoadingExample' ;
11- import DataBindingExample from './pages/RiveDataBindingExample' ;
12- import TemplatePage from './pages/TemplatePage' ;
13- import EventsExample from './pages/RiveEventsExample' ;
14- import StateMachineInputsExample from './pages/RiveStateMachineInputsExample' ;
15- import TextRunExample from './pages/RiveTextRunExample' ;
16- import OutOfBandAssets from './pages/OutOfBandAssets' ;
17-
18- const Examples = [
19- {
20- title : 'Rive File Loading Examples' ,
21- screenId : 'RiveFileLoading' ,
22- component : RiveFileLoadingExample ,
23- } ,
24- {
25- title : 'Rive Data Binding Example' ,
26- screenId : 'RiveDataBinding' ,
27- component : DataBindingExample ,
28- } ,
29- {
30- title : 'Rive Events Example' ,
31- screenId : 'RiveEvents' ,
32- component : EventsExample ,
33- } ,
34- {
35- title : 'Rive State Machine Inputs Example' ,
36- screenId : 'RiveStateMachineInputs' ,
37- component : StateMachineInputsExample ,
38- } ,
39- {
40- title : 'Rive Text Run Example' ,
41- screenId : 'RiveTextRun' ,
42- component : TextRunExample ,
43- } ,
44- {
45- title : 'Out of band assets' ,
46- screenId : 'OutOfBandAssets' ,
47- component : OutOfBandAssets ,
48- } ,
49- { title : 'Template Page' , screenId : 'Template' , component : TemplatePage } ,
50- ] as const ;
10+ import { PagesList } from './PagesList' ;
5111
5212type RootStackParamList = {
5313 Home : undefined ;
5414} & {
55- [ K in ( typeof Examples ) [ number ] [ 'screenId ' ] ] : undefined ;
15+ [ K in ( typeof PagesList ) [ number ] [ 'id ' ] ] : undefined ;
5616} ;
5717
5818const Stack = createStackNavigator < RootStackParamList > ( ) ;
@@ -62,13 +22,13 @@ function HomeScreen({ navigation }: { navigation: any }) {
6222 < ScrollView style = { styles . container } >
6323 < Text style = { styles . header } > Rive React Native Examples</ Text >
6424 < View style = { styles . buttonContainer } >
65- { Examples . map ( ( { title , screenId } ) => (
25+ { PagesList . map ( ( { id , name } ) => (
6626 < TouchableOpacity
67- key = { screenId }
27+ key = { id }
6828 style = { styles . button }
69- onPress = { ( ) => navigation . navigate ( screenId ) }
29+ onPress = { ( ) => navigation . navigate ( id ) }
7030 >
71- < Text style = { styles . buttonText } > { title } </ Text >
31+ < Text style = { styles . buttonText } > { name } </ Text >
7232 </ TouchableOpacity >
7333 ) ) }
7434 </ View >
@@ -95,12 +55,12 @@ export default function App() {
9555 component = { HomeScreen }
9656 options = { { title : 'Rive Examples' } }
9757 />
98- { Examples . map ( ( { screenId , component, title } ) => (
58+ { PagesList . map ( ( { id , component, name } ) => (
9959 < Stack . Screen
100- key = { screenId }
101- name = { screenId }
60+ key = { id }
61+ name = { id }
10262 component = { component }
103- options = { { title } }
63+ options = { { title : name } }
10464 />
10565 ) ) }
10666 </ Stack . Navigator >
0 commit comments