Advertisement
Guest User

TabScreen.js

a guest
Jul 16th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React, { Component } from "react";
  2. import {
  3.   Image,
  4.   Text,
  5.   TextInput,
  6.   Platform,
  7.   StyleSheet,
  8.   TouchableOpacity
  9. } from "react-native";
  10. import {
  11.   Container,
  12.   Tabs,
  13.   Tab,
  14.   Header,
  15.   Title,
  16.   ScrollableTab,
  17.   View,
  18.   Form,
  19.   Label,
  20.   Left,
  21.   Right
  22. } from "native-base";
  23. import { NavigationActions, StackActions } from "react-navigation";
  24. import { connect } from "react-redux";
  25. import globalStyles, { height, width, colors } from "../customLib/globalStyle";
  26. import RegisterScreen from "./RegisterScreen";
  27. import { updateInitTab } from "../Redux/actions/auth";
  28.  
  29. class LoginScreen extends Component {
  30.   constructor(props) {
  31.     super(props);
  32.     this.state = {
  33.       email: "",
  34.       password: ""
  35.     };
  36.   }
  37.  
  38.   render() {
  39.     return (
  40.       <Container>
  41.         ...
  42.         <Tabs
  43.           onChangeTab={val => this.props.updateInitTab(val.i)}
  44.           initialPage={this.props.initPage}
  45.           tabBarUnderlineStyle={{ backgroundColor: colors.BLUE }}
  46.         >
  47.           <Tab heading="Masuk" >
  48.             <Text> Masuk </Text>
  49.           </Tab>
  50.           <Tab heading="Daftar" >
  51.             <RegisterScreen {...this.props} updatePage={val => this.props.updateInitTab(val)} />
  52.           </Tab>
  53.         </Tabs>
  54.       </Container>
  55.     );
  56.   }
  57. }
  58.  
  59. const mapStateToProps = ({ auth }) => ({
  60.   initPage: auth.initPage
  61. });
  62.  
  63. const mapDispatchToProps = dispatch => ({
  64.   updateInitTab: int => dispatch(updateInitTab(int))
  65. });
  66.  
  67. export default connect(
  68.   mapStateToProps,
  69.   mapDispatchToProps
  70. )(LoginScreen);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement