@mpxjs/webpack-plugin 2.10.1-beta.1 → 2.10.1-beta.10
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.
|
@@ -27,7 +27,7 @@ module.exports = function (script, {
|
|
|
27
27
|
output += `
|
|
28
28
|
import { getComponent } from ${stringifyRequest(loaderContext, optionProcessorPath)}
|
|
29
29
|
import { NavigationContainer, StackActions } from '@react-navigation/native'
|
|
30
|
-
${mode === 'ios' ? "import { createNativeStackNavigator } from '@react-navigation/native-stack'" : "import { createStackNavigator } from '@react-navigation/stack'"}
|
|
30
|
+
${mode === 'ios' ? "import { createNativeStackNavigator as createStackNavigator } from '@react-navigation/native-stack'" : "import { createStackNavigator } from '@react-navigation/stack'"}
|
|
31
31
|
import PortalHost from '@mpxjs/webpack-plugin/lib/runtime/components/react/dist/mpx-portal/portal-host'
|
|
32
32
|
import { useHeaderHeight } from '@react-navigation/elements';
|
|
33
33
|
import { SafeAreaProvider, useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
@@ -35,7 +35,7 @@ import { GestureHandlerRootView } from 'react-native-gesture-handler'
|
|
|
35
35
|
|
|
36
36
|
global.__navigationHelper = {
|
|
37
37
|
NavigationContainer: NavigationContainer,
|
|
38
|
-
createStackNavigator:
|
|
38
|
+
createStackNavigator: createStackNavigator,
|
|
39
39
|
useHeaderHeight: useHeaderHeight,
|
|
40
40
|
StackActions: StackActions,
|
|
41
41
|
GestureHandlerRootView: GestureHandlerRootView,
|
|
@@ -155,8 +155,8 @@ const _WebView = forwardRef((props, ref) => {
|
|
|
155
155
|
switch (type) {
|
|
156
156
|
case 'setTitle':
|
|
157
157
|
{ // case下不允许直接声明,包个块解决该问题
|
|
158
|
-
const title = postData._documentTitle;
|
|
159
|
-
if (title) {
|
|
158
|
+
const title = postData._documentTitle?.trim();
|
|
159
|
+
if (title !== undefined) {
|
|
160
160
|
navigation && navigation.setOptions({ title });
|
|
161
161
|
}
|
|
162
162
|
}
|
|
@@ -252,6 +252,7 @@ const _WebView = forwardRef((props, ref) => {
|
|
|
252
252
|
};
|
|
253
253
|
const onLoadEnd = function (res) {
|
|
254
254
|
if (__mpx_mode__ === 'android') {
|
|
255
|
+
res.persist();
|
|
255
256
|
setTimeout(() => {
|
|
256
257
|
onLoadEndHandle(res);
|
|
257
258
|
}, 0);
|
|
@@ -282,7 +283,7 @@ const _WebView = forwardRef((props, ref) => {
|
|
|
282
283
|
<View style={styles.loadErrorText}><Text style={{ fontSize: 14, color: '#999999' }}>{currentErrorText.text}</Text></View>
|
|
283
284
|
<View style={styles.loadErrorButton} onTouchEnd={_reload}><Text style={{ fontSize: 12, color: '#666666' }}>{currentErrorText.button}</Text></View>
|
|
284
285
|
</View>)
|
|
285
|
-
: (<WebView style={defaultWebViewStyle}
|
|
286
|
+
: (<WebView style={defaultWebViewStyle} source={{ uri: src }} ref={webViewRef} javaScriptEnabled={true} onNavigationStateChange={_changeUrl} onMessage={_message} injectedJavaScript={injectedJavaScript} onLoadProgress={_onLoadProgress} onLoadEnd={onLoadEnd} onHttpError={onHttpError} onError={onError} onLoadStart={onLoadStart} allowsBackForwardNavigationGestures={isLoaded}></WebView>)}
|
|
286
287
|
</Portal>);
|
|
287
288
|
});
|
|
288
289
|
_WebView.displayName = 'MpxWebview';
|
|
@@ -207,8 +207,8 @@ const _WebView = forwardRef<HandlerRef<WebView, WebViewProps>, WebViewProps>((pr
|
|
|
207
207
|
switch (type) {
|
|
208
208
|
case 'setTitle':
|
|
209
209
|
{ // case下不允许直接声明,包个块解决该问题
|
|
210
|
-
const title = postData._documentTitle
|
|
211
|
-
if (title) {
|
|
210
|
+
const title = postData._documentTitle?.trim()
|
|
211
|
+
if (title !== undefined) {
|
|
212
212
|
navigation && navigation.setOptions({ title })
|
|
213
213
|
}
|
|
214
214
|
}
|
|
@@ -303,6 +303,7 @@ const _WebView = forwardRef<HandlerRef<WebView, WebViewProps>, WebViewProps>((pr
|
|
|
303
303
|
}
|
|
304
304
|
const onLoadEnd = function (res: WebViewEvent) {
|
|
305
305
|
if (__mpx_mode__ === 'android') {
|
|
306
|
+
res.persist()
|
|
306
307
|
setTimeout(() => {
|
|
307
308
|
onLoadEndHandle(res)
|
|
308
309
|
}, 0)
|
|
@@ -338,7 +339,6 @@ const _WebView = forwardRef<HandlerRef<WebView, WebViewProps>, WebViewProps>((pr
|
|
|
338
339
|
)
|
|
339
340
|
: (<WebView
|
|
340
341
|
style={ defaultWebViewStyle }
|
|
341
|
-
pointerEvents={ isLoaded ? 'auto' : 'none' }
|
|
342
342
|
source={{ uri: src }}
|
|
343
343
|
ref={webViewRef}
|
|
344
344
|
javaScriptEnabled={true}
|
|
@@ -350,7 +350,7 @@ const _WebView = forwardRef<HandlerRef<WebView, WebViewProps>, WebViewProps>((pr
|
|
|
350
350
|
onHttpError={onHttpError}
|
|
351
351
|
onError={onError}
|
|
352
352
|
onLoadStart={onLoadStart}
|
|
353
|
-
allowsBackForwardNavigationGestures={
|
|
353
|
+
allowsBackForwardNavigationGestures={isLoaded}
|
|
354
354
|
></WebView>)}
|
|
355
355
|
</Portal>
|
|
356
356
|
)
|