Skip to content

Commit

Permalink
feat: create WebViewModal
Browse files Browse the repository at this point in the history
  • Loading branch information
timepresent95 committed Oct 11, 2024
1 parent f0424aa commit a7da2fa
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions src/entities/modal/WebViewModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { Image, Modal, StyleSheet } from 'react-native';
import { WebView, WebViewProps } from 'react-native-webview';

import SafeScreenWithHeader from '../safeScreen/SafeScreenWithHeader';

import { colors } from '@/constants';

type WebViewModalProps = {
visible: boolean;
close: () => void;
title?: string;
} & Required<Pick<WebViewProps, 'source'>>;

export default function WebViewModal({
visible,
source,
close,
title,
}: WebViewModalProps) {
return (
<Modal visible={visible} animationType="slide">
<SafeScreenWithHeader
safeAreaStyle={[styles.safeArea]}
scrollViewStyle={[styles.scroll]}
title={title}
right={{
onPress: close,
icon: (
<Image
source={require('@/assets/img/icon-x.png')}
className="h-5 w-5"
resizeMode="contain"
tintColor={colors.black}
/>
),
}}>
<WebView source={source} />
</SafeScreenWithHeader>
</Modal>
);
}

const styles = StyleSheet.create({
safeArea: {
flex: 1,
backgroundColor: colors.primary[8],
},
scroll: {
flexGrow: 1,
},
});

0 comments on commit a7da2fa

Please sign in to comment.