@mpxjs/webpack-plugin 2.10.0 → 2.10.1
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/lib/runtime/components/react/dist/event.config.js +1 -0
- package/lib/runtime/components/react/dist/getInnerListeners.js +7 -3
- package/lib/runtime/components/react/dist/mpx-scroll-view.jsx +1 -2
- package/lib/runtime/components/react/event.config.ts +2 -0
- package/lib/runtime/components/react/getInnerListeners.ts +7 -3
- package/lib/runtime/components/react/mpx-scroll-view.tsx +2 -2
- package/lib/template-compiler/compiler.js +5 -1
- package/package.json +3 -3
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export const TAP_EVENTS = ['bindtap', 'catchtap', 'capture-bindtap', 'capture-catchtap'];
|
|
1
2
|
const eventConfigMap = {
|
|
2
3
|
bindtap: { bitFlag: '0', events: ['onTouchStart', 'onTouchMove', 'onTouchEnd'] },
|
|
3
4
|
bindlongpress: { bitFlag: '1', events: ['onTouchStart', 'onTouchMove', 'onTouchEnd', 'onTouchCancel'] },
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useRef, useMemo } from 'react';
|
|
2
2
|
import { hasOwn, collectDataset } from '@mpxjs/utils';
|
|
3
3
|
import { omit, extendObject, useNavigation } from './utils';
|
|
4
|
-
import eventConfigMap from './event.config';
|
|
4
|
+
import eventConfigMap, { TAP_EVENTS } from './event.config';
|
|
5
5
|
const globalEventState = {
|
|
6
6
|
needPress: true
|
|
7
7
|
};
|
|
@@ -136,11 +136,15 @@ function handleTouchmove(e, type, ref, propsRef, config, navigation) {
|
|
|
136
136
|
];
|
|
137
137
|
const currentTouchEvent = type === 'bubble' ? bubbleTouchEvent : captureTouchEvent;
|
|
138
138
|
handleEmitEvent(currentTouchEvent, 'touchmove', e, propsRef, config, navigation);
|
|
139
|
-
|
|
139
|
+
if (TAP_EVENTS.some(eventName => propsRef.current[eventName])) {
|
|
140
|
+
checkIsNeedPress(e, type, ref);
|
|
141
|
+
}
|
|
140
142
|
}
|
|
141
143
|
function handleTouchend(e, type, ref, propsRef, config, navigation) {
|
|
142
144
|
// move event may not be triggered
|
|
143
|
-
|
|
145
|
+
if (TAP_EVENTS.some(eventName => propsRef.current[eventName])) {
|
|
146
|
+
checkIsNeedPress(e, type, ref);
|
|
147
|
+
}
|
|
144
148
|
const bubbleTouchEvent = ['catchtouchend', 'bindtouchend'];
|
|
145
149
|
const bubbleTapEvent = ['catchtap', 'bindtap'];
|
|
146
150
|
const captureTouchEvent = [
|
|
@@ -31,8 +31,7 @@
|
|
|
31
31
|
* ✔ bindscrolltolower
|
|
32
32
|
* ✔ bindscroll
|
|
33
33
|
*/
|
|
34
|
-
import { ScrollView } from 'react-native-gesture-handler';
|
|
35
|
-
import { RefreshControl } from 'react-native';
|
|
34
|
+
import { ScrollView, RefreshControl } from 'react-native-gesture-handler';
|
|
36
35
|
import { useRef, useState, useEffect, forwardRef, useContext, createElement, useMemo } from 'react';
|
|
37
36
|
import { useAnimatedRef } from 'react-native-reanimated';
|
|
38
37
|
import { warn } from '@mpxjs/utils';
|
|
@@ -2,6 +2,8 @@ interface EventConfig {
|
|
|
2
2
|
[key: string]: string[];
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
+
export const TAP_EVENTS = ['bindtap', 'catchtap', 'capture-bindtap', 'capture-catchtap']
|
|
6
|
+
|
|
5
7
|
const eventConfigMap: { [key: string]: { bitFlag: string; events: string[] } } = {
|
|
6
8
|
bindtap: { bitFlag: '0', events: ['onTouchStart', 'onTouchMove', 'onTouchEnd'] },
|
|
7
9
|
bindlongpress: { bitFlag: '1', events: ['onTouchStart', 'onTouchMove', 'onTouchEnd', 'onTouchCancel'] },
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useRef, useMemo, RefObject } from 'react'
|
|
2
2
|
import { hasOwn, collectDataset } from '@mpxjs/utils'
|
|
3
3
|
import { omit, extendObject, useNavigation } from './utils'
|
|
4
|
-
import eventConfigMap from './event.config'
|
|
4
|
+
import eventConfigMap, { TAP_EVENTS } from './event.config'
|
|
5
5
|
import {
|
|
6
6
|
Props,
|
|
7
7
|
AdditionalProps,
|
|
@@ -197,12 +197,16 @@ function handleTouchmove (e: NativeTouchEvent, type: 'bubble' | 'capture', ref:
|
|
|
197
197
|
const currentTouchEvent =
|
|
198
198
|
type === 'bubble' ? bubbleTouchEvent : captureTouchEvent
|
|
199
199
|
handleEmitEvent(currentTouchEvent, 'touchmove', e, propsRef, config, navigation)
|
|
200
|
-
|
|
200
|
+
if (TAP_EVENTS.some(eventName => propsRef.current[eventName])) {
|
|
201
|
+
checkIsNeedPress(e, type, ref)
|
|
202
|
+
}
|
|
201
203
|
}
|
|
202
204
|
|
|
203
205
|
function handleTouchend (e: NativeTouchEvent, type: 'bubble' | 'capture', ref: RefObject<InnerRef>, propsRef: Record<string, any>, config: UseInnerPropsConfig, navigation: Navigation) {
|
|
204
206
|
// move event may not be triggered
|
|
205
|
-
|
|
207
|
+
if (TAP_EVENTS.some(eventName => propsRef.current[eventName])) {
|
|
208
|
+
checkIsNeedPress(e, type, ref)
|
|
209
|
+
}
|
|
206
210
|
const bubbleTouchEvent = ['catchtouchend', 'bindtouchend']
|
|
207
211
|
const bubbleTapEvent = ['catchtap', 'bindtap']
|
|
208
212
|
const captureTouchEvent = [
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
* ✔ bindscrolltolower
|
|
32
32
|
* ✔ bindscroll
|
|
33
33
|
*/
|
|
34
|
-
import { ScrollView } from 'react-native-gesture-handler'
|
|
35
|
-
import { View,
|
|
34
|
+
import { ScrollView, RefreshControl } from 'react-native-gesture-handler'
|
|
35
|
+
import { View, NativeSyntheticEvent, NativeScrollEvent, LayoutChangeEvent, ViewStyle } from 'react-native'
|
|
36
36
|
import { JSX, ReactNode, RefObject, useRef, useState, useEffect, forwardRef, useContext, createElement, useMemo } from 'react'
|
|
37
37
|
import { useAnimatedRef } from 'react-native-reanimated'
|
|
38
38
|
import { warn } from '@mpxjs/utils'
|
|
@@ -1832,9 +1832,13 @@ function processRefReact (el, meta) {
|
|
|
1832
1832
|
selectors.push({ prefix: '', selector: `"${refConf.key}"` })
|
|
1833
1833
|
}
|
|
1834
1834
|
const selectorsConf = selectors.map(item => `["${item.prefix}", ${item.selector}]`)
|
|
1835
|
+
const refFnId = forScopes.reduce((preV, curV) => {
|
|
1836
|
+
return `${preV} + "_" + ${curV.index}`
|
|
1837
|
+
}, `"ref_fn_${++refId}"`)
|
|
1838
|
+
|
|
1835
1839
|
addAttrs(el, [{
|
|
1836
1840
|
name: 'ref',
|
|
1837
|
-
value: `{{ this.__getRefVal('${type}', [${selectorsConf}],
|
|
1841
|
+
value: `{{ this.__getRefVal('${type}', [${selectorsConf}], ${refFnId}) }}`
|
|
1838
1842
|
}])
|
|
1839
1843
|
}
|
|
1840
1844
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/webpack-plugin",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.1",
|
|
4
4
|
"description": "mpx compile core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mpx"
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"devDependencies": {
|
|
85
85
|
"@ant-design/react-native": "^5.2.2",
|
|
86
86
|
"@d11/react-native-fast-image": "^8.6.12",
|
|
87
|
-
"@mpxjs/api-proxy": "^2.10.
|
|
87
|
+
"@mpxjs/api-proxy": "^2.10.1",
|
|
88
88
|
"@types/babel-traverse": "^6.25.4",
|
|
89
89
|
"@types/babel-types": "^7.0.4",
|
|
90
90
|
"@types/react": "^18.2.79",
|
|
@@ -101,5 +101,5 @@
|
|
|
101
101
|
"engines": {
|
|
102
102
|
"node": ">=14.14.0"
|
|
103
103
|
},
|
|
104
|
-
"gitHead": "
|
|
104
|
+
"gitHead": "7e4f9ab5528f1ab0ae08fdfad1bfbbb445088848"
|
|
105
105
|
}
|