|
@@ -1,8 +1,7 @@
|
|
|
import React, { useEffect, useRef, useState } from 'react';
|
|
import React, { useEffect, useRef, useState } from 'react';
|
|
|
-import { FlatList, Keyboard, Pressable, StyleSheet, Text, View } from 'react-native';
|
|
|
|
|
-import Modal from 'react-native-modal';
|
|
|
|
|
|
|
+import { FlatList, Keyboard, Pressable, StyleSheet, Modal, View, Text } from 'react-native';
|
|
|
import Button from './Button';
|
|
import Button from './Button';
|
|
|
-import Dialog, { getDialogWidth } from './Dialog';
|
|
|
|
|
|
|
+import Dialog from './Dialog';
|
|
|
import TextView from './TextView';
|
|
import TextView from './TextView';
|
|
|
import app from '../../app.json';
|
|
import app from '../../app.json';
|
|
|
|
|
|
|
@@ -169,25 +168,29 @@ export default Dropdown = ({
|
|
|
}
|
|
}
|
|
|
</Pressable>
|
|
</Pressable>
|
|
|
<Modal
|
|
<Modal
|
|
|
- isVisible={visible}
|
|
|
|
|
- onTouchOutside={() => showDialog(false)}
|
|
|
|
|
- onBackdropPress={() => showDialog(false)}
|
|
|
|
|
- onBackButtonPress={() => showDialog(false)}
|
|
|
|
|
- {...Dialog.modalProps}
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ visible={visible}
|
|
|
|
|
+ transparent={true}
|
|
|
|
|
+ animationType="fade"
|
|
|
|
|
+ statusBarTranslucent={true}>
|
|
|
<View style={styles.dialog}>
|
|
<View style={styles.dialog}>
|
|
|
- { title !== '' && <TextView style={styles.title}>{title}</TextView> }
|
|
|
|
|
- <FlatList
|
|
|
|
|
- data={list}
|
|
|
|
|
- ref={refFlat}
|
|
|
|
|
- renderItem={renderItem}
|
|
|
|
|
- initialScrollIndex={currentIndex}
|
|
|
|
|
- keyExtractor={(item, index) => index}
|
|
|
|
|
- style={{maxHeight: $vh(55)}}
|
|
|
|
|
- getItemLayout={(data, index) => (
|
|
|
|
|
- {length: itemHeight, offset: itemHeight * index, index}
|
|
|
|
|
- )}
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ <Text
|
|
|
|
|
+ style={StyleSheet.absoluteFillObject}
|
|
|
|
|
+ onPress={() => showDialog(false)}>
|
|
|
|
|
+ </Text>
|
|
|
|
|
+ <View style={styles.dialogContent}>
|
|
|
|
|
+ { title !== '' && <TextView style={styles.title}>{title}</TextView> }
|
|
|
|
|
+ <FlatList
|
|
|
|
|
+ data={list}
|
|
|
|
|
+ ref={refFlat}
|
|
|
|
|
+ renderItem={renderItem}
|
|
|
|
|
+ initialScrollIndex={currentIndex}
|
|
|
|
|
+ keyExtractor={(item, index) => index}
|
|
|
|
|
+ style={{maxHeight: $vh(55)}}
|
|
|
|
|
+ getItemLayout={(data, index) => (
|
|
|
|
|
+ {length: itemHeight, offset: itemHeight * index, index}
|
|
|
|
|
+ )}
|
|
|
|
|
+ />
|
|
|
|
|
+ </View>
|
|
|
</View>
|
|
</View>
|
|
|
</Modal>
|
|
</Modal>
|
|
|
</>
|
|
</>
|
|
@@ -196,7 +199,13 @@ export default Dropdown = ({
|
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
|
const styles = StyleSheet.create({
|
|
|
dialog: {
|
|
dialog: {
|
|
|
- width: getDialogWidth(),
|
|
|
|
|
|
|
+ flex: 1,
|
|
|
|
|
+ alignItems: 'center',
|
|
|
|
|
+ justifyContent: 'center',
|
|
|
|
|
+ backgroundColor: 'rgba(0,0,0,.6)'
|
|
|
|
|
+ },
|
|
|
|
|
+ dialogContent: {
|
|
|
|
|
+ width: Dialog.dialogWidth,
|
|
|
marginLeft: 'auto',
|
|
marginLeft: 'auto',
|
|
|
marginRight: 'auto',
|
|
marginRight: 'auto',
|
|
|
paddingTop: isIOS ? 12 : 8,
|
|
paddingTop: isIOS ? 12 : 8,
|