Skip to content

Commit

Permalink
chore: err handling, modal fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sandipndev committed Dec 5, 2023
1 parent bc5d850 commit 7799b2e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
6 changes: 3 additions & 3 deletions app/components/custom-modal/custom-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ const CustomModal: React.FC<CustomModalProps> = ({
return (
<Modal
isVisible={isVisible}
backdropOpacity={0.7}
backdropColor={colors.grey3}
backdropOpacity={0.8}
backdropColor={colors.white}
backdropTransitionOutTiming={0}
avoidKeyboard={true}
>
Expand Down Expand Up @@ -128,7 +128,7 @@ type UseStylesProps = {

const useStyles = makeStyles(({ colors }, props: UseStylesProps) => ({
container: {
backgroundColor: colors.white,
backgroundColor: colors.grey5,
maxHeight: "95%",
minHeight: props.minHeight || "auto",
borderRadius: 16,
Expand Down
9 changes: 8 additions & 1 deletion app/screens/webview/webview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ type Props = {
export const WebViewScreen: React.FC<Props> = ({ route }) => {
const styles = useStyles()

const { navigate } = useNavigation<StackNavigationProp<RootStackParamList, "Primary">>()
const { navigate, goBack } =
useNavigation<StackNavigationProp<RootStackParamList, "Primary">>()
const { url, initialTitle, injectedJavaScript, overrideBackToNavigationBack } =
route.params
const { LL } = useI18nContext()
Expand Down Expand Up @@ -72,6 +73,12 @@ export const WebViewScreen: React.FC<Props> = ({ route }) => {
}
}}
onNavigationStateChange={handleWebViewNavigationStateChange}
onError={(e) => {
if (e.nativeEvent.description === "net::ERR_INTERNET_DISCONNECTED") {
Alert.alert("We need internet for Point of Sale to work")
goBack()
}
}}
onMessage={onMessageHandler(webview as React.MutableRefObject<WebView>, {
enable: async () => {
/* Your implementation goes here */
Expand Down

0 comments on commit 7799b2e

Please sign in to comment.