Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React from 'react';
- import {Button, View, Text} from 'react-native';
- import {createAppContainer} from 'react-navigation';
- import {createStackNavigator} from 'react-navigation-stack';
- import PageHeader from "../../PageHeader";
- import {Container, Content, Form, Input, Item, Label} from "native-base";
- import CaptureBarcode from "./CaptureBarcode";
- import CaptureImage from "./CaptureImage";
- class HomeScreen extends React.Component {
- constructor(props) {
- super(props)
- this.state = {
- message: ""
- }
- }
- callbackFunction = (childData) => {
- this.setState({message: childData})
- }
- render() {
- return (
- <Container>
- <PageHeader navigation={this.props.navigation} title={'Create Item'}/>
- <Content>
- <Form>
- <Item stacked last>
- <Label>Name/Model</Label>
- <Input/>
- </Item>
- <Item stacked last>
- <Label>Brand</Label>
- <Input/>
- </Item>
- <Item disabled stacked last>
- <Label>Barcode</Label>
- <Input placeholder={this.state.message}/>
- <View style={{marginRight: 10}}>
- <Button
- style={{marginRight: 30}}
- title="Scan"
- onPress={() => {
- this.props.navigation.navigate('Barcode', {
- parentCallback: this.callbackFunction
- })
- }}
- />
- </View>
- </Item>
- <Item stacked last>
- <View style={{marginRight: 10}}>
- <Button
- style={{marginRight: 30}}
- title="Add Photo"
- onPress={() => {
- this.props.navigation.navigate('Camera')
- }}
- />
- </View>
- </Item>
- <Text>{this.state.message}</Text>
- </Form>
- <View>
- <Button
- onPress={() => this.props.navigation.navigate('MyModal')}
- title="Info"
- color="#fff"
- />
- <Button
- onPress={() => this.props.navigation.navigate('MyModal2')}
- title="Info"
- color="#fff"
- />
- </View>
- </Content>
- </Container>
- )
- ;
- }
- }
- const MainStack = createStackNavigator(
- {
- Home: {
- screen: HomeScreen,
- },
- },
- {
- initialRouteName: 'Home',
- defaultNavigationOptions: {
- headerStyle: {
- backgroundColor: '#f4511e',
- },
- headerTintColor: '#fff',
- headerTitleStyle: {
- fontWeight: 'bold',
- },
- },
- headerMode: 'none'
- }
- );
- const RootStack = createStackNavigator(
- {
- Main: {
- screen: MainStack,
- },
- Barcode: {
- screen: CaptureBarcode,
- },
- Camera: {
- screen: CaptureImage
- },
- },
- {
- mode: 'modal',
- headerMode: 'none',
- }
- );
- const AppContainer = createAppContainer(RootStack);
- export default AppContainer;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement