Skip to content

Commit

Permalink
Animated: Change nativeID to Private Property
Browse files Browse the repository at this point in the history
Summary:
Changes `_nativeId` to be a private property in the `Animation` class (from Animated).

Changelog:
[Internal]

Differential Revision: D63572065
  • Loading branch information
yungsters authored and facebook-github-bot committed Sep 28, 2024
1 parent 79f3119 commit cc0bbb3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
11 changes: 5 additions & 6 deletions packages/react-native/Libraries/Animated/animations/Animation.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,14 @@ let startNativeAnimationNextId = 1;
// Once an animation has been stopped or finished its course, it will
// not be reused.
export default class Animation {
#nativeID: ?number;
#onEnd: ?EndCallback;

__active: boolean;
__isInteraction: boolean;
__iterations: number;
__isLooping: ?boolean;

_nativeId: number;

start(
fromValue: number,
onUpdate: (value: number) => void,
Expand All @@ -56,8 +55,8 @@ export default class Animation {
}

stop(): void {
if (this._nativeId) {
NativeAnimatedHelper.API.stopAnimation(this._nativeId);
if (this.#nativeID != null) {
NativeAnimatedHelper.API.stopAnimation(this.#nativeID);
}
}

Expand Down Expand Up @@ -98,9 +97,9 @@ export default class Animation {
try {
const config = this.__getNativeAnimationConfig();
animatedValue.__makeNative(config.platformConfig);
this._nativeId = NativeAnimatedHelper.generateNewAnimationId();
this.#nativeID = NativeAnimatedHelper.generateNewAnimationId();
NativeAnimatedHelper.API.startAnimatingNode(
this._nativeId,
this.#nativeID,
animatedValue.__getNativeTag(),
config,
result => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,6 @@ declare export default class Animation {
__isInteraction: boolean;
__iterations: number;
__isLooping: ?boolean;
_nativeId: number;
start(
fromValue: number,
onUpdate: (value: number) => void,
Expand Down

0 comments on commit cc0bbb3

Please sign in to comment.