Skip to content

Instantly share code, notes, and snippets.

@classpro
Forked from TiagoGouvea/index.android.js
Created January 20, 2016 14:55
Show Gist options
  • Save classpro/8bd9a40edc1ee8472328 to your computer and use it in GitHub Desktop.
Save classpro/8bd9a40edc1ee8472328 to your computer and use it in GitHub Desktop.

Revisions

  1. @TiagoGouvea TiagoGouvea created this gist Oct 10, 2015.
    45 changes: 45 additions & 0 deletions index.android.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,45 @@
    /**
    * Sample React Native App
    * https://github.com/facebook/react-native
    */
    'use strict';

    var React = require('react-native');
    var {
    AppRegistry,
    StyleSheet,
    Text,
    View,
    DrawerLayoutAndroid,
    TouchableHighlight,
    } = React;

    var DrawerTest = React.createClass({
    openDrawer:function() {
    this.refs['DRAWER'].openDrawer()
    },
    render: function() {
    var navigationView = (
    <View style={{flex: 1, backgroundColor: '#fff'}}>
    <Text style={{margin: 10, fontSize: 15, textAlign: 'left'}}>I'm in the Drawer!</Text>
    </View>
    );
    return (
    <DrawerLayoutAndroid
    drawerWidth={300}
    ref={'DRAWER'}
    drawerPosition={DrawerLayoutAndroid.positions.Left}
    renderNavigationView={() => navigationView}>
    <View style={{flex: 1, alignItems: 'center'}}>
    <Text style={{margin: 10, fontSize: 15, textAlign: 'right'}}>Hello</Text>
    <Text style={{margin: 10, fontSize: 15, textAlign: 'right'}}>World!</Text>
    <TouchableHighlight onPress={this.openDrawer}>
    <Text>{'Open Drawer'}</Text>
    </TouchableHighlight>
    </View>
    </DrawerLayoutAndroid>
    );
    }
    });

    AppRegistry.registerComponent('DrawerTest', () => DrawerTest);