Skip to content

Commit

Permalink
Create ReactFabric.stopSurface and use that for bridgeless mode bindi…
Browse files Browse the repository at this point in the history
…ng (#16164)
  • Loading branch information
ejanzer authored and Brian Vaughn committed Jan 10, 2020
1 parent 05e487a commit d8570ec
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions packages/react-native-renderer/src/ReactFabric.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,13 @@ const ReactFabric: ReactFabricType = {
return getPublicRootInstance(root);
},

// Deprecated - this function is being renamed to stopSurface, use that instead.
// TODO (T47576999): Delete this once it's no longer called from native code.
unmountComponentAtNode(containerTag: number) {
this.stopSurface(containerTag);
},

stopSurface(containerTag: number) {
const root = roots.get(containerTag);
if (root) {
// TODO: Is it safe to reset this now or should I wait since this unmount could be deferred?
Expand Down
6 changes: 5 additions & 1 deletion scripts/rollup/shims/react-native/ReactFabric.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ if (__DEV__) {
ReactFabric = require('../implementations/ReactFabric-prod');
}

BatchedBridge.registerCallableModule('ReactFabric', ReactFabric);
if (global.RN$Bridgeless) {
global.RN$stopSurface = ReactFabric.stopSurface;
} else {
BatchedBridge.registerCallableModule('ReactFabric', ReactFabric);
}

module.exports = (ReactFabric: ReactNativeType);

0 comments on commit d8570ec

Please sign in to comment.