-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
45 lines (40 loc) · 1.25 KB
/
App.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import * as React from 'react';
import { StyleSheet, Text, View, NativeModules } from 'react-native';
import { HomeComponent } from './components/home/HomeComponent';
import { DetailsScreen } from './components/detailComponent/DetailComponent';
import { StackNavigator } from 'react-navigation';
import { BarcodeComponent } from './components/barcodeReaderComponent/barcodeComponent';
import { CameraComponent } from './components/cameraComponent/cameraComponent';
export default class App extends React.Component {
render() {
return <RootStack />;
}
}
const mapNavigationStateParamsToProps = (SomeComponent: any) => {
return class extends React.Component<any> {
static navigationOptions = SomeComponent.navigationOptions; // better use hoist-non-react-statics
render() {
const { navigation: {state: {params}}} = this.props
return <SomeComponent {...params} {...this.props} />
}
}
}
const RootStack = StackNavigator(
{
Home: {
screen: HomeComponent,
},
Details: {
screen: mapNavigationStateParamsToProps(DetailsScreen) ,
},
BarcodeComponent:{
screen: BarcodeComponent,
},
CameraComponent:{
screen: CameraComponent,
}
},
{
initialRouteName: 'Home',
}
);