forked from pjamrozowicz/react-native-settings-list
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimple.js
81 lines (76 loc) · 2.55 KB
/
simple.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
/* eslint-disable react-native/no-inline-styles */
'use strict';
import React, {Component} from 'react';
import {View, Image, Alert} from 'react-native';
import SettingsList from 'react-native-settings-list';
// simple example
class SettingsListSimple extends Component {
constructor() {
super();
this.onValueChange = this.onValueChange.bind(this);
this.state = {switchValue: false, stages: 20};
}
render() {
return (
<View style={{backgroundColor: 'gray', flex: 1}}>
<View style={{flex: 1, marginTop: 50}}>
<SettingsList>
<SettingsList.Header
headerText="First Grouping"
headerStyle={{color: 'white'}}
/>
<SettingsList.Item
icon={
<View style={{height: 30, marginLeft: 10, alignSelf: 'center'}}>
<Image
style={{alignSelf: 'center', height: 30, width: 30}}
source={require('../images/about.png')}
/>
</View>
}
itemWidth={50}
title="Icon Example"
onPress={() => Alert.alert('Icon Example Pressed')}
/>
<SettingsList.Item
hasNavArrow={false}
switchState={this.state.switchValue}
switchOnValueChange={this.onValueChange}
hasSwitch={true}
title="Switch Example"
/>
<SettingsList.Item
title="Different Colors Example"
backgroundColor="#D1D1D1"
titleStyle={{color: 'blue'}}
arrowStyle={{tintColor: 'blue'}}
onPress={() => Alert.alert('Different Colors Example Pressed')}
/>
<SettingsList.Header
headerText="Different Grouping"
headerStyle={{color: 'white', marginTop: 50}}
/>
<SettingsList.Item
titleInfo="Some Information"
hasNavArrow={false}
title="Information Example"
/>
<SettingsList.Item title="Settings 1" />
<SettingsList.Item title="Settings 2" />
<SettingsList.Item
id="stages"
title="stages"
isEditable={true}
value={this.state.stages.toString()}
onTextChange={text => this.setState({stages: text})}
/>
</SettingsList>
</View>
</View>
);
}
onValueChange(value) {
this.setState({switchValue: value});
}
}
export default SettingsListSimple;