|
| 1 | +var React = require('react-native') |
| 2 | +var Modal = require('react-native-modal') |
| 3 | +var Button = require('react-native-button') |
| 4 | +var { Icon, } = require('react-native-icons') |
| 5 | + |
| 6 | + |
| 7 | +var window = require('../util/window') |
| 8 | +var { width, height } = window.get() |
| 9 | + |
| 10 | +var { |
| 11 | + View, |
| 12 | + StyleSheet, |
| 13 | + ScrollView, |
| 14 | + Component, |
| 15 | + Text, |
| 16 | + StatusBarIOS, |
| 17 | + ActivityIndicatorIOS, |
| 18 | + TouchableOpacity |
| 19 | + } = React |
| 20 | + |
| 21 | + |
| 22 | +class Setting extends Component { |
| 23 | + constructor(props) { |
| 24 | + super(props) |
| 25 | + } |
| 26 | + |
| 27 | + |
| 28 | + onAboutPress() { |
| 29 | + |
| 30 | + } |
| 31 | + |
| 32 | + |
| 33 | + onLogoutPress() { |
| 34 | + this.props.actions.logout() |
| 35 | + this.props.router.replaceWithHome() |
| 36 | + } |
| 37 | + |
| 38 | + |
| 39 | + onClearPress(){ |
| 40 | + |
| 41 | + } |
| 42 | + |
| 43 | + |
| 44 | + render() { |
| 45 | + return ( |
| 46 | + <Modal |
| 47 | + style={modalStyles} |
| 48 | + //onPressBackdrop={() => this.props.closeModal()} |
| 49 | + hideCloseButton={true} |
| 50 | + backdropType='blur' |
| 51 | + backdropBlur='dark' |
| 52 | + isVisible={this.props.isModalOpen} |
| 53 | + onClose={() => this.props.closeModal()}> |
| 54 | + |
| 55 | + <View style={styles.wrapper}> |
| 56 | + <View style={[styles.row,styles.header]}> |
| 57 | + <Icon |
| 58 | + name='ion|ios-gear' |
| 59 | + size={25} |
| 60 | + color='rgba(255,255,255,0.5)' |
| 61 | + style={styles.Icon}/> |
| 62 | + <Text style={styles.rowText}> |
| 63 | + 设置 |
| 64 | + </Text> |
| 65 | + </View> |
| 66 | + |
| 67 | + |
| 68 | + <TouchableOpacity onPress={this.onAboutPress.bind(this)}> |
| 69 | + <View style={[styles.row]}> |
| 70 | + <Icon |
| 71 | + name='ion|ios-eye' |
| 72 | + size={25} |
| 73 | + color='rgba(255,255,255,0.5)' |
| 74 | + style={styles.Icon}/> |
| 75 | + <Text style={styles.rowText}> |
| 76 | + 关于 |
| 77 | + </Text> |
| 78 | + </View> |
| 79 | + </TouchableOpacity> |
| 80 | + |
| 81 | + <TouchableOpacity onPress={this.onClearPress.bind(this)}> |
| 82 | + <View style={[styles.row]}> |
| 83 | + <Icon |
| 84 | + name='ion|ios-trash' |
| 85 | + size={22} |
| 86 | + color='rgba(255,255,255,0.5)' |
| 87 | + style={styles.Icon}/> |
| 88 | + <Text style={styles.rowText}> |
| 89 | + 清除缓存 |
| 90 | + </Text> |
| 91 | + </View> |
| 92 | + </TouchableOpacity> |
| 93 | + |
| 94 | + |
| 95 | + <TouchableOpacity onPress={this.onLogoutPress.bind(this)}> |
| 96 | + <View style={[styles.row]}> |
| 97 | + <Icon |
| 98 | + name='ion|power' |
| 99 | + size={20} |
| 100 | + color='#E74C3C' |
| 101 | + style={styles.Icon}/> |
| 102 | + <Text style={[styles.rowText,styles.logoutText]}> |
| 103 | + 退出 |
| 104 | + </Text> |
| 105 | + </View> |
| 106 | + </TouchableOpacity> |
| 107 | + |
| 108 | + </View> |
| 109 | + |
| 110 | + |
| 111 | + <TouchableOpacity onPress={() => this.props.closeModal()}> |
| 112 | + <Icon |
| 113 | + name='ion|ios-close-empty' |
| 114 | + size={34} |
| 115 | + color='rgba(255,255,255,0.9)' |
| 116 | + style={styles.closeIcon}/> |
| 117 | + </TouchableOpacity> |
| 118 | + </Modal> |
| 119 | + ) |
| 120 | + } |
| 121 | +} |
| 122 | + |
| 123 | + |
| 124 | +var styles = StyleSheet.create({ |
| 125 | + wrapper: { |
| 126 | + flexDirection: 'column', |
| 127 | + alignItems: 'center', |
| 128 | + justifyContent: 'center', |
| 129 | + backgroundColor: 'rgba(0,0,0,0.3)', |
| 130 | + borderRadius: 3, |
| 131 | + margin: 30, |
| 132 | + width: width - 30 * 2 |
| 133 | + }, |
| 134 | + row: { |
| 135 | + height: 40, |
| 136 | + flexDirection: 'row', |
| 137 | + justifyContent: 'flex-start', |
| 138 | + alignItems: 'center', |
| 139 | + borderRadius: 2, |
| 140 | + paddingLeft: 20, |
| 141 | + width: width - 30 * 2, |
| 142 | + backgroundColor: 'rgba(0,0,0,0.1)' |
| 143 | + }, |
| 144 | + rowText: { |
| 145 | + paddingLeft: 20, |
| 146 | + color: 'rgba(255,255,255,0.7)' |
| 147 | + }, |
| 148 | + logoutText: { |
| 149 | + color: '#E74C3C' |
| 150 | + }, |
| 151 | + header: { |
| 152 | + backgroundColor: 'rgba(0,0,0,0.5)' |
| 153 | + }, |
| 154 | + Icon: { |
| 155 | + height: 20, |
| 156 | + width: 20 |
| 157 | + }, |
| 158 | + closeIcon: { |
| 159 | + height: 30, |
| 160 | + width: 30, |
| 161 | + borderRadius: 30 / 2, |
| 162 | + borderColor: 'rgba(255,255,255,0.2)', |
| 163 | + borderWidth: 2 |
| 164 | + } |
| 165 | +}) |
| 166 | + |
| 167 | +var modalStyles = StyleSheet.create({ |
| 168 | + container: { |
| 169 | + position: 'absolute', |
| 170 | + top: 0, |
| 171 | + bottom: 0, |
| 172 | + left: 0, |
| 173 | + right: 0, |
| 174 | + backgroundColor: 'transparent', |
| 175 | + justifyContent: 'center', |
| 176 | + }, |
| 177 | + backdrop: { |
| 178 | + position: 'absolute', |
| 179 | + top: 0, |
| 180 | + bottom: 0, |
| 181 | + left: 0, |
| 182 | + right: 0, |
| 183 | + backgroundColor: '#000000', |
| 184 | + opacity: 0.5, |
| 185 | + }, |
| 186 | + modal: { |
| 187 | + flexDirection: 'column', |
| 188 | + alignItems: 'center', |
| 189 | + justifyContent: 'center' |
| 190 | + } |
| 191 | +}) |
| 192 | + |
| 193 | + |
| 194 | +module.exports = Setting |
0 commit comments