File tree Expand file tree Collapse file tree 7 files changed +118
-105
lines changed
packages/template-blank-react Expand file tree Collapse file tree 7 files changed +118
-105
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @nativescript/template-blank-react" ,
3
- "version" : " 7.0.10 " ,
3
+ "version" : " 7.0.11 " ,
4
4
"description" : " Blank template for NativeScript apps using React." ,
5
5
"author" :
" Jamie Birch <[email protected] >" ,
6
6
"main" : " app.js" ,
33
33
"@nativescript/core" : " ~7.1.0" ,
34
34
"@react-navigation/core" : " ^5.13.2" ,
35
35
"react" : " ^16.13.1" ,
36
- "react-nativescript" : " ^2.1.0" ,
37
- "react-nativescript-navigation" : " ^2.0.1"
36
+ "react-nativescript" : " ^2.2.0" ,
37
+ "react-nativescript-navigation" : " ^2.0.1" ,
38
+ "react-refresh" : " ^0.8.3"
38
39
},
39
40
"devDependencies" : {
40
41
"@babel/core" : " ^7.4.5" ,
45
46
"babel-loader" : " 8.0.6" ,
46
47
"fork-ts-checker-webpack-plugin" : " ^5.1.0" ,
47
48
"patch-package" : " ^6.2.2" ,
48
- "react-refresh" : " ^0.8.3" ,
49
- "typescript" : " ^3.9.3"
49
+ "typescript" : " ~4.0.3"
50
50
},
51
51
"gitHead" : " 1350d382fb4b0ed4c6e9685df909518b2688e004" ,
52
52
"readme" : " NativeScript Application"
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ import * as React from "react" ;
2
+ import { RouteProp } from '@react-navigation/core' ;
3
+ import { Dialogs } from '@nativescript/core' ;
4
+ import { FrameNavigationProp } from "react-nativescript-navigation" ;
5
+ import { StyleSheet } from "react-nativescript" ;
6
+ import { MainStackParamList } from "./NavigationParamList" ;
7
+
8
+ type HomeScreenProps = {
9
+ route : RouteProp < MainStackParamList , "Home" > ,
10
+ navigation : FrameNavigationProp < MainStackParamList , "Home" > ,
11
+ }
12
+
13
+ export function HomeScreen ( { navigation } : HomeScreenProps ) {
14
+ return (
15
+ < flexboxLayout style = { styles . container } >
16
+ < label
17
+ className = "fas"
18
+ style = { styles . text }
19
+ >
20
+  Hello World!
21
+ </ label >
22
+ < button
23
+ style = { styles . button }
24
+ onTap = { ( ) => Dialogs . alert ( "Tapped!" ) }
25
+ >
26
+ Tap me for an alert
27
+ </ button >
28
+ < button
29
+ style = { styles . button }
30
+ onTap = { ( ) => navigation . navigate ( 'Secondary' ) }
31
+ >
32
+ Go to next screen
33
+ </ button >
34
+ </ flexboxLayout >
35
+ ) ;
36
+ }
37
+
38
+ const styles = StyleSheet . create ( {
39
+ container : {
40
+ height : "100%" ,
41
+ flexDirection : "column" ,
42
+ justifyContent : "center" ,
43
+ } ,
44
+ text : {
45
+ textAlignment : "center" ,
46
+ fontSize : 24 ,
47
+ color : "black" ,
48
+ } ,
49
+ button : {
50
+ fontSize : 24 ,
51
+ color : "#2e6ddf" ,
52
+ } ,
53
+ } ) ;
Original file line number Diff line number Diff line change 1
1
export type MainStackParamList = {
2
- first : { } ,
3
- second : { } ,
2
+ Home : { } ,
3
+ Secondary : { } ,
4
4
} ;
Original file line number Diff line number Diff line change 1
1
import * as React from "react" ;
2
2
import { BaseNavigationContainer } from '@react-navigation/core' ;
3
3
import { stackNavigatorFactory } from "react-nativescript-navigation" ;
4
- import { First } from "./FirstScreen " ;
5
- import { Second } from "./SecondScreen " ;
4
+ import { HomeScreen } from "./HomeScreen " ;
5
+ import { SecondaryScreen } from "./SecondaryScreen " ;
6
6
7
7
const StackNavigator = stackNavigatorFactory ( ) ;
8
8
9
9
export const mainStackNavigator = ( ) => (
10
10
< BaseNavigationContainer >
11
11
< StackNavigator . Navigator
12
- initialRouteName = "first "
12
+ initialRouteName = "Home "
13
13
screenOptions = { {
14
+ headerStyle : {
15
+ backgroundColor : "white" ,
16
+ } ,
14
17
headerShown : true ,
15
18
} }
16
19
>
17
- < StackNavigator . Screen name = "first" component = { First } />
18
- < StackNavigator . Screen name = "second" component = { Second } />
20
+ < StackNavigator . Screen
21
+ name = "Home"
22
+ component = { HomeScreen }
23
+ />
24
+ < StackNavigator . Screen
25
+ name = "Secondary"
26
+ component = { SecondaryScreen }
27
+ />
19
28
</ StackNavigator . Navigator >
20
29
</ BaseNavigationContainer >
21
30
) ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ import * as React from "react" ;
2
+ import { RouteProp } from '@react-navigation/core' ;
3
+ import { FrameNavigationProp } from "react-nativescript-navigation" ;
4
+ import { MainStackParamList } from "./NavigationParamList" ;
5
+ import { StyleSheet } from "react-nativescript" ;
6
+
7
+ type SecondaryScreenProps = {
8
+ route : RouteProp < MainStackParamList , "Secondary" > ,
9
+ navigation : FrameNavigationProp < MainStackParamList , "Secondary" > ,
10
+ }
11
+
12
+ export function SecondaryScreen ( { navigation } : SecondaryScreenProps ) {
13
+ return (
14
+ < flexboxLayout style = { styles . container } >
15
+ < label style = { styles . text } >
16
+ You're viewing the secondary screen!
17
+ </ label >
18
+ < button
19
+ style = { styles . button }
20
+ onTap = { ( ) => navigation . goBack ( ) }
21
+ >
22
+ Go back
23
+ </ button >
24
+ </ flexboxLayout >
25
+ ) ;
26
+ }
27
+
28
+ const styles = StyleSheet . create ( {
29
+ container : {
30
+ height : "100%" ,
31
+ flexDirection : "column" ,
32
+ justifyContent : "center" ,
33
+ backgroundColor : "yellow" ,
34
+ } ,
35
+ text : {
36
+ textAlignment : "center" ,
37
+ fontSize : 24 ,
38
+ color : "black" ,
39
+ } ,
40
+ button : {
41
+ fontSize : 24 ,
42
+ color : "#2e6ddf" ,
43
+ } ,
44
+ } ) ;
You can’t perform that action at this time.
0 commit comments