-
Notifications
You must be signed in to change notification settings - Fork 3
/
SettingsComponent.tsx
55 lines (48 loc) · 2.03 KB
/
SettingsComponent.tsx
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
import React, { useState } from 'react';
import { View, TextInput, TouchableOpacity, StyleSheet, ScrollView} from 'react-native';
import { Divider, Text } from 'react-native-paper';
import Modal from "react-native-modal";
const SettingsComponent = ({settingsOptions} : any) => {
const [isModalVisible, setIsModalVisible] = useState(false);
return (
<ScrollView>
{settingsOptions.map(({title,onPress}:any) => (
<View key={title}>
<TouchableOpacity onPress={() => {
onPress();
setIsModalVisible(!isModalVisible);
}}>
<View
style={{
paddingHorizontal: 20,
paddingBottom: 25,
paddingTop: 25,
}}>
<Text style={{fontSize: 17}}>{title}</Text>
</View>
<Modal isVisible={isModalVisible}
animationIn={"fadeIn"}
animationInTiming={200}
animationOut={"fadeOut"}
animationOutTiming={200}
onBackdropPress={() => {
setIsModalVisible(!isModalVisible);
}}
backdropColor='#ADADAD'
backdropOpacity={0.1}>
<View style={{
flex: 1,
backgroundColor: "#FFFFFF",
width: '80%',
}}>
<Text>I am the modal content!</Text>
</View>
</Modal>
</TouchableOpacity>
<Divider style={{backgroundColor:"#737373"}}/>
</View>
))}
</ScrollView>
);
}
export default SettingsComponent;