-
Notifications
You must be signed in to change notification settings - Fork 86
/
App.android.js
71 lines (63 loc) · 1.83 KB
/
App.android.js
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import React, { Component } from "react";
import { View, Modal } from "react-native";
import CloseButton from "./app/table-of-contents/closeButton";
import EStyleSheet from "react-native-extended-stylesheet";
import TableOfContents from "./app/table-of-contents";
import TouchChapter from "./app/touch-events";
import PhysicsChapter from "./app/physics";
//import SensorsChapter from "./app/sensors";
import ExamplesChapter from "./app/examples";
import OpenGLChapter from "./app/opengl";
EStyleSheet.build();
//-- There is a bunch of warnings about the use of deprecated lifecycle methods. A lot of them are caused
//-- by dependencies. Comment out the line below to see the warnings.
console.disableYellowBox = true;
export default class App extends Component {
constructor(props) {
super(props);
this.state = {
sceneVisible: false,
scene: null
};
}
mountScene = scene => {
this.setState({
sceneVisible: true,
scene: scene
});
};
unMountScene = () => {
this.setState({
sceneVisible: false,
scene: null
});
};
render() {
return (
<View style={{ flex: 1 }}>
<TableOfContents
sceneVisible={this.state.sceneVisible}
contents={{
heading: "Chapters",
items: [
TouchChapter(this.mountScene),
PhysicsChapter(this.mountScene),
//SensorsChapter(this.mountScene),
OpenGLChapter(this.mountScene),
ExamplesChapter(this.mountScene)
]
}}
/>
<Modal
animationType={"slide"}
transparent={false}
visible={this.state.sceneVisible}
onRequestClose={_ => {}}
>
{this.state.scene}
<CloseButton onPress={this.unMountScene} />
</Modal>
</View>
);
}
}