@mpxjs/webpack-plugin 2.10.1-beta.3 → 2.10.1-beta.4

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.
@@ -19,6 +19,7 @@ module.exports = function () {
19
19
  test: (input) => isOriginTag(input) || isBuildInTag(input),
20
20
  web: handleComponentTag,
21
21
  ios: handleComponentTag,
22
- android: handleComponentTag
22
+ android: handleComponentTag,
23
+ harmony: handleComponentTag
23
24
  }
24
25
  }
@@ -1,7 +1,7 @@
1
1
  import React, { forwardRef, useRef, useState, useMemo, useEffect, useCallback } from 'react';
2
2
  import { StyleSheet, View } from 'react-native';
3
3
  import Reanimated, { useAnimatedRef, useScrollViewOffset } from 'react-native-reanimated';
4
- import { useTransformStyle, splitStyle, splitProps, useLayout, usePrevious, isAndroid, isIOS } from './utils';
4
+ import { useTransformStyle, splitStyle, splitProps, useLayout, usePrevious, isAndroid, isIOS, isHarmony } from './utils';
5
5
  import useNodesRef from './useNodesRef';
6
6
  import PickerIndicator from './pickerViewIndicator';
7
7
  import PickerMask from './pickerViewMask';
@@ -81,7 +81,7 @@ const _PickerViewColumn = forwardRef((props, ref) => {
81
81
  y: initialIndex * itemRawH,
82
82
  animated: false
83
83
  });
84
- }, isAndroid ? 200 : 0);
84
+ }, isAndroid || isHarmony ? 200 : 0);
85
85
  activeIndex.current = initialIndex;
86
86
  }, [itemRawH, maxIndex, initialIndex]);
87
87
  const onContentSizeChange = useCallback((_w, h) => {
@@ -89,7 +89,7 @@ const _WebView = forwardRef((props, ref) => {
89
89
  return null;
90
90
  }
91
91
  const _reload = function () {
92
- if (__mpx_mode__ === 'android') {
92
+ if (__mpx_mode__ === 'android' || __mpx_mode__ === 'harmony') {
93
93
  fristLoaded.current = false; // 安卓需要重新设置
94
94
  }
95
95
  setPageLoadErr(false);
@@ -133,7 +133,7 @@ const _WebView = forwardRef((props, ref) => {
133
133
  }
134
134
  };
135
135
  const _onLoadProgress = function (event) {
136
- if (__mpx_mode__ === 'android') {
136
+ if (__mpx_mode__ === 'android' || __mpx_mode__ === 'harmony') {
137
137
  canGoBack.current = event.nativeEvent.canGoBack;
138
138
  }
139
139
  };
@@ -251,7 +251,7 @@ const _WebView = forwardRef((props, ref) => {
251
251
  }
252
252
  };
253
253
  const onLoadEnd = function (res) {
254
- if (__mpx_mode__ === 'android') {
254
+ if (__mpx_mode__ === 'android' || __mpx_mode__ === 'harmony') {
255
255
  setTimeout(() => {
256
256
  onLoadEndHandle(res);
257
257
  }, 0);
@@ -19,6 +19,7 @@ export const HIDDEN_STYLE = {
19
19
  };
20
20
  export const isIOS = __mpx_mode__ === 'ios';
21
21
  export const isAndroid = __mpx_mode__ === 'android';
22
+ export const isHarmony = __mpx_mode__ === 'harmony';
22
23
  const varDecRegExp = /^--/;
23
24
  const varUseRegExp = /var\(/;
24
25
  const unoVarDecRegExp = /^--un-/;
@@ -1,7 +1,7 @@
1
1
  import React, { forwardRef, useRef, useState, useMemo, useEffect, useCallback } from 'react'
2
2
  import { LayoutChangeEvent, NativeScrollEvent, NativeSyntheticEvent, ScrollView, StyleSheet, View } from 'react-native'
3
3
  import Reanimated, { AnimatedRef, useAnimatedRef, useScrollViewOffset } from 'react-native-reanimated'
4
- import { useTransformStyle, splitStyle, splitProps, useLayout, usePrevious, isAndroid, isIOS } from './utils'
4
+ import { useTransformStyle, splitStyle, splitProps, useLayout, usePrevious, isAndroid, isIOS, isHarmony } from './utils'
5
5
  import useNodesRef, { HandlerRef } from './useNodesRef'
6
6
  import PickerIndicator from './pickerViewIndicator'
7
7
  import PickerMask from './pickerViewMask'
@@ -140,7 +140,7 @@ const _PickerViewColumn = forwardRef<HandlerRef<ScrollView & View, ColumnProps>,
140
140
  y: initialIndex * itemRawH,
141
141
  animated: false
142
142
  })
143
- }, isAndroid ? 200 : 0)
143
+ }, isAndroid || isHarmony ? 200 : 0)
144
144
  activeIndex.current = initialIndex
145
145
  }, [itemRawH, maxIndex, initialIndex])
146
146
 
@@ -140,7 +140,7 @@ const _WebView = forwardRef<HandlerRef<WebView, WebViewProps>, WebViewProps>((pr
140
140
  }
141
141
 
142
142
  const _reload = function () {
143
- if (__mpx_mode__ === 'android') {
143
+ if (__mpx_mode__ === 'android' || __mpx_mode__ === 'harmony') {
144
144
  fristLoaded.current = false // 安卓需要重新设置
145
145
  }
146
146
  setPageLoadErr(false)
@@ -186,7 +186,7 @@ const _WebView = forwardRef<HandlerRef<WebView, WebViewProps>, WebViewProps>((pr
186
186
  }
187
187
 
188
188
  const _onLoadProgress = function (event: WebViewProgressEvent) {
189
- if (__mpx_mode__ === 'android') {
189
+ if (__mpx_mode__ === 'android' || __mpx_mode__ === 'harmony') {
190
190
  canGoBack.current = event.nativeEvent.canGoBack
191
191
  }
192
192
  }
@@ -302,7 +302,7 @@ const _WebView = forwardRef<HandlerRef<WebView, WebViewProps>, WebViewProps>((pr
302
302
  }
303
303
  }
304
304
  const onLoadEnd = function (res: WebViewEvent) {
305
- if (__mpx_mode__ === 'android') {
305
+ if (__mpx_mode__ === 'android' || __mpx_mode__ === 'harmony') {
306
306
  setTimeout(() => {
307
307
  onLoadEndHandle(res)
308
308
  }, 0)
@@ -1,4 +1,4 @@
1
- declare let __mpx_mode__: 'wx' | 'ali' | 'swan' | 'qq' | 'tt' | 'web' | 'dd' | 'qa' | 'jd' | 'android' | 'ios'
1
+ declare let __mpx_mode__: 'wx' | 'ali' | 'swan' | 'qq' | 'tt' | 'web' | 'dd' | 'qa' | 'jd' | 'android' | 'ios' | 'harmony'
2
2
  declare module '@mpxjs/utils' {
3
3
  export function isEmptyObject (obj: Object): boolean
4
4
  export function isFunction (fn: unknown): boolean
@@ -20,10 +20,11 @@ export const HIDDEN_STYLE = {
20
20
  opacity: 0
21
21
  }
22
22
 
23
- declare const __mpx_mode__: 'ios' | 'android'
23
+ declare const __mpx_mode__: 'ios' | 'android' | 'harmony'
24
24
 
25
25
  export const isIOS = __mpx_mode__ === 'ios'
26
26
  export const isAndroid = __mpx_mode__ === 'android'
27
+ export const isHarmony = __mpx_mode__ === 'harmony'
27
28
 
28
29
  const varDecRegExp = /^--/
29
30
  const varUseRegExp = /var\(/
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpxjs/webpack-plugin",
3
- "version": "2.10.1-beta.3",
3
+ "version": "2.10.1-beta.4",
4
4
  "description": "mpx compile core",
5
5
  "keywords": [
6
6
  "mpx"