Skip to content

Commit 11eb8f8

Browse files
committed
don't process too early, just don't set the function prop to true if we have a process function
1 parent 12b2e7d commit 11eb8f8

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

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

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -294,23 +294,15 @@ function diffProperties(
294294
prevProp = prevProps[propKey];
295295
nextProp = nextProps[propKey];
296296

297-
if (typeof nextProp === 'function') {
298-
if (typeof attributeConfig === 'object') {
299-
// When the config for a function prop has a custom process method
300-
// we don't assume its a regular event handler, but use the process method:
301-
nextProp = attributeConfig.process(nextProp);
302-
if (typeof prevProp === 'function') {
303-
prevProp = attributeConfig.process(prevProp);
304-
}
305-
} else {
306-
// functions are converted to booleans as markers that the associated
307-
// events should be sent from native.
308-
nextProp = (true: any);
309-
// If nextProp is not a function, then don't bother changing prevProp
310-
// since nextProp will win and go into the updatePayload regardless.
311-
if (typeof prevProp === 'function') {
312-
prevProp = (true: any);
313-
}
297+
const attributeConfigHasProcess = typeof attributeConfig === 'object' && typeof attributeConfig.process === 'function';
298+
if (typeof nextProp === 'function' && !attributeConfigHasProcess) {
299+
// functions are converted to booleans as markers that the associated
300+
// events should be sent from native.
301+
nextProp = (true: any);
302+
// If nextProp is not a function, then don't bother changing prevProp
303+
// since nextProp will win and go into the updatePayload regardless.
304+
if (typeof prevProp === 'function') {
305+
prevProp = (true: any);
314306
}
315307
}
316308

0 commit comments

Comments
 (0)