-
Notifications
You must be signed in to change notification settings - Fork 14
/
index.ios.js
85 lines (74 loc) · 2.64 KB
/
index.ios.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import React, { Component } from 'react';
import { AppRegistry,
StyleSheet,
Text,
View,
TouchableOpacity,
Switch
} from 'react-native';
import PanResponderExample from './a-pan-responder';
import PanResponderDirectExample from './b-pan-responder-direct';
import NativeExample from './c-native';
import AnimatedLibExample from './d-animated-lib';
class example extends Component {
constructor(props) {
super(props);
this.state = {
example: undefined,
simulateHeavyRender: true,
simulateBusyBridge: true
};
}
render() {
if (this.state.example) {
const Example = this.state.example;
return (
<Example
simulateHeavyRender={this.state.simulateHeavyRender}
simulateBusyBridge={this.state.simulateBusyBridge}
/>
);
}
return (
<View style={styles.container}>
<TouchableOpacity onPress={() => this.setState({example: PanResponderExample})}>
<Text style={{color: 'blue', fontSize: 17, marginBottom: 20}}>
Pan Responder
</Text>
</TouchableOpacity>
<TouchableOpacity onPress={() => this.setState({example: PanResponderDirectExample})}>
<Text style={{color: 'blue', fontSize: 17, marginBottom: 20}}>
Pan Responder with Direct Manipulation
</Text>
</TouchableOpacity>
<TouchableOpacity onPress={() => this.setState({example: NativeExample})}>
<Text style={{color: 'blue', fontSize: 17, marginBottom: 20}}>
Native Container
</Text>
</TouchableOpacity>
<TouchableOpacity onPress={() => this.setState({example: AnimatedLibExample})}>
<Text style={{color: 'blue', fontSize: 17, marginBottom: 20}}>
JS with Animated Library
</Text>
</TouchableOpacity>
<View style={{flexDirection: 'row', marginTop: 30}}>
<Text style={{alignSelf: 'center', marginRight: 10}}>Simulate heavy render function</Text>
<Switch value={this.state.simulateHeavyRender} onValueChange={(val) => this.setState({simulateHeavyRender: val})} />
</View>
<View style={{flexDirection: 'row', marginTop: 20}}>
<Text style={{alignSelf: 'center', marginRight: 10}}>Simulate busy bridge every 1 sec</Text>
<Switch value={this.state.simulateBusyBridge} onValueChange={(val) => this.setState({simulateBusyBridge: val})} />
</View>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
});
AppRegistry.registerComponent('example', () => example);