forked from bolan9999/react-native-largelist
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApp.js
107 lines (102 loc) · 2.42 KB
/
App.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import React from "react";
import {
View,
TouchableOpacity,
Text,
StyleSheet,
ScrollView,
TextInput,
Switch
} from "react-native";
import {
HeightUnequalExample,
HeightEqualExample,
MessageExample,
ContactExample,
MenuListExample,
RefreshAndLoadingExample,
IntensiveSectionExample,
NativeLargeListExample
} from "./Examples";
export default class App extends React.Component {
constructor(props) {
super(props);
this.state = {
native: false,
type: -1
};
}
render() {
switch (this.state.type) {
case 0:
return <HeightEqualExample native={this.state.native} />;
case 1:
return <HeightUnequalExample native={this.state.native} />;
case 2:
return <MessageExample native={this.state.native} />;
case 3:
return <ContactExample native={this.state.native} />;
case 4:
return <MenuListExample native={this.state.native} />;
case 5:
return <RefreshAndLoadingExample native={this.state.native} />;
case 6:
return <IntensiveSectionExample native={this.state.native} />;
}
return this.renderChoose();
}
renderChoose() {
const examples = [
"HeightEqualExample",
"HeightUnequalExample",
"MessageExample",
"ContactExample",
"MenuListExample",
"RefreshAndLoadingExample",
"IntensiveSectionExample"
];
return (
<ScrollView style={{ flex: 1 }} contentContainerStyle={styles.container}>
<View style={styles.choseContainer}>
<Text>Use Native ScrollView</Text>
<Switch
value={this.state.native}
onValueChange={value => this.setState({ native: value })}
/>
</View>
{examples.map((str, index) =>
<TouchableOpacity
key={index}
style={styles.button}
onPress={() => this.setState({ type: index })}
>
<Text style={styles.text}>
{str}
</Text>
</TouchableOpacity>
)}
</ScrollView>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1
// alignItems: "stretch"
},
choseContainer: {
marginVertical: 40,
flexDirection: "row",
justifyContent: "center"
},
input: {
fontSize: 16,
width: 150,
borderWidth: StyleSheet.hairlineWidth
},
text: {
fontSize: 16,
marginTop: 20
},
button: { alignItems: "center" }
});