@quintype/native-components 2.30.9-beta.0 → 2.30.10-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/native-components",
3
- "version": "2.30.9-beta.0",
3
+ "version": "2.30.10-beta.0",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -2,7 +2,7 @@ import { decode as atob } from 'base-64';
2
2
  import get from 'lodash/get';
3
3
  import PropTypes from 'prop-types';
4
4
  import React, { useEffect, useRef, useState } from 'react';
5
- import { useWindowDimensions, View } from 'react-native';
5
+ import { useWindowDimensions, View, Linking, Platform } from 'react-native';
6
6
  import { WebView } from 'react-native-webview';
7
7
  import { STORY_ELEMENT_SUBTYPES } from '../../constants/cardConstants';
8
8
 
@@ -106,6 +106,15 @@ export const JSEmbedElement = (props) => {
106
106
  setHeight(parseInt(event.nativeEvent.data));
107
107
  };
108
108
 
109
+ const handleShouldStartLoadWithRequest = (request) => {
110
+ // Only intercept deliberate user link taps — let all programmatic/embed loads through
111
+ if (request.navigationType === 'click') {
112
+ Linking.openURL(request.url).catch(err => console.warn('JSEmbedElement: Failed to open URL:', err));
113
+ return false;
114
+ }
115
+ return true;
116
+ };
117
+
109
118
  const constructSource = () => {
110
119
  const html = getHTMLContent(props.element['embed-js']);
111
120
 
@@ -129,6 +138,7 @@ export const JSEmbedElement = (props) => {
129
138
  automaticallyAdjustContentInsets={false}
130
139
  scrollEnabled={false}
131
140
  onMessage={handleOnMessage}
141
+ onShouldStartLoadWithRequest={Platform.OS === 'ios' ? handleShouldStartLoadWithRequest : undefined}
132
142
  javaScriptEnabled
133
143
  domStorageEnabled
134
144
  startInLoadingState
@@ -159,6 +169,7 @@ export const JSEmbedElement = (props) => {
159
169
  automaticallyAdjustContentInsets={false}
160
170
  scrollEnabled={false}
161
171
  onMessage={handleOnMessage}
172
+ onShouldStartLoadWithRequest={Platform.OS === 'ios' ? handleShouldStartLoadWithRequest : undefined}
162
173
  javaScriptEnabled
163
174
  domStorageEnabled
164
175
  startInLoadingState