2020-09-27 13:05:26 +05:00
|
|
|
import React from 'react';
|
2020-09-30 15:58:19 +05:00
|
|
|
import {
|
|
|
|
|
Animated,
|
|
|
|
|
Modal,
|
|
|
|
|
StyleSheet,
|
|
|
|
|
TouchableOpacity,
|
|
|
|
|
View,
|
|
|
|
|
} from 'react-native';
|
2020-09-27 13:05:26 +05:00
|
|
|
import {useTracked} from '../../provider';
|
|
|
|
|
|
2020-09-30 15:58:19 +05:00
|
|
|
const BaseDialog = ({
|
|
|
|
|
visible,
|
|
|
|
|
onRequestClose,
|
|
|
|
|
children,
|
|
|
|
|
onShow,
|
|
|
|
|
animation = 'fade',
|
2020-11-15 12:17:58 +05:00
|
|
|
premium
|
2020-09-30 15:58:19 +05:00
|
|
|
}) => {
|
2020-09-27 13:05:26 +05:00
|
|
|
const [state, dispatch] = useTracked();
|
2020-09-30 15:58:19 +05:00
|
|
|
const scaleValue = new Animated.Value(1);
|
|
|
|
|
|
2020-09-27 13:05:26 +05:00
|
|
|
return (
|
|
|
|
|
<Modal
|
|
|
|
|
visible={visible}
|
|
|
|
|
transparent={true}
|
|
|
|
|
animated
|
|
|
|
|
statusBarTranslucent
|
2020-09-30 15:58:19 +05:00
|
|
|
onShow={() => {
|
|
|
|
|
if (onShow) {
|
|
|
|
|
onShow();
|
|
|
|
|
}
|
|
|
|
|
}}
|
|
|
|
|
animationType={animation}
|
2020-09-27 13:05:26 +05:00
|
|
|
onRequestClose={onRequestClose}>
|
|
|
|
|
<View
|
|
|
|
|
style={[
|
|
|
|
|
{
|
|
|
|
|
backgroundColor: state.colors.night
|
|
|
|
|
? 'rgba(255,255,255,0.15)'
|
|
|
|
|
: 'rgba(0,0,0,0.3)',
|
|
|
|
|
},
|
|
|
|
|
styles.backdrop,
|
|
|
|
|
]}>
|
|
|
|
|
<TouchableOpacity
|
|
|
|
|
onPress={onRequestClose}
|
|
|
|
|
style={styles.overlayButton}
|
|
|
|
|
/>
|
2020-11-15 12:17:58 +05:00
|
|
|
{premium}
|
2020-09-30 15:58:19 +05:00
|
|
|
|
2020-09-27 13:05:26 +05:00
|
|
|
{children}
|
|
|
|
|
</View>
|
|
|
|
|
</Modal>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
|
|
|
|
backdrop: {
|
|
|
|
|
width: '100%',
|
|
|
|
|
height: '100%',
|
|
|
|
|
justifyContent: 'center',
|
|
|
|
|
alignItems: 'center',
|
|
|
|
|
},
|
|
|
|
|
overlayButton: {
|
|
|
|
|
width: '100%',
|
|
|
|
|
height: '100%',
|
|
|
|
|
position: 'absolute',
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export default BaseDialog;
|