Guest User

Untitled

a guest
Apr 24th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. import PropTypes from 'prop-types';
  2. import React, {Component} from 'react';
  3. import styles from './SideMenu.style';
  4. import {NavigationActions} from 'react-navigation';
  5. import {ScrollView, Text, View} from 'react-native';
  6. import { StackNavigator } from 'react-navigation';
  7.  
  8. class SideMenu extends Component {
  9. navigateToScreen = (route) => () => {
  10. const navigateAction = NavigationActions.navigate({
  11. routeName: route
  12. });
  13. this.props.navigation.dispatch(navigateAction);
  14. }
  15.  
  16. render () {
  17. return (
  18. <View style={styles.container}>
  19. <ScrollView>
  20. <View>
  21. <Text style={styles.sectionHeadingStyle}>
  22. Section 1
  23. </Text>
  24. <View style={styles.navSectionStyle}>
  25. <Text style={styles.navItemStyle} onPress={this.navigateToScreen('Page1')}>
  26. Page1
  27. </Text>
  28. </View>
  29. </View>
  30. <View>
  31. <Text style={styles.sectionHeadingStyle}>
  32. Section 2
  33. </Text>
  34. <View style={styles.navSectionStyle}>
  35. <Text style={styles.navItemStyle} onPress={this.navigateToScreen('Page2')}>
  36. Page2
  37. </Text>
  38. <Text style={styles.navItemStyle} onPress={this.navigateToScreen('Page3')}>
  39. Page3
  40. </Text>
  41. </View>
  42. </View>
  43. <View>
  44. <Text style={styles.sectionHeadingStyle}>
  45. Section 3
  46. </Text>
  47. <View style={styles.navSectionStyle}>
  48. <Text style={styles.navItemStyle} onPress={this.navigateToScreen('Page4')}>
  49. Page4
  50. </Text>
  51. </View>
  52. </View>
  53. </ScrollView>
  54. <View style={styles.footerContainer}>
  55. <Text>This is my fixed footer</Text>
  56. </View>
  57. </View>
  58. );
  59. }
  60. }
  61.  
  62. SideMenu.propTypes = {
  63. navigation: PropTypes.object
  64. };
  65.  
  66. export default SideMenu;
Add Comment
Please, Sign In to add comment