fix: No interaction on Android webview (#59)

This commit is contained in:
Lei Nelissen
2022-05-04 16:55:32 +02:00
parent 1402ac06f6
commit 91eaa1d864

View File

@@ -1,6 +1,5 @@
import React, { useCallback } from 'react'; import React, { useCallback } from 'react';
import styled, { css } from 'styled-components/native'; import styled, { css } from 'styled-components/native';
import { Pressable } from 'react-native';
import { useNavigation, StackActions } from '@react-navigation/native'; import { useNavigation, StackActions } from '@react-navigation/native';
import useDefaultStyles from './Colors'; import useDefaultStyles from './Colors';
@@ -8,12 +7,12 @@ interface Props {
fullSize?: boolean; fullSize?: boolean;
} }
const Background = styled(Pressable)` const Background = styled.View`
flex: 1; flex: 1;
justify-content: center; justify-content: center;
`; `;
const Container = styled(Pressable)<Pick<Props, 'fullSize'>>` const Container = styled.View<Pick<Props, 'fullSize'>>`
margin: auto 20px; margin: auto 20px;
padding: 4px; padding: 4px;
border-radius: 12px; border-radius: 12px;
@@ -27,6 +26,10 @@ const Container = styled(Pressable)<Pick<Props, 'fullSize'>>`
`} `}
`; `;
const Spacer = styled.Pressable`
flex: 1;
`;
const Modal: React.FC<Props> = ({ children, fullSize = true }) => { const Modal: React.FC<Props> = ({ children, fullSize = true }) => {
const defaultStyles = useDefaultStyles(); const defaultStyles = useDefaultStyles();
const navigation = useNavigation(); const navigation = useNavigation();
@@ -35,10 +38,12 @@ const Modal: React.FC<Props> = ({ children, fullSize = true }) => {
}, [navigation]); }, [navigation]);
return ( return (
<Background style={defaultStyles.modal} onPress={closeModal}> <Background style={defaultStyles.modal}>
{!fullSize && <Spacer onPress={closeModal} />}
<Container style={defaultStyles.modalInner} fullSize={fullSize}> <Container style={defaultStyles.modalInner} fullSize={fullSize}>
{children} {children}
</Container> </Container>
{!fullSize && <Spacer onPress={closeModal} />}
</Background> </Background>
); );
}; };