File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11interface ReducerAction {
22 type : string ;
33}
4+
5+ type RootStackParamList = {
6+ Main : undefined ;
7+ Styleguide : undefined ;
8+ } ;
9+
10+ type Environment = "development" | "staging" | "edge" | "production" | "live" ;
Original file line number Diff line number Diff line change @@ -2,10 +2,12 @@ import React from "react";
22import { ENV } from "<%= name %>/App/Config" ;
33import Environment from "<%= name %>/App/Components/Utilities/Environment" ;
44
5+ const environment = ENV as Environment ;
6+
57const App : React . FC = ( { children } ) => (
68 < React . Fragment >
79 { children }
8- < Environment env = { ENV } />
10+ < Environment env = { environment } />
911 </ React . Fragment >
1012) ;
1113
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import { createStackNavigator } from "@react-navigation/stack";
44
55import Screens from "<%= name %>/App/Screens" ;
66
7- const Stack = createStackNavigator ( ) ;
7+ const Stack = createStackNavigator < RootStackParamList > ( ) ;
88
99function RootStack ( ) {
1010 return (
Original file line number Diff line number Diff line change 11import React from 'react' ;
2- import { NavigationStackScreenComponent } from " react-navigation- stack" ;
2+ import { StackNavigationProp } from '@ react-navigation/ stack' ;
33< % if ( i18nSupport ) { - % >
44import { t } from "<%= name %>/App/Helpers/Translations" ;
55< % } - % >
66import Layout from '<%= name %>/App/Components/Layout' ;
77import Button from '<%= name %>/App/Components/Button' ;
88import Text from '<%= name %>/App/Components/Text' ;
99
10- const Main : NavigationStackScreenComponent = ( { navigation } ) => {
10+ type MainScreenNavigationProp = StackNavigationProp < RootStackParamList , "Main" > ;
11+
12+ type Props = {
13+ navigation : MainScreenNavigationProp ;
14+ } ;
15+
16+ const Main : React . FC < Props > = ( { navigation } ) => {
1117 return (
1218 < Layout . Center >
1319 < % if ( i18nSupport ) { - % >
Original file line number Diff line number Diff line change 11import React from "react" ;
22import { Alert } from "react-native" ;
33import { useSelector , useDispatch } from "react-redux" ;
4+ import { StackNavigationProp } from "@react-navigation/stack" ;
45import styled from "styled-components/native" ;
56import Button from "<%= name %>/App/Components/Button" ;
67import Layout from "<%= name %>/App/Components/Layout" ;
@@ -12,7 +13,16 @@ interface RootState {
1213 } ;
1314}
1415
15- const Styleguide : React . FC = ( ) => {
16+ type StyleguideScreenNavigationProp = StackNavigationProp <
17+ RootStackParamList ,
18+ "Styleguide"
19+ > ;
20+
21+ type Props = {
22+ navigation : StyleguideScreenNavigationProp ;
23+ } ;
24+
25+ const Styleguide : React . FC < Props > = ( ) => {
1626 const dispatch = useDispatch ( ) ;
1727 const installed = useSelector ( ( state : RootState ) => state . app . installed ) ;
1828 const requestExample = React . useCallback (
Original file line number Diff line number Diff line change 11import React from "react" ;
2- import { NavigationStackScreenComponent } from "react-navigation- stack" ;
2+ import { StackNavigationProp } from "@ react-navigation/ stack" ;
33import Layout from "<%= name %>/App/Components/Layout" ;
44import Text from "<%= name %>/App/Components/Text" ;
55
6- const < %= screen % > : NavigationStackScreenComponent = ( { navigation } ) => {
6+ type < %= screen % > ScreenNavigationProp = StackNavigationProp <
7+ RootStackParamList ,
8+ "<%= screen %>"
9+ > ;
10+
11+ type Props = {
12+ navigation : < %= screen % > ScreenNavigationProp ;
13+ } ;
14+
15+ const < %= screen % > : React . FC < Props > = ( { navigation } ) => {
716 return (
817 < Layout . Center >
918 < Text > < %= screen % > </ Text >
You can’t perform that action at this time.
0 commit comments