mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
## Summary I refactored this code in #26290 but forgot to add guards when the fiber or the state node where null, and this is typed as `any` so Flow didn't catch it. This restores the same logic to guard against null. ## How did you test this change? Existing tests.
33 lines
810 B
JavaScript
33 lines
810 B
JavaScript
/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @flow
|
|
*/
|
|
|
|
const ReactFabricGlobalResponderHandler = {
|
|
onChange: function (from: any, to: any, blockNativeResponder: boolean) {
|
|
if (from && from.stateNode) {
|
|
// equivalent to clearJSResponder
|
|
nativeFabricUIManager.setIsJSResponder(
|
|
from.stateNode.node,
|
|
false,
|
|
blockNativeResponder || false,
|
|
);
|
|
}
|
|
|
|
if (to && to.stateNode) {
|
|
// equivalent to setJSResponder
|
|
nativeFabricUIManager.setIsJSResponder(
|
|
to.stateNode.node,
|
|
true,
|
|
blockNativeResponder || false,
|
|
);
|
|
}
|
|
},
|
|
};
|
|
|
|
export default ReactFabricGlobalResponderHandler;
|