GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fabric-compatible implementation of `JSReponder` feature (#20768) · react/react@78d2f2d

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages/react-native-renderer/src
    • ReactFabricGlobalResponderHandler.js
    • __mocks__/react-native/Libraries/ReactPrivate
      • InitializeNativeFabricUIManager.js
  • scripts/flow
    • react-native-host-hooks.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/react-native-renderer/src/ReactFabricGlobalResponderHandler.js‎

Copy file name to clipboardExpand all lines: packages/react-native-renderer/src/ReactFabricGlobalResponderHandler.js
+17-4Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,24 @@ import {UIManager} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateI
1212

1313
const ReactFabricGlobalResponderHandler = {
1414
onChange: function(from: any, to: any, blockNativeResponder: boolean) {
15-
if (to !== null) {
16-
const tag = to.stateNode.canonical._nativeTag;
17-
UIManager.setJSResponder(tag, blockNativeResponder);
15+
const fromOrTo = from || to;
16+
const isFabric = !!fromOrTo.stateNode.canonical._internalInstanceHandle;
17+
18+
if (isFabric) {
19+
if (from) {
20+
nativeFabricUIManager.setIsJSResponder(from.stateNode.node, false);
21+
}
22+
23+
if (to) {
24+
nativeFabricUIManager.setIsJSResponder(to.stateNode.node, true);
25+
}
1826
} else {
19-
UIManager.clearJSResponder();
27+
if (to !== null) {
28+
const tag = to.stateNode.canonical._nativeTag;
29+
UIManager.setJSResponder(tag, blockNativeResponder);
30+
} else {
31+
UIManager.clearJSResponder();
32+
}
2033
}
2134
},
2235
};
Collapse file

‎packages/react-native-renderer/src/__mocks__/react-native/Libraries/ReactPrivate/InitializeNativeFabricUIManager.js‎

Copy file name to clipboardExpand all lines: packages/react-native-renderer/src/__mocks__/react-native/Libraries/ReactPrivate/InitializeNativeFabricUIManager.js
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ const RCTFabricUIManager = {
176176
);
177177
success(1, 1, 100, 100);
178178
}),
179+
setIsJSResponder: jest.fn(),
179180
};
180181

181182
global.nativeFabricUIManager = RCTFabricUIManager;
Collapse file

‎scripts/flow/react-native-host-hooks.js‎

Copy file name to clipboardExpand all lines: scripts/flow/react-native-host-hooks.js
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ declare var nativeFabricUIManager: {
179179
locationY: number,
180180
callback: (Fiber) => void,
181181
) => void,
182+
setIsJSResponder: (node: Node, isJsResponder: boolean) => void,
182183
...
183184
};
184185

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.