import * as React from 'react';
import { Button, Text, View, StyleSheet } from 'react-native';
import { BarCodeScanner } from 'expo';
import { withNavigationFocus } from '@react-navigation/core';
import { createStackNavigator } from 'react-navigation-stack';
const IndexScreen = ({ navigation }) => (
);
IndexScreen.navigationOptions = {
title: 'Lifecycle Interactions',
};
@withNavigationFocus
class BarCodeScreen extends React.Component {
handleBarCodeScanned = data => {
console.log('scanned...');
this.props.navigation.navigate('Info', { data });
};
render() {
return (
);
}
}
BarCodeScreen.navigationOptions = {
title: 'BarCodeView',
};
class InfoScreen extends React.Component {
render() {
return (
{JSON.stringify(this.props.navigation.getParam('data'))}
);
}
}
InfoScreen.navigationOptions = {
title: 'Info',
};
export default createStackNavigator(
{
Index: IndexScreen,
BarCode: BarCodeScreen,
Info: InfoScreen,
},
{
initialRouteName: 'Index',
}
);