Repository navigation
Expand file tree
/
Copy pathChapterModal.js
More file actions
89 lines (85 loc) · 1.89 KB
/
Copy pathChapterModal.js
File metadata and controls
89 lines (85 loc) · 1.89 KB
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
import React from "react";
import {
Modal,
View,
Text,
StyleSheet,
Button,
ScrollView,
TouchableOpacity,
} from "react-native";
const ChapterModal = ({ visible, onClose, chapters, onSelectChapter }) => {
return (
<Modal
animationType="slide"
transparent={true}
visible={visible}
onRequestClose={onClose}
>
<View style={styles.centeredView}>
<View style={styles.modalView}>
<Text style={styles.titleText}>Go To ...</Text>
<ScrollView style={styles.scrollView}>
{Object.entries(chapters).map(([chapter, lineNumber]) => (
<TouchableOpacity
key={chapter}
style={styles.chapterItem}
onPress={() => {
onSelectChapter(lineNumber);
}}
>
<Text style={styles.modalText}>Chapter {chapter}</Text>
</TouchableOpacity>
))}
</ScrollView>
<Button onPress={onClose} title="Close" color="#2196F3" />
</View>
</View>
</Modal>
);
};
const styles = StyleSheet.create({
centeredView: {
flex: 1,
justifyContent: "center",
alignItems: "center",
marginTop: 22,
},
modalView: {
backgroundColor: "white",
borderRadius: 20,
padding: 10,
alignItems: "center",
shadowColor: "#000",
shadowOffset: {
width: 0,
height: 2,
},
shadowOpacity: 0.25,
shadowRadius: 4,
elevation: 5,
width: "80%",
maxHeight: "80%",
},
chapterItem: {
width: "100%",
borderBottomWidth: 1,
borderBottomColor: "#ddd",
},
modalText: {
fontSize: 15,
marginTop: 10,
marginBottom: 10,
textAlign: "center",
fontFamily: "Menlo",
},
scrollView: {
width: "100%",
},
titleText: {
fontFamily: "Menlo",
fontSize: 25,
padding: 10,
},
});
export default ChapterModal;