Skip to content

Commit

Permalink
Animated: Delete getNode() on Refs
Browse files Browse the repository at this point in the history
Summary:
In 0.62, `createAnimatedComponent` was changed to use `forwardRef` instead of requiring callers to use `ref.getNode()`. In order to preserve backward-compatibility, `ref.getNode()` was monkey-patched onto the returned ref, if possible, to return the `ref` and output a console warning.

Three major (well, technically, minor) releases later, we are dropping support for `getNode()`. Calling it on the `ref` of an animated component will begin to fail after this (unless the underlying component itself actually implements a `getNode()` method on its imperative handle).

Changelog:
[General][Removed] - Removed `getNode()` from animated component refs.

Reviewed By: nadiia

Differential Revision: D27979882

fbshipit-source-id: 885c3dbf4f2749c994fc2662dd6f16ff3dd887c7
  • Loading branch information
yungsters authored and facebook-github-bot committed Apr 25, 2021
1 parent 1b59263 commit b914153
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions Libraries/Animated/createAnimatedComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,19 +198,6 @@ function createAnimatedComponent<Props: {+[string]: mixed, ...}, Instance>(
setLocalRef: ref => {
this._prevComponent = this._component;
this._component = ref;

// TODO: Delete this in a future release.
if (ref != null && ref.getNode == null) {
ref.getNode = () => {
console.warn(
'%s: Calling `getNode()` on the ref of an Animated component ' +
'is no longer necessary. You can now directly use the ref ' +
'instead. This method will be removed in a future release.',
ref.constructor.name ?? '<<anonymous>>',
);
return ref;
};
}
},
});

Expand Down

0 comments on commit b914153

Please sign in to comment.