@conecli/cone-render 0.10.1-beta.8 → 0.10.1-beta.9

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.
Files changed (34) hide show
  1. package/dist/common/const.ts +1 -1
  2. package/dist/common/index.h5.ts +1 -1
  3. package/dist/common/jssdk.ts +1 -1
  4. package/dist/common/token/token.jd.ts +1 -1
  5. package/dist/components/base/CustomScrollView/index.tsx +1 -1
  6. package/dist/components/base/InOrOutViewObserver/index.tsx +1 -1
  7. package/dist/components/base/InViewRender/index.tsx +1 -1
  8. package/dist/components/base/InViewRender/index.weapp.tsx +1 -1
  9. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  10. package/dist/components/base/LazyLayoutLoad/index.weapp.tsx +1 -1
  11. package/dist/components/base/LazyLoadImage/index.h5.module.scss +4 -8
  12. package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
  13. package/dist/components/base/LazyLoadImage/index.tsx +1 -1
  14. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  15. package/dist/components/debug/DebugLayout/index.module.scss +2 -2
  16. package/dist/components/decorate/PlaceHolder/index.tsx +1 -1
  17. package/dist/components/floorItem.jd.tsx +1 -1
  18. package/dist/components/floorItem.tsx +1 -1
  19. package/dist/components/floorItem.weapp.tsx +1 -1
  20. package/dist/interface/component.ts +1 -1
  21. package/dist/interface/jumpEventReport.ts +1 -1
  22. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  23. package/dist/jumpEventReport/web.tjm.ts +1 -1
  24. package/dist/open/api/device.ts +1 -1
  25. package/dist/sass/app.h5.scss +0 -18
  26. package/dist/service/http/colorSign.ts +1 -1
  27. package/dist/service/requestServer.ts +1 -1
  28. package/dist/utils/connectNativeJsBridge.ts +1 -1
  29. package/dist/utils/index.h5.ts +1 -1
  30. package/dist/utils/taroRenderUtil.ts +1 -1
  31. package/dist/utils/utils.ts +1 -1
  32. package/package.json +53 -64
  33. package/dist/components/base/CustomScrollView/index-back.tsx +0 -1
  34. package/dist/utils/log.ts +0 -1
@@ -1 +1 @@
1
- import React, { useRef, useEffect } from 'react';
2
1
  isH5AndJdShopView,
3
2
  isAndroidDevice,
4
3
  isJdAndAndroidDevice,
5
4
  isJdAndIosDevice,
6
5
  isIosDevice,
7
6
  isJdApp,
8
7
  isWxMin,
9
8
  isH5AndJdShopViewH5Scroll,
10
9
  isH5AndJdShopH5CustomScrollView,
11
10
  isH5,
12
11
  isAppClassifyPage,
13
12
  lodashThrottle,
14
13
  START: 'start',
15
14
  MOVE: 'move',
16
15
  END: 'end',
17
16
  const {
18
17
  scrollX,
19
18
  children,
20
19
  style = {},
21
20
  iosNeedDisableVertical,
22
21
  dispatchTouchMove,
23
22
  className,
24
23
  ...otherProps
25
24
  } = props;
26
25
  const rootEleNode = isH5 && document ? document.querySelector('body') : null;
27
26
  const needShowHighVersion =
28
27
  isH5AndJdShopViewH5Scroll &&
29
28
  !(global.info.queryInfo?.downgraded && global.info.queryInfo.downgraded === 'true');
30
29
  const mLastClientPosRef = useRef({
31
30
  mLastClientX: 0,
32
31
  mLastClientY: 0,
33
32
  });
34
33
  const isJdAndH5ScrollState = needShowHighVersion || isH5AndJdShopH5CustomScrollView;
35
34
 
36
35
  const touchstartEventBubbleFunc = (e) => {
37
36
  const isH5SwiperCustomEle = e?.target?.closest('.J_h5SwiperCustom');
38
37
  if (!isH5SwiperCustomEle) {
39
38
  const hasCustomEle = e
40
39
  ? e?.target?.closest('.J_customScroll') || e?.target?.closest('.J_customLayout')
41
40
  : false;
42
41
  if (isJdAndAndroidDevice && !hasCustomEle) {
43
42
  window?.JdAndroid &&
44
43
  window?.JdAndroid?.requestEvent &&
45
44
  window.JdAndroid.requestEvent(false);
46
45
  }
47
46
  !hasCustomEle &&
48
47
  rootEleNode &&
49
48
  rootEleNode.classList.contains('over-hidden') &&
50
49
  rootEleNode.classList.remove('over-hidden');
51
50
  console.log(
52
51
  'customScrollView所在页面document touch start事件是否有J_customScroll元素',
53
52
  hasCustomEle,
54
53
  '根元素是否有over-hidden',
55
54
  rootEleNode.classList,
56
55
  );
57
56
  }
58
57
  };
59
58
  const touchstartEventCaptureFunc = (e) => {
60
59
  if (e && !e?.target?.closest('.J_h5SwiperCustom') && !e?.target?.closest('.J_customLayout')) {
61
60
  rootEleNode &&
62
61
  rootEleNode.classList.contains('over-hidden') &&
63
62
  rootEleNode.classList.remove('over-hidden');
64
63
  console.log(
65
64
  'customScrollView所在页面document touch start事件捕获阶段移除根元素是否有over-hidden',
66
65
  rootEleNode.classList,
67
66
  );
68
67
  }
69
68
  };
70
69
  useEffect(() => {
71
70
  isJdApp &&
72
71
  !window.JDJshopViewInfo.getAndroidTouchSlopState &&
73
72
  nativePageGetScaledTouchSlop((res) => {
74
73
  console.log('获取安卓系统滑动阈值', res);
75
74
  window.JDJshopViewInfo.androidTouchSlop = res;
76
75
  window.JDJshopViewInfo.getAndroidTouchSlopState = true;
77
76
  });
78
77
  if (isJdAndH5ScrollState && rootEleNode && !rootEleAddEventListenerState) {
79
78
  global?.removeJdAndroidRquestEventForTouchStart &&
80
79
  global.removeJdAndroidRquestEventForTouchStart();
81
80
  rootEleNode.addEventListener('touchstart', touchstartEventBubbleFunc, false);
82
81
 
83
82
  rootEleNode.addEventListener('touchstart', touchstartEventCaptureFunc, true);
84
83
  rootEleAddEventListenerState = true;
85
84
  console.log('customScrollView 初始化document监听完成');
86
85
  }
87
86
  return () => {
88
87
  if (isJdAndH5ScrollState && rootEleNode && rootEleAddEventListenerState) {
89
88
  console.log('customScrollView document监听取消完成');
90
89
  rootEleNode.removeEventListener('touchstart', touchstartEventBubbleFunc, false);
91
90
  rootEleNode.removeEventListener('touchstart', touchstartEventCaptureFunc, true);
92
91
  }
93
92
  };
94
93
  }, []);
95
94
 
96
95
  const androidDeviceStopNativeScrollEvent = (touchType) => {
97
96
  isJdApp &&
98
97
  isAndroidDevice &&
99
98
  window?.JdAndroid &&
100
99
  window?.JdAndroid?.requestEvent &&
101
100
  window.JdAndroid.requestEvent(touchType === TouchType.START);
102
101
  console.log('触发window?.JdAndroid.requestEvent', touchType === TouchType.START, touchType);
103
102
  };
104
103
  const iosDeviceStopNativeScrollEvent = (e, touchType, sendIosState = true) => {
105
104
  sendIosState && iosDeviceSendRouter(touchType);
106
105
  };
107
106
 
108
107
  const iosDeviceSendRouter = (state: string) => {
109
108
  window?.webkit?.messageHandlers?.MobileNavi?.postMessage?.({
110
109
  method: 'callRouterModuleWithParams',
111
110
  params: {
112
111
  routerURL: 'router://JDShopModule/processShoph5SlideState',
113
112
  routerParam: {
114
113
  slideDirection: 'horizontal',
115
114
  needDisableVertical: `${iosNeedDisableVertical}`,
116
115
  state,
117
116
  },
118
117
  callBackId: new Date().getTime(),
119
118
  },
120
119
  });
121
120
  };
122
121
  const stopNativeScrollEvent = (e: Event, touchType, sendIosState = true) => {
123
122
  if (isJdApp) {
124
123
  isIosDevice &&
125
124
  !isAppClassifyPage &&
126
125
  iosDeviceStopNativeScrollEvent(e, touchType, sendIosState);
127
126
  isAndroidDevice && androidDeviceStopNativeScrollEvent(touchType);
128
127
  }
129
128
  };
130
129
 
131
130
  const GetSlideAngle = (dx, dy) => {
132
131
  return (Math.atan2(dy, dx) * 180) / Math.PI;
133
132
  };
134
133
 
135
134
  const GetSlideDirection = (startX, startY, endX, endY) => {
136
135
  const dy = startY - endY;
137
136
  const dx = endX - startX;
138
137
  let result = 0;
139
138
  if (Math.abs(dx) < 2 && Math.abs(dy) < 2) {
140
139
  return result;
141
140
  }
142
141
  const angle = GetSlideAngle(dx, dy);
143
142
  if (angle >= -45 && angle < 45) {
144
143
  result = 4;
145
144
  } else if (angle >= 45 && angle < 135) {
146
145
  result = 1;
147
146
  } else if (angle >= -135 && angle < -45) {
148
147
  result = 2;
149
148
  } else if ((angle >= 135 && angle <= 180) || (angle >= -180 && angle < -135)) {
150
149
  result = 3;
151
150
  }
152
151
  return result;
153
152
  };
154
153
  const changeTouchStart = (e) => {
155
154
  if (isJdApp) {
156
155
  stopNativeScrollEvent(e, TouchType.START, !iosNeedDisableVertical);
157
156
  if (isH5AndJdShopView || isH5AndJdShopH5CustomScrollView) {
158
157
  isJdAndH5ScrollState && rootEleNode && rootEleNode.classList.add('over-hidden');
159
158
  const touchEvent = e?.originalEvent?.targetTouches[0] || e?.targetTouches[0];
160
159
  mLastClientPosRef.current.mLastClientX = touchEvent.clientX;
161
160
  mLastClientPosRef.current.mLastClientY = touchEvent.clientY;
162
161
  }
163
162
  }
164
163
  };
165
164
  const changeTouchEnd = (e) => {
166
165
  stopNativeScrollEvent(e, TouchType.END);
167
166
  mLastClientPosRef.current.mLastClientX = 0;
168
167
  mLastClientPosRef.current.mLastClientY = 0;
169
168
  };
170
169
  const triggerIosTouchMove = () => {
171
170
  isJdAndIosDevice && iosDeviceStopNativeScrollEvent(null, TouchType.START, true);
172
171
  };
173
172
 
174
173
  const lodashThrottleTriggerIosTouchMove = lodashThrottle(triggerIosTouchMove, 500);
175
174
 
176
175
  const recoverRootEleVerticalScroll = (touchEvent) => {
177
176
  const direction = GetSlideDirection(
178
177
  mLastClientPosRef.current.mLastClientX,
179
178
  mLastClientPosRef.current.mLastClientY,
180
179
  touchEvent.clientX,
181
180
  touchEvent.clientY,
182
181
  );
183
182
  if (direction === 1 || direction === 2) {
184
183
  rootEleNode &&
185
184
  rootEleNode.classList.contains('over-hidden') &&
186
185
  rootEleNode.classList.remove('over-hidden');
187
186
  }
188
187
  };
189
188
  const changeTouchMove = (e) => {
190
189
  if (isH5AndJdShopView || isH5AndJdShopH5CustomScrollView) {
191
190
  const touchEvent = e?.originalEvent?.targetTouches[0] || e?.targetTouches[0];
192
191
  const xDiff = Math.abs(touchEvent.clientX - mLastClientPosRef.current.mLastClientX).toFixed(
193
192
  2,
194
193
  );
195
194
  const yDiff = Math.abs(touchEvent.clientY - mLastClientPosRef.current.mLastClientY).toFixed(
196
195
  2,
197
196
  );
198
197
  if (isJdApp) {
199
198
  if (xDiff >= window.JDJshopViewInfo.androidTouchSlop) {
200
199
  iosNeedDisableVertical && isJdApp && lodashThrottleTriggerIosTouchMove();
201
200
  } else if (yDiff > window.JDJshopViewInfo.androidTouchSlop) {
202
201
  console.log('纵向滚动触发', yDiff, touchEvent, window.JDJshopViewInfo.androidTouchSlop);
203
202
  stopNativeScrollEvent(e, TouchType.END);
204
203
  }
205
204
  }
206
205
  isJdAndH5ScrollState && recoverRootEleVerticalScroll(touchEvent);
207
206
  }
208
207
  if (!dispatchTouchMove) {
209
208
  return;
210
209
  }
211
210
  const parentNode = e.target?.parentNode;
212
211
  if (!parentNode) {
213
212
  return;
214
213
  }
215
214
  const event = new TouchEvent('touchmove', e);
216
215
  parentNode.dispatchEvent(event);
217
216
  };
218
217
  if (scrollX && isJdApp && !isIgnorePreventNative) {
219
218
  return (
220
219
  <ScrollView
221
220
  scrollX
222
221
  onTouchStart={changeTouchStart}
223
222
  onTouchEnd={changeTouchEnd}
224
223
  onTouchCancel={changeTouchEnd}
225
224
  onTouchMove={changeTouchMove}
226
225
  enhanced
227
226
  showScrollbar={false}
228
227
  style={style}
229
228
  className={classNames(
230
229
  className,
231
230
  {
232
231
  [customScrollViewStyle['d-custom-ios-h5-extend-border-radius']]: isIosDevice,
233
232
  },
234
233
  'J_customScroll',
235
234
  )}
236
235
  {...otherProps}
237
236
  >
238
237
  {children}
239
238
  </ScrollView>
240
239
  );
241
240
  } else {
242
241
  return (
243
242
  <ScrollView
244
243
  scrollX
245
244
  enhanced
246
245
  showScrollbar={false}
247
246
  {...otherProps}
248
247
  className={classNames(
249
248
  className,
250
249
  {
251
250
  [customScrollViewStyle['d-custom-ios-mini-extend-border-radius']]:
252
251
  isIosDevice && isWxMin && scrollX && style['borderRadius'],
253
252
  },
254
253
  {
255
254
  [customScrollViewStyle['d-custom-ios-h5-extend-border-radius']]: isIosDevice,
256
255
  },
257
256
  {
258
257
  [customScrollViewStyle['d-custom-mini-hide-scroll']]: isWxMin,
259
258
  },
260
259
  )}
261
260
  style={style}
262
261
  >
263
262
  {children}
264
263
  </ScrollView>
265
264
  );
266
265
  }
267
266
  style: {},
268
267
  scrollX: false,
269
268
  scrollY: false,
270
269
  scrollWithAnimation: true,
271
270
  iosNeedDisableVertical: false,
272
271
  className: null,
273
272
  dispatchTouchMove: true,
273
+ import React, { useRef, useEffect } from 'react';
274
274
  isH5AndJdShopView,
275
275
  isAndroidDevice,
276
276
  isJdAndAndroidDevice,
277
277
  isJdAndIosDevice,
278
278
  isIosDevice,
279
279
  isJdApp,
280
280
  isWxMin,
281
281
  isH5AndJdShopViewH5Scroll,
282
282
  isH5AndJdShopH5CustomScrollView,
283
283
  isH5,
284
284
  isAppClassifyPage,
285
285
  lodashThrottle,
286
286
  START: 'start',
287
287
  MOVE: 'move',
288
288
  END: 'end',
289
289
  '当前业务是否忽略原生阻止底层滚动',
290
290
  isIgnorePreventNative,
291
291
  ignoreBuildTypeList,
292
292
  newBuildType,
293
293
  const { scrollX, children, style = {}, iosNeedDisableVertical, className, ...otherProps } = props;
294
294
  const rootEleNode = isH5 && document ? document.querySelector('body') : null;
295
295
  const needShowHighVersion =
296
296
  isH5AndJdShopViewH5Scroll &&
297
297
  !(global.info.queryInfo?.downgraded && global.info.queryInfo.downgraded === 'true');
298
298
  const mLastClientPosRef = useRef({
299
299
  mLastClientX: 0,
300
300
  mLastClientY: 0,
301
301
  });
302
302
  const isJdAndH5ScrollState = needShowHighVersion || isH5AndJdShopH5CustomScrollView;
303
303
 
304
304
  const touchstartEventBubbleFunc = (e) => {
305
305
  const isH5SwiperCustomEle = e?.target?.closest('.J_h5SwiperCustom');
306
306
  if (!isH5SwiperCustomEle) {
307
307
  const hasCustomEle = e
308
308
  ? e?.target?.closest('.J_customScroll') || e?.target?.closest('.J_customLayout')
309
309
  : false;
310
310
  if (isJdAndAndroidDevice && !hasCustomEle) {
311
311
  window?.JdAndroid &&
312
312
  window?.JdAndroid?.requestEvent &&
313
313
  window.JdAndroid.requestEvent(false);
314
314
  }
315
315
  !hasCustomEle &&
316
316
  rootEleNode &&
317
317
  rootEleNode.classList.contains('over-hidden') &&
318
318
  rootEleNode.classList.remove('over-hidden');
319
319
  console.log(
320
320
  'customScrollView所在页面document touch start事件是否有J_customScroll元素',
321
321
  hasCustomEle,
322
322
  '根元素是否有over-hidden',
323
323
  rootEleNode.classList,
324
324
  );
325
325
  }
326
326
  };
327
327
  const touchstartEventCaptureFunc = (e) => {
328
328
  if (e && !e?.target?.closest('.J_h5SwiperCustom') && !e?.target?.closest('.J_customLayout')) {
329
329
  rootEleNode &&
330
330
  rootEleNode.classList.contains('over-hidden') &&
331
331
  rootEleNode.classList.remove('over-hidden');
332
332
  console.log(
333
333
  'customScrollView所在页面document touch start事件捕获阶段移除根元素是否有over-hidden',
334
334
  rootEleNode.classList,
335
335
  );
336
336
  }
337
337
  };
338
338
  useEffect(() => {
339
339
  isJdApp &&
340
340
  !window.JDJshopViewInfo.getAndroidTouchSlopState &&
341
341
  nativePageGetScaledTouchSlop((res) => {
342
342
  console.log('获取安卓系统滑动阈值', res);
343
343
  window.JDJshopViewInfo.androidTouchSlop = res;
344
344
  window.JDJshopViewInfo.getAndroidTouchSlopState = true;
345
345
  });
346
346
  if (isJdAndH5ScrollState && rootEleNode && !rootEleAddEventListenerState) {
347
347
  global?.removeJdAndroidRquestEventForTouchStart &&
348
348
  global.removeJdAndroidRquestEventForTouchStart();
349
349
  rootEleNode.addEventListener('touchstart', touchstartEventBubbleFunc, false);
350
350
 
351
351
  rootEleNode.addEventListener('touchstart', touchstartEventCaptureFunc, true);
352
352
  rootEleAddEventListenerState = true;
353
353
  console.warn('customScrollView 初始化document监听完成');
354
354
  }
355
355
  return () => {
356
356
  if (isJdAndH5ScrollState && rootEleNode && rootEleAddEventListenerState) {
357
357
  console.warn('customScrollView document监听取消完成');
358
358
  rootEleNode.removeEventListener('touchstart', touchstartEventBubbleFunc, false);
359
359
  rootEleNode.removeEventListener('touchstart', touchstartEventCaptureFunc, true);
360
360
  }
361
361
  };
362
362
  }, []);
363
363
 
364
364
  const androidDeviceStopNativeScrollEvent = (touchType) => {
365
365
  isJdApp &&
366
366
  isAndroidDevice &&
367
367
  window?.JdAndroid &&
368
368
  window?.JdAndroid?.requestEvent &&
369
369
  window.JdAndroid.requestEvent(touchType === TouchType.START);
370
370
  console.log('触发window?.JdAndroid.requestEvent', touchType === TouchType.START, touchType);
371
371
  };
372
372
  const iosDeviceStopNativeScrollEvent = (e, touchType, sendIosState = true) => {
373
373
  e && e.stopPropagation();
374
374
  sendIosState && iosDeviceSendRouter(touchType);
375
375
  };
376
376
  const iosDeviceSendRouter = (state) => {
377
377
  window?.webkit?.messageHandlers?.MobileNavi?.postMessage?.({
378
378
  method: 'callRouterModuleWithParams',
379
379
  params: {
380
380
  routerURL: 'router://JDShopModule/processShoph5SlideState',
381
381
  routerParam: {
382
382
  slideDirection: 'horizontal',
383
383
  needDisableVertical: `${iosNeedDisableVertical}`,
384
384
  state,
385
385
  },
386
386
  callBackId: new Date().getTime(),
387
387
  },
388
388
  });
389
389
  };
390
390
  const stopNativeScrollEvent = (e: Event, touchType, sendIosState = true) => {
391
391
  if (isJdApp) {
392
392
  isIosDevice &&
393
393
  !isAppClassifyPage &&
394
394
  iosDeviceStopNativeScrollEvent(e, touchType, sendIosState);
395
395
  isAndroidDevice && androidDeviceStopNativeScrollEvent(touchType);
396
396
  console.log(
397
397
  '当前customScrollView touch事件',
398
398
  touchType,
399
399
  e,
400
400
  '是否是e instanceof CustomEvent',
401
401
  e instanceof CustomEvent,
402
402
  );
403
403
  }
404
404
  };
405
405
  const GetSlideAngle = (dx, dy) => {
406
406
  return (Math.atan2(dy, dx) * 180) / Math.PI;
407
407
  };
408
408
  const GetSlideDirection = (startX, startY, endX, endY) => {
409
409
  const dy = startY - endY;
410
410
  const dx = endX - startX;
411
411
  let result = 0;
412
412
  if (Math.abs(dx) < 2 && Math.abs(dy) < 2) {
413
413
  return result;
414
414
  }
415
415
  const angle = GetSlideAngle(dx, dy);
416
416
  if (angle >= -45 && angle < 45) {
417
417
  result = 4;
418
418
  } else if (angle >= 45 && angle < 135) {
419
419
  result = 1;
420
420
  } else if (angle >= -135 && angle < -45) {
421
421
  result = 2;
422
422
  } else if ((angle >= 135 && angle <= 180) || (angle >= -180 && angle < -135)) {
423
423
  result = 3;
424
424
  }
425
425
  return result;
426
426
  };
427
427
  const changeTouchStart = (e) => {
428
428
  if (isJdApp) {
429
429
  stopNativeScrollEvent(e, TouchType.START, !iosNeedDisableVertical);
430
430
  if (isH5AndJdShopView || isH5AndJdShopH5CustomScrollView) {
431
431
  isJdAndH5ScrollState && rootEleNode && rootEleNode.classList.add('over-hidden');
432
432
  console.info(
433
433
  'customScrollView touchstart 当前根元素是否添加还是删除over-hidden',
434
434
  TouchType.START,
435
435
  rootEleNode.classList,
436
436
  );
437
437
  const touchEvent = e?.originalEvent?.targetTouches[0] || e?.targetTouches[0];
438
438
  mLastClientPosRef.current.mLastClientX = touchEvent.clientX;
439
439
  mLastClientPosRef.current.mLastClientY = touchEvent.clientY;
440
440
  console.log('ustomScrollView touchstart 获取mLastClientPosRef', mLastClientPosRef);
441
441
  }
442
442
  }
443
443
  };
444
444
  const changeTouchEnd = (e) => {
445
445
  stopNativeScrollEvent(e, TouchType.END);
446
446
  mLastClientPosRef.current.mLastClientX = 0;
447
447
  mLastClientPosRef.current.mLastClientY = 0;
448
448
  console.log('ustomScrollView touchend 获取mLastClientPosRef', mLastClientPosRef);
449
449
  };
450
450
  const triggerIosTouchMove = () => {
451
451
  isJdAndIosDevice && iosDeviceStopNativeScrollEvent(null, TouchType.START, true);
452
452
  };
453
453
 
454
454
  const lodashThrottleTriggerIosTouchMove = lodashThrottle(triggerIosTouchMove, 500);
455
455
 
456
456
  const recoverRootEleVerticalScroll = (touchEvent) => {
457
457
  const direction = GetSlideDirection(
458
458
  mLastClientPosRef.current.mLastClientX,
459
459
  mLastClientPosRef.current.mLastClientY,
460
460
  touchEvent.clientX,
461
461
  touchEvent.clientY,
462
462
  );
463
463
  if (direction === 1 || direction === 2) {
464
464
  rootEleNode &&
465
465
  rootEleNode.classList.contains('over-hidden') &&
466
466
  rootEleNode.classList.remove('over-hidden');
467
467
  }
468
468
  console.log(
469
469
  '获取当前滚动方向,向上向下1、2',
470
470
  direction,
471
471
  '根元素的classList',
472
472
  rootEleNode.classList,
473
473
  'mLastClientPosRef.current.mLastClientX',
474
474
  mLastClientPosRef.current.mLastClientX,
475
475
  );
476
476
  };
477
477
  const changeTouchMove = (e) => {
478
478
  if (isH5AndJdShopView || isH5AndJdShopH5CustomScrollView) {
479
479
  const touchEvent = e?.originalEvent?.targetTouches[0] || e?.targetTouches[0];
480
480
  const xDiff = Math.abs(touchEvent.clientX - mLastClientPosRef.current.mLastClientX).toFixed(
481
481
  2,
482
482
  );
483
483
  const yDiff = Math.abs(touchEvent.clientY - mLastClientPosRef.current.mLastClientY).toFixed(
484
484
  2,
485
485
  );
486
486
  if (isJdApp) {
487
487
  if (xDiff >= window.JDJshopViewInfo.androidTouchSlop) {
488
488
  console.log(
489
489
  '横向滚动触发',
490
490
  xDiff,
491
491
  touchEvent,
492
492
  window.JDJshopViewInfo.androidTouchSlop,
493
493
  'iosNeedDisableVertical',
494
494
  iosNeedDisableVertical,
495
495
  );
496
496
  iosNeedDisableVertical && isJdApp && lodashThrottleTriggerIosTouchMove();
497
497
  } else if (yDiff > window.JDJshopViewInfo.androidTouchSlop) {
498
498
  console.log('纵向滚动触发', yDiff, touchEvent, window.JDJshopViewInfo.androidTouchSlop);
499
499
  stopNativeScrollEvent(e, TouchType.END);
500
500
  }
501
501
  }
502
502
  isJdAndH5ScrollState && recoverRootEleVerticalScroll(touchEvent);
503
503
  }
504
504
  };
505
505
  if (scrollX && isJdApp && !isIgnorePreventNative) {
506
506
  return (
507
507
  <ScrollView
508
508
  scrollX
509
509
  onTouchStart={changeTouchStart}
510
510
  onTouchEnd={changeTouchEnd}
511
511
  onTouchCancel={changeTouchEnd}
512
512
  onTouchMove={changeTouchMove}
513
513
  enhanced
514
514
  showScrollbar={false}
515
515
  style={style}
516
516
  className={classNames(
517
517
  className,
518
518
  {
519
519
  [customScrollViewStyle['d-custom-ios-h5-extend-border-radius']]: isIosDevice,
520
520
  },
521
521
  'J_customScroll',
522
522
  )}
523
523
  {...otherProps}
524
524
  >
525
525
  {children}
526
526
  </ScrollView>
527
527
  );
528
528
  } else {
529
529
  return (
530
530
  <ScrollView
531
531
  scrollX
532
532
  enhanced
533
533
  showScrollbar={false}
534
534
  {...otherProps}
535
535
  className={classNames(
536
536
  className,
537
537
  {
538
538
  [customScrollViewStyle['d-custom-ios-mini-extend-border-radius']]:
539
539
  isIosDevice && isWxMin && scrollX && style['borderRadius'],
540
540
  },
541
541
  {
542
542
  [customScrollViewStyle['d-custom-ios-h5-extend-border-radius']]: isIosDevice,
543
543
  },
544
544
  {
545
545
  [customScrollViewStyle['d-custom-mini-hide-scroll']]: isWxMin,
546
546
  },
547
547
  )}
548
548
  style={style}
549
549
  >
550
550
  {children}
551
551
  </ScrollView>
552
552
  );
553
553
  }
554
554
  style: {},
555
555
  scrollX: false,
556
556
  scrollY: false,
557
557
  scrollWithAnimation: true,
558
558
  iosNeedDisableVertical: false,
559
559
  className: null,