@quintype/native-components 2.22.5 → 2.22.7
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
|
@@ -64,7 +64,6 @@ const getHTMLContent = (embedJs) => {
|
|
|
64
64
|
<style>
|
|
65
65
|
iframe{
|
|
66
66
|
width:${width - 20}px;
|
|
67
|
-
height:${width - 20}px;
|
|
68
67
|
}
|
|
69
68
|
</style>
|
|
70
69
|
</head>
|
|
@@ -76,7 +75,7 @@ const getHTMLContent = (embedJs) => {
|
|
|
76
75
|
};
|
|
77
76
|
|
|
78
77
|
export const JSEmbedElement = (props) => {
|
|
79
|
-
const [height, setHeight] = useState(
|
|
78
|
+
const [height, setHeight] = useState(-1);
|
|
80
79
|
const webViewRef = useRef(null);
|
|
81
80
|
const width = get(
|
|
82
81
|
props,
|
|
@@ -107,13 +106,42 @@ export const JSEmbedElement = (props) => {
|
|
|
107
106
|
};
|
|
108
107
|
};
|
|
109
108
|
|
|
109
|
+
if (height > 0) {
|
|
110
|
+
return <View testID="embed-js">
|
|
111
|
+
<WebView
|
|
112
|
+
ref={webViewRef}
|
|
113
|
+
style={{
|
|
114
|
+
width,
|
|
115
|
+
height: Number(height),
|
|
116
|
+
flex: 0,
|
|
117
|
+
opacity: 0.99,
|
|
118
|
+
}}
|
|
119
|
+
automaticallyAdjustContentInsets={false}
|
|
120
|
+
scrollEnabled={false}
|
|
121
|
+
onMessage={handleOnMessage}
|
|
122
|
+
javaScriptEnabled
|
|
123
|
+
domStorageEnabled
|
|
124
|
+
startInLoadingState
|
|
125
|
+
allowsFullscreenVideo={false}
|
|
126
|
+
originWhitelist={['*']}
|
|
127
|
+
onError={(syntheticEvent) => {
|
|
128
|
+
const { nativeEvent } = syntheticEvent;
|
|
129
|
+
console.warn('WebView error: ', nativeEvent);
|
|
130
|
+
}}
|
|
131
|
+
source={constructSource()}
|
|
132
|
+
mixedContentMode="always"
|
|
133
|
+
mediaPlaybackRequiresUserAction={true}
|
|
134
|
+
/>
|
|
135
|
+
</View>
|
|
136
|
+
}
|
|
137
|
+
|
|
110
138
|
return (
|
|
111
139
|
<View testID="embed-js">
|
|
112
140
|
<WebView
|
|
113
141
|
ref={webViewRef}
|
|
114
142
|
style={{
|
|
115
143
|
width,
|
|
116
|
-
height,
|
|
144
|
+
height: Number(height),
|
|
117
145
|
flex: 0,
|
|
118
146
|
opacity: 0.99,
|
|
119
147
|
}}
|
|
@@ -132,6 +160,7 @@ export const JSEmbedElement = (props) => {
|
|
|
132
160
|
source={constructSource()}
|
|
133
161
|
mixedContentMode="always"
|
|
134
162
|
mediaPlaybackRequiresUserAction={true}
|
|
163
|
+
injectedJavaScript='window.ReactNativeWebView.postMessage(document.body.scrollHeight)'
|
|
135
164
|
/>
|
|
136
165
|
</View>
|
|
137
166
|
);
|