@tarojs/components-rn 3.6.22-nightly.5 → 3.6.22-nightly.6
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/dist/components/Image/index.js +109 -132
- package/dist/components/Image/index.js.map +1 -1
- package/dist/components/View/index.js +29 -8
- package/dist/components/View/index.js.map +1 -1
- package/dist/components/hooks/PropsType.js +2 -0
- package/dist/components/hooks/PropsType.js.map +1 -0
- package/dist/components/hooks/useClickable.js +154 -0
- package/dist/components/hooks/useClickable.js.map +1 -0
- package/package.json +2 -2
|
@@ -15,8 +15,9 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import * as React from 'react';
|
|
17
17
|
import { Image, StyleSheet } from 'react-native';
|
|
18
|
-
import {
|
|
19
|
-
import
|
|
18
|
+
import { omit } from '../../utils';
|
|
19
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
20
|
+
import useClickable from '../hooks/useClickable';
|
|
20
21
|
// fix: https://github.com/facebook/metro/issues/836
|
|
21
22
|
// 保证 react-native-svg 是最后一个依赖
|
|
22
23
|
const omitProp = (props) => {
|
|
@@ -39,147 +40,123 @@ try {
|
|
|
39
40
|
WithLocalSvg = svg.WithLocalSvg;
|
|
40
41
|
}
|
|
41
42
|
catch (e) { }
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}, () => {
|
|
66
|
-
onLoad({
|
|
67
|
-
detail: { width: 0, height: 0 }
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
const iras = Image.resolveAssetSource(typeof src === 'string' ? { uri: src } : src);
|
|
73
|
-
const { width, height } = iras || { width: 0, height: 0 };
|
|
43
|
+
const _Image = (props = {
|
|
44
|
+
src: '',
|
|
45
|
+
mode: 'scaleToFill'
|
|
46
|
+
}) => {
|
|
47
|
+
const ref = useRef({
|
|
48
|
+
hasLayout: false
|
|
49
|
+
});
|
|
50
|
+
const [ratio, setRatio] = useState(0);
|
|
51
|
+
const [layoutWidth, setLayoutWidth] = useState(0);
|
|
52
|
+
const newProps = useClickable(props);
|
|
53
|
+
const { style, src, mode = 'scaleToFill', svg = false, onLoad, onError } = newProps;
|
|
54
|
+
const _onError = useCallback(() => {
|
|
55
|
+
if (!onError)
|
|
56
|
+
return;
|
|
57
|
+
onError({
|
|
58
|
+
detail: { errMsg: 'something wrong' }
|
|
59
|
+
});
|
|
60
|
+
}, [onError]);
|
|
61
|
+
const _onLoad = useCallback(() => {
|
|
62
|
+
if (!onLoad)
|
|
63
|
+
return;
|
|
64
|
+
if (typeof src === 'string') {
|
|
65
|
+
Image.getSize(src, (width, height) => {
|
|
74
66
|
onLoad({
|
|
75
67
|
detail: { width, height }
|
|
76
68
|
});
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
const { mode, style } = this.props;
|
|
81
|
-
const { width: layoutWidth } = event.nativeEvent.layout;
|
|
82
|
-
const flattenStyle = StyleSheet.flatten(style) || {};
|
|
83
|
-
if (mode === 'widthFix' && typeof flattenStyle.width === 'string') {
|
|
84
|
-
if (this.hasLayout)
|
|
85
|
-
return;
|
|
86
|
-
this.setState({
|
|
87
|
-
layoutWidth
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
if (this.state.ratio) {
|
|
91
|
-
this.hasLayout = true;
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
this.loadImg = (props) => {
|
|
95
|
-
const { mode, src } = props;
|
|
96
|
-
if (mode !== 'widthFix')
|
|
97
|
-
return;
|
|
98
|
-
if (typeof src === 'string') {
|
|
99
|
-
Image.getSize(props.src, (width, height) => {
|
|
100
|
-
if (this.hasLayout)
|
|
101
|
-
return;
|
|
102
|
-
this.setState({
|
|
103
|
-
ratio: height / width
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
const source = typeof props.src === 'string' ? { uri: props.src } : props.src;
|
|
109
|
-
const { width, height } = Image.resolveAssetSource(source) || {};
|
|
110
|
-
if (this.hasLayout && !!this.state.ratio)
|
|
111
|
-
return;
|
|
112
|
-
this.setState({
|
|
113
|
-
ratio: height / width
|
|
69
|
+
}, () => {
|
|
70
|
+
onLoad({
|
|
71
|
+
detail: { width: 0, height: 0 }
|
|
114
72
|
});
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
componentDidMount() {
|
|
119
|
-
this.loadImg(this.props);
|
|
120
|
-
}
|
|
121
|
-
shouldComponentUpdate(nextProps) {
|
|
122
|
-
if (nextProps.src !== this.props.src) {
|
|
123
|
-
this.hasLayout = false;
|
|
73
|
+
});
|
|
124
74
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
75
|
+
else {
|
|
76
|
+
const iras = Image.resolveAssetSource(typeof src === 'string' ? { uri: src } : src);
|
|
77
|
+
const { width, height } = iras || { width: 0, height: 0 };
|
|
78
|
+
onLoad({
|
|
79
|
+
detail: { width, height }
|
|
80
|
+
});
|
|
130
81
|
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
const {
|
|
82
|
+
}, [onLoad]);
|
|
83
|
+
const onLayout = (event) => {
|
|
84
|
+
const { width: layoutWidth } = event.nativeEvent.layout;
|
|
134
85
|
const flattenStyle = StyleSheet.flatten(style) || {};
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
if (SvgCssUri && typeof src === 'string' && remoteSvgReg.test(src)) {
|
|
140
|
-
return (React.createElement(SvgCssUri, { uri: src, width: defaultWidth, height: defaultHeight }));
|
|
86
|
+
if (mode === 'widthFix' && typeof flattenStyle.width === 'string') {
|
|
87
|
+
if (ref.current.hasLayout)
|
|
88
|
+
return;
|
|
89
|
+
setLayoutWidth(layoutWidth);
|
|
141
90
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
91
|
+
if (ratio) {
|
|
92
|
+
ref.current.hasLayout = true;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
const loadImg = useCallback((props) => {
|
|
96
|
+
if (mode !== 'widthFix')
|
|
97
|
+
return;
|
|
98
|
+
if (typeof src === 'string') {
|
|
99
|
+
Image.getSize(props.src, (width, height) => {
|
|
100
|
+
if (ref.current.hasLayout)
|
|
101
|
+
return;
|
|
102
|
+
setRatio(height / width);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
const source = typeof props.src === 'string' ? { uri: props.src } : props.src;
|
|
107
|
+
const { width, height } = Image.resolveAssetSource(source) || {};
|
|
108
|
+
if (ref.current.hasLayout && !!ratio)
|
|
109
|
+
return;
|
|
110
|
+
setRatio(height / width);
|
|
147
111
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
112
|
+
}, [mode, src, ref]);
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
ref.current.hasLayout = false;
|
|
115
|
+
loadImg(props);
|
|
116
|
+
}, [props.src, ref]);
|
|
117
|
+
const flattenStyle = StyleSheet.flatten(style) || {};
|
|
118
|
+
const defaultWidth = flattenStyle.width || 300;
|
|
119
|
+
const defaultHeight = flattenStyle.height || 225;
|
|
120
|
+
// remote svg image support, svg 图片暂不支持 mode
|
|
121
|
+
const remoteSvgReg = /(https?:\/\/.*\.(?:svg|svgx))/i;
|
|
122
|
+
if (SvgCssUri && typeof src === 'string' && remoteSvgReg.test(src)) {
|
|
123
|
+
return (React.createElement(SvgCssUri, { uri: src, width: defaultWidth, height: defaultHeight }));
|
|
124
|
+
}
|
|
125
|
+
// The parameter passed to require mpxTransformust be a string literal
|
|
126
|
+
const source = typeof src === 'string' ? { uri: src } : src;
|
|
127
|
+
// local svg image support, svg 图片暂不支持 mode
|
|
128
|
+
if (WithLocalSvg && svg) {
|
|
129
|
+
return (React.createElement(WithLocalSvg, { asset: source, width: defaultWidth, height: defaultHeight }));
|
|
130
|
+
}
|
|
131
|
+
const isWidthFix = mode === 'widthFix';
|
|
132
|
+
const rMode = (resizeModeMap[mode] || (isWidthFix ? undefined : 'stretch'));
|
|
133
|
+
const imageHeight = (() => {
|
|
134
|
+
if (isWidthFix) {
|
|
135
|
+
if (typeof flattenStyle.width === 'string') {
|
|
136
|
+
return layoutWidth * ratio;
|
|
137
|
+
}
|
|
138
|
+
else if (typeof flattenStyle.width === 'number') {
|
|
139
|
+
return flattenStyle.width * ratio;
|
|
161
140
|
}
|
|
162
141
|
else {
|
|
163
|
-
return
|
|
142
|
+
return 300 * ratio;
|
|
164
143
|
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
mode: 'scaleToFill'
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
return defaultHeight;
|
|
147
|
+
}
|
|
148
|
+
})();
|
|
149
|
+
const restImageProps = omitProp(newProps);
|
|
150
|
+
return (React.createElement(Image, Object.assign({ testID: 'image', source: source, resizeMode: rMode, onError: _onError, onLoad: _onLoad, onLayout: onLayout, style: [
|
|
151
|
+
{
|
|
152
|
+
width: 300
|
|
153
|
+
},
|
|
154
|
+
style,
|
|
155
|
+
{
|
|
156
|
+
height: imageHeight
|
|
157
|
+
}
|
|
158
|
+
] }, restImageProps)));
|
|
181
159
|
};
|
|
182
|
-
|
|
183
|
-
export default
|
|
184
|
-
// export default _Image
|
|
160
|
+
export { _Image };
|
|
161
|
+
export default _Image;
|
|
185
162
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Image/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Image/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,KAAK,EAAE,UAAU,EAAoE,MAAM,cAAc,CAAA;AAClH,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAElC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChE,OAAO,YAAY,MAAM,uBAAuB,CAAA;AAGhD,oDAAoD;AACpD,8BAA8B;AAC9B,MAAM,QAAQ,GAAG,CAAC,KAAK,EAAE,EAAE;IACzB,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,CAAA;AAC/F,CAAC,CAAA;AAED,MAAM,aAAa,GAAkB;IACnC,WAAW,EAAE,SAAS;IACtB,SAAS,EAAE,SAAS;IACpB,UAAU,EAAE,OAAO;IACnB,MAAM,EAAE,QAAQ;IAChB,eAAe;IACf,yBAAyB;CAC1B,CAAA;AAED,IAAI,SAAS,EAAE,YAAY,CAAA;AAC3B,+BAA+B;AAC/B,IAAI;IACF,8DAA8D;IAC9D,MAAM,GAAG,GAAG,OAAO,CAAC,kBAAkB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AK,EAAE;YACL;gBACE,KAAK,EAAE,GAAG;aACX;YACD,KAAK;YACL;gBACE,MAAM,EAAE,WAAW;aACpB;SACF,IACG,cAAc,EAClB,CACH,CAAA;AACH,CAAC,CAAA;AAED,OAAO,EAAE,MAAM,EAAE,CAAA;AACjB,eAAe,MAAM,CAAA"}
|
|
@@ -7,19 +7,40 @@
|
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
import { View, Text, } from 'react-native';
|
|
9
9
|
import { extracteTextStyle, omit } from '../../utils';
|
|
10
|
-
import
|
|
10
|
+
import useClickable, { clickableHandlers } from '../hooks/useClickable';
|
|
11
11
|
const stringToText = (child, props) => {
|
|
12
12
|
// TODO: 实现小程序中效果
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
if (typeof child === 'string' || typeof child === 'number') {
|
|
14
|
+
// textNode节点
|
|
15
|
+
return React.createElement(Text, Object.assign({}, omit(props, clickableHandlers)), child);
|
|
16
|
+
}
|
|
17
|
+
return child;
|
|
18
|
+
};
|
|
19
|
+
// 兼容View中没用Text包裹的文字 防止报错 直接继承props在安卓中文字会消失???
|
|
20
|
+
const renderChildren = (children, props) => {
|
|
21
|
+
let textStyle = null;
|
|
22
|
+
if (Array.isArray(children)) {
|
|
23
|
+
return children.map((child, i) => {
|
|
24
|
+
if ((typeof child === 'string' || typeof child === 'number') && !textStyle) {
|
|
25
|
+
// 存在textNode,解析textStyle
|
|
26
|
+
textStyle = extracteTextStyle(props.style);
|
|
27
|
+
}
|
|
28
|
+
return stringToText(child, Object.assign(Object.assign({ key: i }, props), { style: textStyle }));
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
if ((typeof children === 'string' || typeof children === 'number') && !textStyle) {
|
|
33
|
+
// 存在textNode,解析textStyle
|
|
34
|
+
textStyle = extracteTextStyle(props.style);
|
|
35
|
+
}
|
|
36
|
+
return stringToText(children, Object.assign(Object.assign({}, props), { style: textStyle }));
|
|
37
|
+
}
|
|
15
38
|
};
|
|
16
39
|
const _View = React.forwardRef((props, ref) => {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
const child = Array.isArray(props.children) ? props.children.map((c, i) => stringToText(c, Object.assign(Object.assign({ key: i }, props), { style: textStyle }))) : stringToText(props.children, Object.assign(Object.assign({}, props), { style: textStyle }));
|
|
20
|
-
return (React.createElement(View, Object.assign({ ref: ref, style: props.style }, props), child));
|
|
40
|
+
const clickable = useClickable(props); // 性能优化:从HOC替换成hooks,减少一层组件实例
|
|
41
|
+
return (React.createElement(View, Object.assign({ ref: ref }, clickable), renderChildren(props.children, props)));
|
|
21
42
|
});
|
|
22
43
|
_View.displayName = '_View';
|
|
23
44
|
export { _View };
|
|
24
|
-
export default
|
|
45
|
+
export default _View;
|
|
25
46
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/View/index.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EACL,IAAI,EACJ,IAAI,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/View/index.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EACL,IAAI,EACJ,IAAI,GAGL,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAErD,OAAO,YAAY,EAAE,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAGvE,MAAM,YAAY,GAAG,CAAC,KAAU,EAAE,KAAU,EAAE,EAAE;IAC9C,iBAAiB;IACjB,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC1D,aAAa;QACb,OAAO,oBAAC,IAAI,oBAAK,IAAI,CAAC,KAAK,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CAAC,CACjC,CACR,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,KAAK,CAAC,WAAW,GAAG,OAAO,CAAA;AAE3B,OAAO,EAAE,KAAK,EAAE,CAAA;AAChB,eAAe,KAAK,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PropsType.js","sourceRoot":"","sources":["../../../src/components/hooks/PropsType.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { PanResponder } from 'react-native';
|
|
3
|
+
import { omit } from '../../utils';
|
|
4
|
+
export const clickableHandlers = [
|
|
5
|
+
'onStartShouldSetResponder',
|
|
6
|
+
'onMoveShouldSetResponder',
|
|
7
|
+
'onResponderEnd',
|
|
8
|
+
'onResponderGrant',
|
|
9
|
+
'onResponderReject',
|
|
10
|
+
'onResponderMove',
|
|
11
|
+
'onResponderRelease',
|
|
12
|
+
'onResponderStart',
|
|
13
|
+
'onResponderStart',
|
|
14
|
+
'onResponderTerminationRequest',
|
|
15
|
+
'onResponderTerminate',
|
|
16
|
+
'onMoveShouldSetResponderCapture',
|
|
17
|
+
];
|
|
18
|
+
const getWxAppEvent = (event) => {
|
|
19
|
+
const nativeEvent = event.nativeEvent;
|
|
20
|
+
const { timestamp, target, pageX, pageY, touches = [], changedTouches = [] } = nativeEvent;
|
|
21
|
+
return {
|
|
22
|
+
type: 'tap',
|
|
23
|
+
timeStamp: timestamp,
|
|
24
|
+
target: {
|
|
25
|
+
id: target,
|
|
26
|
+
dataset: {}
|
|
27
|
+
},
|
|
28
|
+
currentTarget: {
|
|
29
|
+
id: target,
|
|
30
|
+
dataset: {}
|
|
31
|
+
},
|
|
32
|
+
detail: {
|
|
33
|
+
x: pageX,
|
|
34
|
+
y: pageY
|
|
35
|
+
},
|
|
36
|
+
touches: touches.map((item) => {
|
|
37
|
+
return {
|
|
38
|
+
identifier: item.identifier,
|
|
39
|
+
pageX: item.pageX,
|
|
40
|
+
pageY: item.pageY,
|
|
41
|
+
clientX: item.locationX,
|
|
42
|
+
clientY: item.locationY
|
|
43
|
+
};
|
|
44
|
+
}),
|
|
45
|
+
changedTouches: changedTouches.map((item) => {
|
|
46
|
+
return {
|
|
47
|
+
identifier: item.identifier,
|
|
48
|
+
pageX: item.pageX,
|
|
49
|
+
pageY: item.pageY,
|
|
50
|
+
clientX: item.locationX,
|
|
51
|
+
clientY: item.locationY
|
|
52
|
+
};
|
|
53
|
+
})
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
const useClickable = (props) => {
|
|
57
|
+
const { style, hoverStyle,
|
|
58
|
+
// hoverStopPropagation,
|
|
59
|
+
onClick, onLongPress, onTouchStart,
|
|
60
|
+
// onTouchMove,
|
|
61
|
+
// onTouchCancel,
|
|
62
|
+
onTouchEnd, } = props;
|
|
63
|
+
if (!hoverStyle &&
|
|
64
|
+
// !hoverStopPropagation &&
|
|
65
|
+
!onClick &&
|
|
66
|
+
!onLongPress &&
|
|
67
|
+
!onTouchStart &&
|
|
68
|
+
// !onTouchMove &&
|
|
69
|
+
// !onTouchCancel &&
|
|
70
|
+
!onTouchEnd) {
|
|
71
|
+
return props;
|
|
72
|
+
}
|
|
73
|
+
const [isHover, setIsHover] = useState(false);
|
|
74
|
+
const ref = useRef({
|
|
75
|
+
startTimestamp: 0
|
|
76
|
+
});
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
return () => {
|
|
79
|
+
ref.current.startTimer && clearTimeout(ref.current.startTimer);
|
|
80
|
+
ref.current.stayTimer && clearTimeout(ref.current.stayTimer);
|
|
81
|
+
};
|
|
82
|
+
}, [ref]);
|
|
83
|
+
const setStartTimer = () => {
|
|
84
|
+
const { hoverStyle, hoverStartTime } = props;
|
|
85
|
+
if (hoverStyle) {
|
|
86
|
+
ref.current.startTimer && clearTimeout(ref.current.startTimer);
|
|
87
|
+
ref.current.startTimer = setTimeout(() => {
|
|
88
|
+
setIsHover(true);
|
|
89
|
+
}, hoverStartTime);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
const setStayTimer = () => {
|
|
93
|
+
const { hoverStyle, hoverStayTime } = props;
|
|
94
|
+
if (hoverStyle) {
|
|
95
|
+
ref.current.stayTimer && clearTimeout(ref.current.stayTimer);
|
|
96
|
+
ref.current.stayTimer = setTimeout(() => {
|
|
97
|
+
isHover && setIsHover(false);
|
|
98
|
+
}, hoverStayTime);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
const panResponder = useRef(PanResponder.create({
|
|
102
|
+
onStartShouldSetPanResponder: () => {
|
|
103
|
+
const { hoverStyle, onClick, onLongPress, onTouchStart,
|
|
104
|
+
// onTouchMove,
|
|
105
|
+
// onTouchCancel,
|
|
106
|
+
onTouchEnd } = props;
|
|
107
|
+
return !!(hoverStyle || onClick || onLongPress || onTouchStart || onTouchEnd);
|
|
108
|
+
},
|
|
109
|
+
onShouldBlockNativeResponder: () => false,
|
|
110
|
+
onPanResponderGrant: (evt) => {
|
|
111
|
+
const { onTouchStart } = props;
|
|
112
|
+
onTouchStart && onTouchStart(getWxAppEvent(evt));
|
|
113
|
+
ref.current.startTimestamp = evt.nativeEvent.timestamp;
|
|
114
|
+
setStartTimer();
|
|
115
|
+
},
|
|
116
|
+
onPanResponderTerminationRequest: () => true,
|
|
117
|
+
onPanResponderRelease: (evt, gestureState) => {
|
|
118
|
+
const { onClick, onLongPress, onTouchEnd } = props;
|
|
119
|
+
onTouchEnd && onTouchEnd(getWxAppEvent(evt));
|
|
120
|
+
const endTimestamp = evt.nativeEvent.timestamp;
|
|
121
|
+
const gapTime = endTimestamp - ref.current.startTimestamp;
|
|
122
|
+
// 1 =>3, 修复部分android机型(三星折叠屏尤为明显),单击时dx,dy为>1,而被误判为move的情况。
|
|
123
|
+
const hasMove = Math.abs(gestureState.dx) >= 3 || Math.abs(gestureState.dy) >= 3;
|
|
124
|
+
if (!hasMove) {
|
|
125
|
+
if (gapTime <= 350) {
|
|
126
|
+
onClick && onClick(getWxAppEvent(evt));
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
onLongPress && onLongPress(getWxAppEvent(evt));
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
setStayTimer();
|
|
133
|
+
},
|
|
134
|
+
onPanResponderTerminate: () => {
|
|
135
|
+
// const { onTouchCancel } = this.props
|
|
136
|
+
// onTouchCancel && onTouchCancel(this.getWxAppEvent(evt))
|
|
137
|
+
setStayTimer();
|
|
138
|
+
}
|
|
139
|
+
})).current;
|
|
140
|
+
return Object.assign(Object.assign(Object.assign({}, omit(props, [
|
|
141
|
+
'style',
|
|
142
|
+
'hoverStyle',
|
|
143
|
+
'hoverStartTime',
|
|
144
|
+
'hoverStayTime',
|
|
145
|
+
'onClick',
|
|
146
|
+
'onLongPress',
|
|
147
|
+
'onTouchStart',
|
|
148
|
+
// 'onTouchMove',
|
|
149
|
+
// 'onTouchCancel',
|
|
150
|
+
'onTouchEnd'
|
|
151
|
+
])), panResponder.panHandlers), { style: [{ backgroundColor: 'transparent' }, style, isHover && hoverStyle] });
|
|
152
|
+
};
|
|
153
|
+
export default useClickable;
|
|
154
|
+
//# sourceMappingURL=useClickable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useClickable.js","sourceRoot":"","sources":["../../../src/components/hooks/useClickable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEnD,OAAO,EAEqB,YAAY,EACvC,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAElC,MAAM,CAAC,MAAM,iBAAiB,GAA0C;IACtE,2BAA2B;IAC3B,0BAA0B;IAC1B,gBAAgB;IAChB,kBAAkB;IAClB,mBAAmB;IACnB,iBAAiB;IACjB,oBAAoB;IACpB,kBAAkB;IAClB,kBAAkB;IAClB,+BAA+B;IAC/B,sBAAsB;IAC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GAAG,GAAG,CAAC,OAAO,CAAC,cAAc,CAAA;YACzD,4DAA4D;YAC5D,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC,IAAI,CAAC,CAAA;YAChF,IAAI,CAAC,OAAO,EAAE;gBACZ,IAAI,OAAO,IAAI,GAAG,EAAE;oBAClB,OAAO,IAAI,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAA;iBACvC;qBAAM;oBACL,WAAW,IAAI,WAAW,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAA;iBAC/C;aACF;YACD,YAAY,EAAE,CAAA;QAChB,CAAC;QACD,uBAAuB,EAAE,GAAG,EAAE;YAC5B,uCAAuC;YACvC,0DAA0D;YAC1D,YAAY,EAAE,CAAA;QAChB,CAAC;KACF,CAAC,CACH,CAAC,OAAO,CAAA;IAET,qDACK,IAAI,CAAC,KAAK,EAAE;QACb,OAAO;QACP,YAAY;QACZ,gBAAgB;QAChB,eAAe;QACf,SAAS;QACT,aAAa;QACb,cAAc;QACd,iBAAiB;QACjB,mBAAmB;QACnB,YAAY;KACb,CAAC,GACC,YAAY,CAAC,WAAW,KAC3B,KAAK,EAAE,CAAC,EAAE,eAAe,EAAE,aAAa,EAAE,EAAE,KAAK,EAAE,OAAO,IAAI,UAAU,CAAC,IAC1E;AACH,CAAC,CAAA;AAED,eAAe,YAAY,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/components-rn",
|
|
3
|
-
"version": "3.6.22-nightly.
|
|
3
|
+
"version": "3.6.22-nightly.6",
|
|
4
4
|
"description": "多端解决方案基础组件(RN)",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"react-native-maps": "^1.3.2",
|
|
27
27
|
"react-native-pager-view": "~6.0.1",
|
|
28
28
|
"react-native-webview": "~11.23.0",
|
|
29
|
-
"@tarojs/router-rn": "3.6.22-nightly.
|
|
29
|
+
"@tarojs/router-rn": "3.6.22-nightly.6"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@babel/core": "^7.14.5",
|