Skip to content

Commit a2cc692

Browse files
committed
add is object chec
1 parent 2d205b9 commit a2cc692

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

packages/react-native-renderer/src/ReactNativeAttributePayloadFabric.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ import {
1414
} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
1515
import isArray from 'shared/isArray';
1616

17-
import {enableShallowPropDiffing} from 'shared/ReactFeatureFlags';
17+
import { enableShallowPropDiffing } from 'shared/ReactFeatureFlags';
1818

19-
import type {AttributeConfiguration} from './ReactNativeTypes';
19+
import type { AttributeConfiguration } from './ReactNativeTypes';
2020

2121
const emptyObject = {};
2222

@@ -32,7 +32,7 @@ const emptyObject = {};
3232
type NestedNode = Array<NestedNode> | Object;
3333

3434
// Tracks removed keys
35-
let removedKeys: {[string]: boolean} | null = null;
35+
let removedKeys: { [string]: boolean } | null = null;
3636
let removedKeyCount = 0;
3737

3838
const deepDifferOptions = {
@@ -344,7 +344,7 @@ function diffProperties(
344344
// case: !Object is the default case
345345
if (enableShallowPropDiffing || defaultDiffer(prevProp, nextProp)) {
346346
// a normal leaf has changed
347-
(updatePayload || (updatePayload = ({}: {[string]: $FlowFixMe})))[
347+
(updatePayload || (updatePayload = ({}: { [string]: $FlowFixMe })))[
348348
propKey
349349
] = nextProp;
350350
}
@@ -363,9 +363,9 @@ function diffProperties(
363363
const nextValue =
364364
typeof attributeConfig.process === 'function'
365365
? // $FlowFixMe[incompatible-use] found when upgrading Flow
366-
attributeConfig.process(nextProp)
366+
attributeConfig.process(nextProp)
367367
: nextProp;
368-
(updatePayload || (updatePayload = ({}: {[string]: $FlowFixMe})))[
368+
(updatePayload || (updatePayload = ({}: { [string]: $FlowFixMe })))[
369369
propKey
370370
] = nextValue;
371371
}
@@ -421,11 +421,11 @@ function diffProperties(
421421
) {
422422
// case: CustomAttributeConfiguration | !Object
423423
// Flag the leaf property for removal by sending a sentinel.
424-
(updatePayload || (updatePayload = ({}: {[string]: $FlowFixMe})))[
424+
(updatePayload || (updatePayload = ({}: { [string]: $FlowFixMe })))[
425425
propKey
426426
] = null;
427427
if (!removedKeys) {
428-
removedKeys = ({}: {[string]: boolean});
428+
removedKeys = ({}: { [string]: boolean });
429429
}
430430
if (!removedKeys[propKey]) {
431431
removedKeys[propKey] = true;
@@ -478,7 +478,7 @@ function fastAddProperties(
478478
} else {
479479
continue;
480480
}
481-
} else if (typeof attributeConfig.process === 'function') {
481+
} else if (typeof attributeConfig === 'object' && typeof attributeConfig.process === 'function') {
482482
// An atomic prop with custom processing.
483483
newValue = attributeConfig.process(prop);
484484
} else if (typeof prop === 'function') {
@@ -494,7 +494,7 @@ function fastAddProperties(
494494

495495
if (newValue !== undefined) {
496496
if (!payload) {
497-
payload = ({}: {[string]: $FlowFixMe});
497+
payload = ({}: { [string]: $FlowFixMe });
498498
}
499499
payload[propKey] = newValue;
500500
continue;

0 commit comments

Comments
 (0)