Guest User

Untitled

a guest
Nov 24th, 2017
479
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.71 KB | None | 0 0
  1. import { AppRegistry } from 'react-native';
  2. import App from './App';
  3.  
  4. AppRegistry.registerComponent('bluebulk', () => App);
  5.  
  6. import { StackNavigator } from 'react-navigation';
  7. import LoginScreen from './src/components/login/LoginScreen';
  8. import Menu from './src/components/menu/Menu';
  9.  
  10. const App = StackNavigator({
  11. Main: { screen: LoginScreen },
  12. Menu: { screen: Menu }
  13. });
  14.  
  15. export default App;
  16.  
  17. import { StackNavigator } from 'react-navigation';
  18. import React, { Component } from 'react';
  19. import { StyleSheet, View, Text, Image } from 'react-native';
  20. import LoginForm from './LoginForm';
  21.  
  22. class LoginScreen extends Component {
  23.  
  24. render() {
  25. return (
  26.  
  27. <View style={styles.container}>
  28. <View style={styles.logoContainer}>
  29. <Image
  30. style={styles.logo}
  31. source={require('../../images/transparent.png')}
  32. />
  33. <View style={{ flexDirection: 'row' }}>
  34. <Text style={styles.blueTextStyle}>Blue</Text>
  35. <Text style={styles.bulkTextStyle}>Bulk</Text>
  36. </View>
  37. </View>
  38. <View style={styles.formContainer}>
  39. <LoginForm />
  40. </View>
  41. </View>
  42.  
  43.  
  44. );
  45. }
  46. }
  47.  
  48.  
  49. export default LoginScreen;
  50.  
  51. import React, { Component } from 'react';
  52. import {
  53. StyleSheet,
  54. TextInput,
  55. TouchableOpacity,
  56. Text,
  57. View,
  58. KeyboardAvoidingView,
  59. Keyboard
  60. } from 'react-native';
  61. import { StackNavigator } from 'react-navigation';
  62.  
  63. class LoginForm extends Component {
  64.  
  65. render() {
  66. return (
  67.  
  68. <KeyboardAvoidingView behavior='height' style={styles.container}>
  69.  
  70. <View style={{ flexDirection: 'row' }}>
  71. <Text style={styles.textStyle}>Email:</Text>
  72. <TextInput
  73. style={styles.styleInput}
  74. placeholder="user@gmail.com"
  75. returnKeyType="next"
  76. keyboardType="email-address"
  77. onSubmitEditing={() => this.refs.password.focus()}
  78. />
  79. </View>
  80.  
  81. <View style={{ flexDirection: 'row' }}>
  82. <Text style={styles.textStyle}>Password:</Text>
  83. <TextInput
  84. ref='password'
  85. style={styles.styleInput}
  86. placeholder="password"
  87. secureTextEntry
  88. returnKeyType="go"
  89. onSubmitEditing={Keyboard.dismiss}
  90. />
  91. </View>
  92.  
  93. <TouchableOpacity
  94. style={styles.buttonContainer}
  95. onPress={() => this.props.navigation.navigate('Menu')} //Error here
  96. >
  97. <Text style={styles.buttonText}>Login</Text>
  98. </TouchableOpacity>
  99. </KeyboardAvoidingView>
  100.  
  101. );
  102. }
  103. }
  104.  
  105. export default LoginForm;
  106.  
  107. import React, { Component } from 'react';
  108. import { StyleSheet, View, Text, TouchableOpacity } from 'react-native';
  109. import { StackNavigator } from 'react-navigation';
  110.  
  111. class Menu extends Component {
  112.  
  113. render() {
  114. const { navigate } = this.props.navigation;
  115. return (
  116. <View style={styles.container}>
  117. <View style={styles.viewContainer}>
  118.  
  119. <TouchableOpacity style={styles.buttonContainer}>
  120. <Text style={styles.buttonText}>View Products</Text>
  121. </TouchableOpacity>
  122.  
  123. <TouchableOpacity style={styles.buttonContainer}>
  124. <Text style={styles.buttonText}>View Discounts/Offers</Text>
  125. </TouchableOpacity>
  126.  
  127. <TouchableOpacity style={styles.buttonContainer}>
  128. <Text style={styles.buttonText}>View Invoice History</Text>
  129. </TouchableOpacity>
  130.  
  131. </View>
  132.  
  133. </View>
  134. );
  135. }
  136. }
  137.  
  138.  
  139.  
  140. export default Menu;
Add Comment
Please, Sign In to add comment