Skip to content

Commit a7336e3

Browse files
author
ignaciosantise
committed
fix: opening links in new window
1 parent 6d14d9c commit a7336e3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/email/src/W3mEmailWebview.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useSnapshot } from 'valtio';
22
import { useEffect, useRef, useState } from 'react';
3-
import { Animated, Appearance, Platform, SafeAreaView, StyleSheet } from 'react-native';
3+
import { Animated, Appearance, Linking, Platform, SafeAreaView, StyleSheet } from 'react-native';
44
import { WebView, type WebViewMessageEvent } from 'react-native-webview';
55

66
import {
@@ -126,6 +126,11 @@ export function EmailWebview() {
126126
containerStyle={styles.webview}
127127
injectedJavaScript={W3mFrameConstants.FRAME_MESSAGES_HANDLER}
128128
ref={webviewRef}
129+
onOpenWindow={syntheticEvent => {
130+
const { nativeEvent } = syntheticEvent;
131+
const { targetUrl } = nativeEvent;
132+
Linking.openURL(targetUrl);
133+
}}
129134
onLoadStart={() => {
130135
ConnectorController.setEmailLoading(true);
131136
}}

0 commit comments

Comments
 (0)