Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.63 KB | None | 0 0
  1. import React, { Component } from 'react';
  2. import { Dimensions,
  3. Image,
  4. ScrollView,
  5. StyleSheet,
  6. Text,
  7. TouchableOpacity,
  8. View,
  9. StatusBar} from 'react-native';
  10. import { Header } from 'native-base';
  11. import { Actions } from 'react-native-router-flux';
  12.  
  13. import SideMenu from './components/SideMenu.js'
  14. import ListView from './ListView.js'
  15. import MapView from './MapView.js'
  16. import PaySuccess from './PaySuccess.js'
  17. import HeaderList from './components/HeaderList';
  18.  
  19. import BackgroundImage from './components/BackgroundImage';
  20.  
  21. const window = Dimensions.get('window')
  22.  
  23. class Menu extends Component {
  24. render() {
  25. return (
  26. <Image source={require('./images/backgroundImage/background.png')} style={{ flex: 1, width: window.width, height: window.height,padding: 20}}>
  27.  
  28. <ScrollView scrollsToTop={false} style={styles.menu}>
  29. <View style={styles.avatarContainer}>
  30. <Text style={styles.name}>Main Menu</Text>
  31. </View>
  32. <View style={{marginTop: 32}}>
  33. <Text style={styles.item}>
  34. Locales cerca tuyo
  35. </Text>
  36.  
  37. <Text style={styles.item}>
  38. Mis Pedidos
  39. </Text>
  40.  
  41. <Text style={styles.item}>
  42. Notificaciones
  43. </Text>
  44. </View>
  45. </ScrollView>
  46. </Image>
  47. );
  48. }
  49. }
  50.  
  51. export default class Basic extends Component {
  52. constructor (props) {
  53. super(props)
  54. this.state = {
  55. isOpen: false,
  56. currentID: 'mapview',
  57. }
  58. }
  59.  
  60. pressedMapButton(){
  61. this.setState({currentID: 'listview'})
  62. }
  63. pressedPayButton(){
  64. this.setState({currentID: 'paysuccess'})
  65. }
  66. pressedListViewButton(){
  67. this.setState({currentID: 'mapview'})
  68. }
  69.  
  70. toggle() {
  71. this.setState({ isOpen: !this.state.isOpen })
  72. }
  73.  
  74. updateMenuState(isOpen) {
  75. this.setState({ isOpen })
  76. }
  77.  
  78. renderSelectedView() {
  79. console.log(this.state.currentID);
  80. switch (this.state.currentID) {
  81. case 'listview':
  82. return (
  83. <ListView onPressButton={() => this.pressedListViewButton()} />
  84. );
  85. case 'paysuccess':
  86. return (
  87. <PaySuccess onPressButton={() => this.pressedPayButton()} />
  88. );
  89. case 'mapview':
  90. return (
  91. <MapView onPressButton={() => this.pressedMapButton()} />
  92. );
  93. }
  94. }
  95.  
  96. render() {
  97. const menu = <Menu onItemSelected={this.onMenuItemSelected} />
  98.  
  99. return (
  100. <SideMenu.FacebookStyle
  101. menu={menu}
  102. isOpen={this.state.isOpen}
  103. disableGestures={true}
  104. onChange={(isOpen) => this.updateMenuState(isOpen)}>
  105. <View style={styles.container}>
  106. <Header style={{height: 64, backgroundColor: '#00b5cc'}}>
  107. <View style={{height: 24, flex: 1, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between'}}>
  108.  
  109. <TouchableOpacity style={styles.button} onPress={() => this.toggle()}>
  110. <Image source={require('./images/menuSideBar/menu.png')} style={{width: 22, height: 14, marginLeft: 12}} />
  111. </TouchableOpacity>
  112.  
  113. <Image style={[styles.button, {width: 130, height: 22}]} source={require('./images/logo/logo@2x.png')} />
  114.  
  115. <TouchableOpacity style={styles.button} onPress={Actions.qrCode}>
  116. <Image source={require('./images/qrCode/qr-code@2x.png')} style={{width: 22, height: 24, marginLeft: 12}} />
  117. </TouchableOpacity>
  118. </View>
  119. </Header>
  120. {this.renderSelectedView()}
  121. </View>
  122. </SideMenu.FacebookStyle>
  123. )
  124. }
  125. }
  126.  
  127. const styles = StyleSheet.create({
  128. button: {
  129. width: 48,
  130. height: 28,
  131. top: 20,
  132. backgroundColor: 'orange'
  133. },
  134. container: {
  135. flex: 1,
  136. backgroundColor: '#F5FCFF',
  137. backfaceVisibility: 'visible'
  138. },
  139. welcome: {
  140. fontSize: 20,
  141. textAlign: 'center',
  142. margin: 10
  143. },
  144. instructions: {
  145. textAlign: 'center',
  146. color: '#333333',
  147. marginBottom: 5
  148. },
  149. avatarContainer: {
  150. marginBottom: 20,
  151. marginTop: 20,
  152. },
  153. avatar: {
  154. width: 48,
  155. height: 48,
  156. borderRadius: 24,
  157. flex: 1,
  158. },
  159. name: {
  160. position: 'absolute',
  161. top: 20,
  162. color: '#8e8788',
  163. fontSize: 15,
  164. fontFamily: 'CircularStd_Book',
  165. },
  166. item: {
  167. fontSize: 15,
  168. fontFamily: 'CircularStd_Book',
  169. marginTop: 32,
  170. color: 'white',
  171. }
  172. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement