@tarojs/react 4.0.0-beta.13 → 4.0.0-beta.131
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/LICENSE +8 -8
- package/dist/componentTree.d.ts +19 -0
- package/dist/constant.d.ts +7 -0
- package/dist/domInput.d.ts +12 -0
- package/dist/event.d.ts +13 -0
- package/dist/index.d.ts +33 -0
- package/dist/inputValueTracking.d.ts +3 -0
- package/dist/props.d.ts +5 -0
- package/dist/react.esm.js +161 -45
- package/dist/react.esm.js.map +1 -1
- package/dist/reconciler.d.ts +4 -0
- package/dist/render.d.ts +25 -0
- package/dist/workTags.d.ts +26 -0
- package/package.json +15 -18
- package/dist/index.js +0 -861
- package/dist/index.js.map +0 -1
package/LICENSE
CHANGED
|
@@ -154,15 +154,8 @@ See `/LICENSE` for details of the license.
|
|
|
154
154
|
|
|
155
155
|
==================
|
|
156
156
|
|
|
157
|
-
MIT (stencil-vue2-output-target):
|
|
158
|
-
The following files embed [stencil-vue2-output-target](https://github.com/diondree/stencil-vue2-output-target) MIT:
|
|
159
|
-
`/packages/taro-components-library-vue2/src/vue-component-lib/utils.ts`
|
|
160
|
-
See `/LICENSE` for details of the license.
|
|
161
|
-
|
|
162
|
-
==================
|
|
163
|
-
|
|
164
157
|
MIT (weui):
|
|
165
|
-
The following files embed [
|
|
158
|
+
The following files embed [weui](https://github.com/Tencent/weui) MIT:
|
|
166
159
|
`/packages/taro-components/src/components/*.scss`
|
|
167
160
|
See `/LICENSE.txt` for details of the license.
|
|
168
161
|
|
|
@@ -172,3 +165,10 @@ Apache-2.0 (intersection-observer):
|
|
|
172
165
|
The following files embed [intersection-observer](https://github.com/GoogleChromeLabs/intersection-observer) Apache-2.0:
|
|
173
166
|
`/packages/taro-api/src/polyfill/intersection-observer.ts`
|
|
174
167
|
See `/LICENSE.txt` for details of the license.
|
|
168
|
+
|
|
169
|
+
==================
|
|
170
|
+
|
|
171
|
+
MIT (babel-plugin-jsx-dom-expressions):
|
|
172
|
+
The following files embed [babel-plugin-jsx-dom-expressions](https://github.com/ryansolid/dom-expressions/blob/main/packages/babel-plugin-jsx-dom-expressions) MIT:
|
|
173
|
+
`/packages/babel-plugin-transform-solid-jsx/src/*`
|
|
174
|
+
See `/LICENSE` for details of the license.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { TaroElement, TaroText } from '@tarojs/runtime';
|
|
2
|
+
import type { Fiber } from 'react-reconciler';
|
|
3
|
+
import type { Props } from './props';
|
|
4
|
+
export declare function precacheFiberNode(hostInst: Fiber, node: TaroElement | TaroText): void;
|
|
5
|
+
export declare function markContainerAsRoot(hostRoot: Fiber, node: TaroElement | TaroText): void;
|
|
6
|
+
export declare function unmarkContainerAsRoot(node: TaroElement | TaroText): void;
|
|
7
|
+
export declare function isContainerMarkedAsRoot(node: TaroElement | TaroText): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent
|
|
10
|
+
* instance, or null if the node was not rendered by this React.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getInstanceFromNode(node: TaroElement | TaroText): Fiber | null;
|
|
13
|
+
/**
|
|
14
|
+
* Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding
|
|
15
|
+
* DOM node.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getNodeFromInstance(inst: Fiber): any;
|
|
18
|
+
export declare function getFiberCurrentPropsFromNode(node: TaroElement | TaroText): Props;
|
|
19
|
+
export declare function updateFiberProps(node: TaroElement | TaroText, props: Props): void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const supportedInputTypes: {
|
|
2
|
+
[key: string]: boolean;
|
|
3
|
+
};
|
|
4
|
+
export declare function getEventPriority(domEventName: any): 1 | 4 | 16;
|
|
5
|
+
export declare const internalPropsKey: string;
|
|
6
|
+
export declare const internalInstanceKey: string;
|
|
7
|
+
export declare const internalContainerInstanceKey: string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Props } from './props';
|
|
2
|
+
import type { FormElement, TaroElement } from '@tarojs/runtime';
|
|
3
|
+
import type { RestoreType } from './event';
|
|
4
|
+
declare function updateInputWrapper(element: TaroElement, oldValue: RestoreType, props: Props): void;
|
|
5
|
+
export declare function getToStringValue(value: any): any;
|
|
6
|
+
export declare function toString(value: any): string;
|
|
7
|
+
export declare function updateWrapper(element: TaroElement, oldValue: RestoreType, props: Props): void;
|
|
8
|
+
export declare function setNodeValue(node: FormElement, oldValue: RestoreType, value: any, type?: string): void;
|
|
9
|
+
export declare function isTextInputElement(elem: TaroElement): boolean;
|
|
10
|
+
export declare const ReactDOMTextareaRestoreControlledState: typeof updateWrapper;
|
|
11
|
+
export declare const ReactDOMInputRestoreControlledState: typeof updateInputWrapper;
|
|
12
|
+
export {};
|
package/dist/event.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TaroElement, TaroEvent } from '@tarojs/runtime';
|
|
2
|
+
import type { Fiber } from 'react-reconciler';
|
|
3
|
+
export type RestoreType = string | number | boolean | any[];
|
|
4
|
+
interface RestoreItem {
|
|
5
|
+
target: TaroElement;
|
|
6
|
+
value: RestoreType;
|
|
7
|
+
}
|
|
8
|
+
export declare function getTargetInstForInputOrChangeEvent(e: TaroEvent, node: TaroElement): false | Fiber | undefined;
|
|
9
|
+
export declare function enqueueStateRestore(target: RestoreItem): void;
|
|
10
|
+
export declare function needsStateRestore(): boolean;
|
|
11
|
+
export declare function finishEventHandler(): void;
|
|
12
|
+
export declare function restoreStateIfNeeded(): void;
|
|
13
|
+
export {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { internalInstanceKey } from './constant';
|
|
2
|
+
import { createRoot, render } from './render';
|
|
3
|
+
import type { TaroElement } from '@tarojs/runtime';
|
|
4
|
+
import type { ReactNode } from 'react';
|
|
5
|
+
declare const unstable_batchedUpdates: (fn: any, a: any) => any;
|
|
6
|
+
declare function unmountComponentAtNode(dom: TaroElement): boolean;
|
|
7
|
+
declare function findDOMNode(comp?: TaroElement | ReactNode): string | number | boolean | TaroElement | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null;
|
|
8
|
+
declare function createPortal(children: ReactNode, containerInfo: TaroElement, key?: string): {
|
|
9
|
+
$$typeof: number | symbol;
|
|
10
|
+
key: string | null;
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
containerInfo: TaroElement;
|
|
13
|
+
implementation: null;
|
|
14
|
+
};
|
|
15
|
+
declare const flushSync: {
|
|
16
|
+
(): void;
|
|
17
|
+
<R>(fn: () => R): R;
|
|
18
|
+
};
|
|
19
|
+
export { createPortal, createRoot, findDOMNode, flushSync, internalInstanceKey, render, unmountComponentAtNode, unstable_batchedUpdates, };
|
|
20
|
+
declare const _default: {
|
|
21
|
+
render: typeof render;
|
|
22
|
+
flushSync: {
|
|
23
|
+
(): void;
|
|
24
|
+
<R>(fn: () => R): R;
|
|
25
|
+
};
|
|
26
|
+
createRoot: typeof createRoot;
|
|
27
|
+
unstable_batchedUpdates: (fn: any, a: any) => any;
|
|
28
|
+
unmountComponentAtNode: typeof unmountComponentAtNode;
|
|
29
|
+
findDOMNode: typeof findDOMNode;
|
|
30
|
+
createPortal: typeof createPortal;
|
|
31
|
+
internalInstanceKey: string;
|
|
32
|
+
};
|
|
33
|
+
export default _default;
|
package/dist/props.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { TaroElement } from '@tarojs/runtime';
|
|
2
|
+
export type Props = Record<string, unknown>;
|
|
3
|
+
export declare function updateProps(dom: TaroElement, oldProps: Props, newProps: Props): void;
|
|
4
|
+
export declare function updatePropsByPayload(dom: TaroElement, oldProps: Props, updatePayload: any[]): void;
|
|
5
|
+
export declare function getUpdatePayload(dom: TaroElement, oldProps: Props, newProps: Props): any[] | null;
|
package/dist/react.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PLATFORM_TYPE, isObject, isString, isFunction, capitalize, toCamelCase, internalComponents, isNumber, noop, isUndefined, isBoolean, hooks, ensure } from '@tarojs/shared';
|
|
2
2
|
import { FormElement, convertNumber2PX, document } from '@tarojs/runtime';
|
|
3
3
|
import Reconciler from 'react-reconciler';
|
|
4
4
|
import { DefaultEventPriority as DefaultEventPriority$1 } from 'react-reconciler/constants';
|
|
@@ -177,10 +177,10 @@ function updateWrapper(element, oldValue, props) {
|
|
|
177
177
|
function setNodeValue(node, oldValue, value, type = 'string') {
|
|
178
178
|
if (value != null) {
|
|
179
179
|
if (type === 'number') {
|
|
180
|
-
if ((value === 0 && node.value === '')
|
|
180
|
+
if ((value === 0 && node.value === '')
|
|
181
181
|
// We explicitly want to coerce to number here if possible.
|
|
182
182
|
// eslint-disable-next-line
|
|
183
|
-
oldValue != value) {
|
|
183
|
+
|| oldValue != value) {
|
|
184
184
|
node.value = toString(value);
|
|
185
185
|
}
|
|
186
186
|
}
|
|
@@ -284,13 +284,35 @@ function updateValueIfChanged(node, nextValue) {
|
|
|
284
284
|
return false;
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
-
const isHarmony = process.env.TARO_PLATFORM === 'harmony';
|
|
288
287
|
const IS_NON_DIMENSIONAL = /max|aspect|acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;
|
|
289
288
|
function isEventName(s) {
|
|
290
289
|
return s[0] === 'o' && s[1] === 'n';
|
|
291
290
|
}
|
|
292
291
|
function isEqual(obj1, obj2) {
|
|
293
|
-
|
|
292
|
+
// 首先检查引用是否相同
|
|
293
|
+
if (obj1 === obj2) {
|
|
294
|
+
return true;
|
|
295
|
+
}
|
|
296
|
+
// 如果两者中有一个不是对象,或者为 null,直接返回 false
|
|
297
|
+
if (typeof obj1 !== 'object' || obj1 === null || typeof obj2 !== 'object' || obj2 === null) {
|
|
298
|
+
return false;
|
|
299
|
+
}
|
|
300
|
+
// 获取两个对象键的数组
|
|
301
|
+
const keys1 = Object.keys(obj1);
|
|
302
|
+
const keys2 = Object.keys(obj2);
|
|
303
|
+
// 如果键的数量不相同,对象显然不相等
|
|
304
|
+
if (keys1.length !== keys2.length) {
|
|
305
|
+
return false;
|
|
306
|
+
}
|
|
307
|
+
// 遍历对象的每个键,比较两个对象同一键的值
|
|
308
|
+
for (let i = 0; i < keys1.length; i++) {
|
|
309
|
+
const key = keys1[i];
|
|
310
|
+
if (obj1[key] !== obj2[key]) {
|
|
311
|
+
return false;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
// 如果所有键的值都相等,返回 true
|
|
315
|
+
return true;
|
|
294
316
|
}
|
|
295
317
|
function updateProps(dom, oldProps, newProps) {
|
|
296
318
|
const updatePayload = getUpdatePayload(dom, oldProps, newProps);
|
|
@@ -299,11 +321,36 @@ function updateProps(dom, oldProps, newProps) {
|
|
|
299
321
|
}
|
|
300
322
|
}
|
|
301
323
|
function updatePropsByPayload(dom, oldProps, updatePayload) {
|
|
302
|
-
|
|
324
|
+
const handlers = [];
|
|
325
|
+
let fixedHandler = null;
|
|
326
|
+
for (let i = 0; i < updatePayload.length; i += 2) {
|
|
327
|
+
// key, value 成对出现
|
|
303
328
|
const key = updatePayload[i];
|
|
304
329
|
const newProp = updatePayload[i + 1];
|
|
305
330
|
const oldProp = oldProps[key];
|
|
306
|
-
|
|
331
|
+
if (process.env.TARO_PLATFORM === PLATFORM_TYPE.HARMONY) {
|
|
332
|
+
if (key === '__fixed') {
|
|
333
|
+
// hack: __fixed最先识别
|
|
334
|
+
fixedHandler = () => setProperty(dom, key, newProp, oldProp);
|
|
335
|
+
continue;
|
|
336
|
+
}
|
|
337
|
+
// 鸿蒙样式前置插入,防止覆盖style
|
|
338
|
+
if (key === '__hmStyle') {
|
|
339
|
+
handlers.splice(0, 0, () => setHarmonyStyle(dom, newProp, oldProp));
|
|
340
|
+
}
|
|
341
|
+
else {
|
|
342
|
+
handlers.push(() => setProperty(dom, key, newProp, oldProp));
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
else {
|
|
346
|
+
setProperty(dom, key, newProp, oldProp);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
if (process.env.TARO_PLATFORM === PLATFORM_TYPE.HARMONY) {
|
|
350
|
+
fixedHandler && fixedHandler();
|
|
351
|
+
for (let i = 0; i < handlers.length; i++) {
|
|
352
|
+
handlers[i]();
|
|
353
|
+
}
|
|
307
354
|
}
|
|
308
355
|
}
|
|
309
356
|
function getUpdatePayload(dom, oldProps, newProps) {
|
|
@@ -317,6 +364,9 @@ function getUpdatePayload(dom, oldProps, newProps) {
|
|
|
317
364
|
const isFormElement = dom instanceof FormElement;
|
|
318
365
|
for (i in newProps) {
|
|
319
366
|
if (oldProps[i] !== newProps[i] || (isFormElement && i === 'value')) {
|
|
367
|
+
// 如果都是 style,且 style 里面的值相等,则无需记录到 payload 中
|
|
368
|
+
if (i === 'style' && isObject(oldProps[i]) && isObject(newProps[i]) && isEqual(oldProps[i], newProps[i]))
|
|
369
|
+
continue;
|
|
320
370
|
(updatePayload = updatePayload || []).push(i, newProps[i]);
|
|
321
371
|
}
|
|
322
372
|
}
|
|
@@ -334,16 +384,16 @@ function setEvent(dom, name, value, oldValue) {
|
|
|
334
384
|
eventName = eventName.slice(0, -7);
|
|
335
385
|
}
|
|
336
386
|
const compName = capitalize(toCamelCase(dom.tagName.toLowerCase()));
|
|
337
|
-
if (eventName === 'click' &&
|
|
387
|
+
if (eventName === 'click' && process.env.TARO_PLATFORM !== PLATFORM_TYPE.HARMONY && compName in internalComponents) {
|
|
338
388
|
eventName = 'tap';
|
|
339
389
|
}
|
|
340
390
|
if (isFunction(value)) {
|
|
341
391
|
if (oldValue) {
|
|
342
|
-
dom.removeEventListener(eventName, oldValue,
|
|
343
|
-
dom.addEventListener(eventName, value,
|
|
392
|
+
dom.removeEventListener(eventName, oldValue, process.env.TARO_PLATFORM !== PLATFORM_TYPE.HARMONY ? false : undefined);
|
|
393
|
+
dom.addEventListener(eventName, value, process.env.TARO_PLATFORM !== PLATFORM_TYPE.HARMONY ? { isCapture, sideEffect: false } : undefined);
|
|
344
394
|
}
|
|
345
395
|
else {
|
|
346
|
-
dom.addEventListener(eventName, value,
|
|
396
|
+
dom.addEventListener(eventName, value, process.env.TARO_PLATFORM !== PLATFORM_TYPE.HARMONY ? isCapture : undefined);
|
|
347
397
|
}
|
|
348
398
|
}
|
|
349
399
|
else {
|
|
@@ -351,29 +401,85 @@ function setEvent(dom, name, value, oldValue) {
|
|
|
351
401
|
}
|
|
352
402
|
}
|
|
353
403
|
function setStyle(style, key, value) {
|
|
354
|
-
if (key[0] === '-') {
|
|
355
|
-
// 适配鸿蒙
|
|
356
|
-
if (isHarmony) {
|
|
357
|
-
style.setProperty(key, value);
|
|
358
|
-
}
|
|
359
|
-
else {
|
|
360
|
-
style.setProperty(key, value.toString());
|
|
361
|
-
}
|
|
404
|
+
if (key[0] === '-' && process.env.TARO_PLATFORM !== PLATFORM_TYPE.HARMONY) {
|
|
362
405
|
// css variables need not further judgment
|
|
406
|
+
style.setProperty(key, value.toString());
|
|
363
407
|
return;
|
|
364
408
|
}
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
409
|
+
style[key] =
|
|
410
|
+
isNumber(value) && IS_NON_DIMENSIONAL.test(key) === false
|
|
411
|
+
? (process.env.TARO_PLATFORM === PLATFORM_TYPE.HARMONY ? value + 'px' : convertNumber2PX(value))
|
|
412
|
+
: value === null
|
|
413
|
+
? ''
|
|
414
|
+
: value;
|
|
415
|
+
}
|
|
416
|
+
// 鸿蒙样式特殊处理,需要在插入顺序中前置插入,防止覆盖了style
|
|
417
|
+
function setHarmonyStyle(dom, value, oldValue) {
|
|
418
|
+
// @ts-ignore
|
|
419
|
+
const style = dom._st.hmStyle; // __hmStyle是已经被处理过的鸿蒙样式,可以直接塞进hmStyle对象内
|
|
420
|
+
if (isObject(oldValue)) {
|
|
421
|
+
for (const i in oldValue) {
|
|
422
|
+
if (!(value && i in value)) {
|
|
423
|
+
// 鸿蒙伪类特殊处理
|
|
424
|
+
if (process.env.TARO_PLATFORM === PLATFORM_TYPE.HARMONY) {
|
|
425
|
+
if (i === '::after' || i === '::before') {
|
|
426
|
+
setPseudo(dom, i, null);
|
|
427
|
+
}
|
|
428
|
+
else if (['::first-child', '::last-child', '::empty'].includes(i) || `${i}`.indexOf('::nth-child') === 0) {
|
|
429
|
+
// @ts-ignore
|
|
430
|
+
dom.set_pseudo_class(i, null);
|
|
431
|
+
}
|
|
432
|
+
else {
|
|
433
|
+
if (i === 'position' && oldValue[i] === 'fixed') {
|
|
434
|
+
// @ts-ignore
|
|
435
|
+
dom.setLayer(0);
|
|
436
|
+
}
|
|
437
|
+
else if (i === 'animationName') {
|
|
438
|
+
// @ts-ignore
|
|
439
|
+
dom.setAnimation(false);
|
|
440
|
+
}
|
|
441
|
+
style[i] = '';
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
else {
|
|
445
|
+
style[i] = '';
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
}
|
|
368
449
|
}
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
450
|
+
if (isObject(value)) {
|
|
451
|
+
for (const i in value) {
|
|
452
|
+
if (!oldValue || !isEqual(value[i], oldValue[i])) {
|
|
453
|
+
// 鸿蒙伪类特殊处理
|
|
454
|
+
if (process.env.TARO_PLATFORM === PLATFORM_TYPE.HARMONY) {
|
|
455
|
+
if (i === '::after' || i === '::before') {
|
|
456
|
+
setPseudo(dom, i, value[i]);
|
|
457
|
+
}
|
|
458
|
+
else if (['::first-child', '::last-child', '::empty'].includes(i) || i.startsWith('::nth-child')) {
|
|
459
|
+
// @ts-ignore
|
|
460
|
+
dom.set_pseudo_class(i, value[i]);
|
|
461
|
+
}
|
|
462
|
+
else {
|
|
463
|
+
if (i === 'position') {
|
|
464
|
+
if (value[i] === 'fixed' || (value[i] !== 'fixed' && (oldValue === null || oldValue === void 0 ? void 0 : oldValue[i]))) {
|
|
465
|
+
// @ts-ignore
|
|
466
|
+
dom.setLayer(value[i] === 'fixed' ? 1 : 0);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
else if (i === 'animationName') {
|
|
470
|
+
// @ts-ignore
|
|
471
|
+
dom.setAnimation(true);
|
|
472
|
+
}
|
|
473
|
+
style[i] = value[i];
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
else {
|
|
477
|
+
style[i] = value[i];
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
}
|
|
376
481
|
}
|
|
482
|
+
dom.setAttribute('__hmStyle', value);
|
|
377
483
|
}
|
|
378
484
|
function setProperty(dom, name, value, oldValue) {
|
|
379
485
|
var _a, _b;
|
|
@@ -382,6 +488,9 @@ function setProperty(dom, name, value, oldValue) {
|
|
|
382
488
|
name === 'children' ||
|
|
383
489
|
name === 'ref') ;
|
|
384
490
|
else if (name === 'style') {
|
|
491
|
+
if (/harmony.*cpp/.test(process.env.TARO_ENV || '')) {
|
|
492
|
+
return dom.setAttribute('_style4cpp', value);
|
|
493
|
+
}
|
|
385
494
|
const style = dom.style;
|
|
386
495
|
if (isString(value)) {
|
|
387
496
|
style.cssText = value;
|
|
@@ -394,26 +503,26 @@ function setProperty(dom, name, value, oldValue) {
|
|
|
394
503
|
if (isObject(oldValue)) {
|
|
395
504
|
for (const i in oldValue) {
|
|
396
505
|
if (!(value && i in value)) {
|
|
397
|
-
//
|
|
398
|
-
if (
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
else {
|
|
402
|
-
setStyle(style, i, '');
|
|
506
|
+
// Harmony特殊处理
|
|
507
|
+
if (process.env.TARO_PLATFORM === PLATFORM_TYPE.HARMONY && i === 'position' && oldValue[i] === 'fixed') {
|
|
508
|
+
// @ts-ignore
|
|
509
|
+
dom.setLayer(0);
|
|
403
510
|
}
|
|
511
|
+
setStyle(style, i, '');
|
|
404
512
|
}
|
|
405
513
|
}
|
|
406
514
|
}
|
|
407
515
|
if (isObject(value)) {
|
|
408
516
|
for (const i in value) {
|
|
409
517
|
if (!oldValue || !isEqual(value[i], oldValue[i])) {
|
|
410
|
-
//
|
|
411
|
-
if (
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
518
|
+
// Harmony特殊处理
|
|
519
|
+
if (process.env.TARO_PLATFORM === PLATFORM_TYPE.HARMONY && i === 'position') {
|
|
520
|
+
if (value[i] === 'fixed' || (value[i] !== 'fixed' && (oldValue === null || oldValue === void 0 ? void 0 : oldValue[i]))) {
|
|
521
|
+
// @ts-ignore
|
|
522
|
+
dom.setLayer(value[i] === 'fixed' ? 1 : 0);
|
|
523
|
+
}
|
|
416
524
|
}
|
|
525
|
+
setStyle(style, i, value[i]);
|
|
417
526
|
}
|
|
418
527
|
}
|
|
419
528
|
}
|
|
@@ -528,8 +637,7 @@ const hostConfig = {
|
|
|
528
637
|
// Microtasks
|
|
529
638
|
// (optional)
|
|
530
639
|
// -------------------
|
|
531
|
-
|
|
532
|
-
supportsMicrotasks: process.env.TARO_PLATFORM !== 'harmony',
|
|
640
|
+
supportsMicrotasks: true,
|
|
533
641
|
scheduleMicrotask: isUndefined(Promise)
|
|
534
642
|
? setTimeout
|
|
535
643
|
: (callback) => Promise.resolve(null)
|
|
@@ -554,6 +662,11 @@ const hostConfig = {
|
|
|
554
662
|
},
|
|
555
663
|
commitMount: noop,
|
|
556
664
|
commitUpdate(dom, updatePayload, _, oldProps, newProps) {
|
|
665
|
+
if (!updatePayload)
|
|
666
|
+
return;
|
|
667
|
+
// payload 只包含 children 的时候,不应该再继续触发后续的属性比较和更新的逻辑了
|
|
668
|
+
if (updatePayload.length === 2 && updatePayload.includes('children'))
|
|
669
|
+
return;
|
|
557
670
|
updatePropsByPayload(dom, oldProps, updatePayload);
|
|
558
671
|
updateFiberProps(dom, newProps);
|
|
559
672
|
},
|
|
@@ -823,14 +936,17 @@ function createPortal(children, containerInfo, key) {
|
|
|
823
936
|
implementation: null
|
|
824
937
|
};
|
|
825
938
|
}
|
|
939
|
+
const flushSync = TaroReconciler.flushSync;
|
|
826
940
|
var index = {
|
|
827
941
|
render,
|
|
942
|
+
flushSync,
|
|
828
943
|
createRoot,
|
|
829
944
|
unstable_batchedUpdates,
|
|
830
945
|
unmountComponentAtNode,
|
|
831
946
|
findDOMNode,
|
|
832
|
-
createPortal
|
|
947
|
+
createPortal,
|
|
948
|
+
internalInstanceKey
|
|
833
949
|
};
|
|
834
950
|
|
|
835
|
-
export { createPortal, createRoot, index as default, findDOMNode, render, unmountComponentAtNode, unstable_batchedUpdates };
|
|
951
|
+
export { createPortal, createRoot, index as default, findDOMNode, flushSync, internalInstanceKey, render, unmountComponentAtNode, unstable_batchedUpdates };
|
|
836
952
|
//# sourceMappingURL=react.esm.js.map
|