-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.android.js
More file actions
executable file
·55 lines (51 loc) · 1.53 KB
/
index.android.js
File metadata and controls
executable file
·55 lines (51 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import React, { Component } from 'react';
import {
AppRegistry,
Button,
NativeEventEmitter,
NativeModules,
StyleSheet,
Text,
View,
DrawerLayoutAndroid
} from 'react-native';
import BatchedBridge from "react-native/Libraries/BatchedBridge/BatchedBridge";
const activityStarter = NativeModules.ActivityStarter;
let ChatView;
export default class MainComponent extends Component {
constructor(props){
super(props);
this.onPressTitle = this.onPressTitle.bind(this);
this.state= {
changed: false
};
}
onPressTitle(){
let self = this;
activityStarter.alert().then(function (d) {
ChatView = d;
self.setState({changed: true});
});
};
render() {
var navigationView = (
<View style={{flex: 1, backgroundColor: '#fff'}}>
<Text style={{margin: 10, fontSize: 15, textAlign: 'left'}} onPress={this.onPressTitle}>Show Chat</Text>
</View>
);
return (
<DrawerLayoutAndroid
drawerWidth={300}
drawerPosition={DrawerLayoutAndroid.positions.Left}
renderNavigationView={() => navigationView}
drawerBackgroundColor="rgba(0,0,0,0.5)">
<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>
{this.state.changed?<ChatView />: null}
</View>
</DrawerLayoutAndroid>
);
}
}
AppRegistry.registerComponent('MainComponent', () => MainComponent);