mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Animated: Make NativeAnimatedHelper Private (#46311)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/46311 A straightforward move of `NativeAnimatedHelper` into the private directory, so that it does not impact our Public API. Changelog: [Internal] Reviewed By: javache Differential Revision: D62142349 fbshipit-source-id: c93979e26e290d13e2a19fbe40d8f460ebea15fd
This commit is contained in:
committed by
Facebook GitHub Bot
parent
dea5a6ca60
commit
dda3397545
@@ -13,7 +13,7 @@
|
||||
import type {PlatformConfig} from './AnimatedPlatformConfig';
|
||||
|
||||
import {findNodeHandle} from '../ReactNative/RendererProxy';
|
||||
import NativeAnimatedHelper from './NativeAnimatedHelper';
|
||||
import NativeAnimatedHelper from '../../src/private/animated/NativeAnimatedHelper';
|
||||
import AnimatedValue from './nodes/AnimatedValue';
|
||||
import AnimatedValueXY from './nodes/AnimatedValueXY';
|
||||
import invariant from 'invariant';
|
||||
|
||||
@@ -15,7 +15,7 @@ import type AnimatedNode from '../nodes/AnimatedNode';
|
||||
import type AnimatedValue from '../nodes/AnimatedValue';
|
||||
|
||||
import * as ReactNativeFeatureFlags from '../../../src/private/featureflags/ReactNativeFeatureFlags';
|
||||
import NativeAnimatedHelper from '../NativeAnimatedHelper';
|
||||
import NativeAnimatedHelper from '../../../src/private/animated/NativeAnimatedHelper';
|
||||
import AnimatedProps from '../nodes/AnimatedProps';
|
||||
|
||||
export type EndResult = {finished: boolean, value?: number, ...};
|
||||
|
||||
@@ -14,7 +14,7 @@ import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
||||
import type AnimatedValue from '../nodes/AnimatedValue';
|
||||
import type {AnimationConfig, EndCallback} from './Animation';
|
||||
|
||||
import NativeAnimatedHelper from '../NativeAnimatedHelper';
|
||||
import NativeAnimatedHelper from '../../../src/private/animated/NativeAnimatedHelper';
|
||||
import Animation from './Animation';
|
||||
|
||||
export type DecayAnimationConfig = {
|
||||
|
||||
@@ -16,7 +16,7 @@ import type AnimatedValue from '../nodes/AnimatedValue';
|
||||
import type AnimatedValueXY from '../nodes/AnimatedValueXY';
|
||||
import type {AnimationConfig, EndCallback} from './Animation';
|
||||
|
||||
import NativeAnimatedHelper from '../NativeAnimatedHelper';
|
||||
import NativeAnimatedHelper from '../../../src/private/animated/NativeAnimatedHelper';
|
||||
import AnimatedColor from '../nodes/AnimatedColor';
|
||||
import * as SpringConfig from '../SpringConfig';
|
||||
import Animation from './Animation';
|
||||
|
||||
@@ -17,7 +17,7 @@ import type AnimatedValue from '../nodes/AnimatedValue';
|
||||
import type AnimatedValueXY from '../nodes/AnimatedValueXY';
|
||||
import type {AnimationConfig, EndCallback} from './Animation';
|
||||
|
||||
import NativeAnimatedHelper from '../NativeAnimatedHelper';
|
||||
import NativeAnimatedHelper from '../../../src/private/animated/NativeAnimatedHelper';
|
||||
import AnimatedColor from '../nodes/AnimatedColor';
|
||||
import Animation from './Animation';
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
||||
|
||||
import normalizeColor from '../../StyleSheet/normalizeColor';
|
||||
import {processColorObject} from '../../StyleSheet/PlatformColorValueTypes';
|
||||
import NativeAnimatedHelper from '../NativeAnimatedHelper';
|
||||
import NativeAnimatedHelper from '../../../src/private/animated/NativeAnimatedHelper';
|
||||
import AnimatedValue, {flushValue} from './AnimatedValue';
|
||||
import AnimatedWithChildren from './AnimatedWithChildren';
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import {validateInterpolation} from '../../../src/private/animated/NativeAnimate
|
||||
import normalizeColor from '../../StyleSheet/normalizeColor';
|
||||
import processColor from '../../StyleSheet/processColor';
|
||||
import Easing from '../Easing';
|
||||
import NativeAnimatedHelper from '../NativeAnimatedHelper';
|
||||
import NativeAnimatedHelper from '../../../src/private/animated/NativeAnimatedHelper';
|
||||
import AnimatedWithChildren from './AnimatedWithChildren';
|
||||
import invariant from 'invariant';
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
||||
|
||||
import NativeAnimatedHelper from '../NativeAnimatedHelper';
|
||||
import NativeAnimatedHelper from '../../../src/private/animated/NativeAnimatedHelper';
|
||||
import invariant from 'invariant';
|
||||
|
||||
const NativeAnimatedAPI = NativeAnimatedHelper.API;
|
||||
|
||||
@@ -14,7 +14,7 @@ import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
||||
|
||||
import {findNodeHandle} from '../../ReactNative/RendererProxy';
|
||||
import {AnimatedEvent} from '../AnimatedEvent';
|
||||
import NativeAnimatedHelper from '../NativeAnimatedHelper';
|
||||
import NativeAnimatedHelper from '../../../src/private/animated/NativeAnimatedHelper';
|
||||
import AnimatedNode from './AnimatedNode';
|
||||
import AnimatedObject, {hasAnimatedNode} from './AnimatedObject';
|
||||
import AnimatedStyle from './AnimatedStyle';
|
||||
|
||||
@@ -14,7 +14,7 @@ import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
||||
import type {EndCallback} from '../animations/Animation';
|
||||
import type AnimatedValue from './AnimatedValue';
|
||||
|
||||
import NativeAnimatedHelper from '../NativeAnimatedHelper';
|
||||
import NativeAnimatedHelper from '../../../src/private/animated/NativeAnimatedHelper';
|
||||
import AnimatedNode from './AnimatedNode';
|
||||
|
||||
export default class AnimatedTracking extends AnimatedNode {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
||||
|
||||
import {validateTransform} from '../../../src/private/animated/NativeAnimatedValidation';
|
||||
import NativeAnimatedHelper from '../NativeAnimatedHelper';
|
||||
import NativeAnimatedHelper from '../../../src/private/animated/NativeAnimatedHelper';
|
||||
import AnimatedNode from './AnimatedNode';
|
||||
import AnimatedWithChildren from './AnimatedWithChildren';
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import type AnimatedNode from './AnimatedNode';
|
||||
import type AnimatedTracking from './AnimatedTracking';
|
||||
|
||||
import InteractionManager from '../../Interaction/InteractionManager';
|
||||
import NativeAnimatedHelper from '../NativeAnimatedHelper';
|
||||
import NativeAnimatedHelper from '../../../src/private/animated/NativeAnimatedHelper';
|
||||
import AnimatedInterpolation from './AnimatedInterpolation';
|
||||
import AnimatedWithChildren from './AnimatedWithChildren';
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
||||
|
||||
import NativeAnimatedHelper from '../NativeAnimatedHelper';
|
||||
import NativeAnimatedHelper from '../../../src/private/animated/NativeAnimatedHelper';
|
||||
import AnimatedNode from './AnimatedNode';
|
||||
|
||||
export default class AnimatedWithChildren extends AnimatedNode {
|
||||
|
||||
@@ -17,7 +17,7 @@ import useDebouncedEffect from '../../src/private/hooks/useDebouncedEffect';
|
||||
import {isPublicInstance as isFabricPublicInstance} from '../ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstanceUtils';
|
||||
import useRefEffect from '../Utilities/useRefEffect';
|
||||
import {AnimatedEvent} from './AnimatedEvent';
|
||||
import NativeAnimatedHelper from './NativeAnimatedHelper';
|
||||
import NativeAnimatedHelper from '../../src/private/animated/NativeAnimatedHelper';
|
||||
import AnimatedNode from './nodes/AnimatedNode';
|
||||
import AnimatedProps from './nodes/AnimatedProps';
|
||||
import AnimatedValue from './nodes/AnimatedValue';
|
||||
|
||||
@@ -383,68 +383,6 @@ declare export function isSupportedTransformProp(prop: string): boolean;
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`public API should not change unintentionally Libraries/Animated/NativeAnimatedHelper.js 1`] = `
|
||||
"declare const API: {
|
||||
getValue: (tag: number, saveValueCallback: (value: number) => void) => void,
|
||||
setWaitingForIdentifier: (id: string) => void,
|
||||
unsetWaitingForIdentifier: (id: string) => void,
|
||||
disableQueue: () => void,
|
||||
flushQueue: () => void,
|
||||
queueOperation: <Args: $ReadOnlyArray<mixed>, Fn: (...Args) => void>(
|
||||
fn: Fn,
|
||||
...args: Args
|
||||
) => void,
|
||||
createAnimatedNode: (tag: number, config: AnimatedNodeConfig) => void,
|
||||
updateAnimatedNodeConfig: (tag: number, config: AnimatedNodeConfig) => void,
|
||||
startListeningToAnimatedNodeValue: (tag: number) => void,
|
||||
stopListeningToAnimatedNodeValue: (tag: number) => void,
|
||||
connectAnimatedNodes: (parentTag: number, childTag: number) => void,
|
||||
disconnectAnimatedNodes: (parentTag: number, childTag: number) => void,
|
||||
startAnimatingNode: (
|
||||
animationId: number,
|
||||
nodeTag: number,
|
||||
config: AnimatingNodeConfig,
|
||||
endCallback: EndCallback
|
||||
) => void,
|
||||
stopAnimation: (animationId: number) => void,
|
||||
setAnimatedNodeValue: (nodeTag: number, value: number) => void,
|
||||
setAnimatedNodeOffset: (nodeTag: number, offset: number) => void,
|
||||
flattenAnimatedNodeOffset: (nodeTag: number) => void,
|
||||
extractAnimatedNodeOffset: (nodeTag: number) => void,
|
||||
connectAnimatedNodeToView: (nodeTag: number, viewTag: number) => void,
|
||||
disconnectAnimatedNodeFromView: (nodeTag: number, viewTag: number) => void,
|
||||
restoreDefaultValues: (nodeTag: number) => void,
|
||||
dropAnimatedNode: (tag: number) => void,
|
||||
addAnimatedEventToView: (
|
||||
viewTag: number,
|
||||
eventName: string,
|
||||
eventMapping: EventMapping
|
||||
) => void,
|
||||
removeAnimatedEventFromView(
|
||||
viewTag: number,
|
||||
eventName: string,
|
||||
animatedNodeTag: number
|
||||
): void,
|
||||
};
|
||||
declare function generateNewNodeTag(): number;
|
||||
declare function generateNewAnimationId(): number;
|
||||
declare function assertNativeAnimatedModule(): void;
|
||||
declare function shouldUseNativeDriver(
|
||||
config: $ReadOnly<{ ...AnimationConfig, ... }> | EventConfig
|
||||
): boolean;
|
||||
declare function transformDataType(value: number | string): number | string;
|
||||
declare export default {
|
||||
API: API,
|
||||
generateNewNodeTag: generateNewNodeTag,
|
||||
generateNewAnimationId: generateNewAnimationId,
|
||||
assertNativeAnimatedModule: assertNativeAnimatedModule,
|
||||
shouldUseNativeDriver: shouldUseNativeDriver,
|
||||
transformDataType: transformDataType,
|
||||
get nativeEventEmitter(): NativeEventEmitter,
|
||||
};
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`public API should not change unintentionally Libraries/Animated/NativeAnimatedModule.js 1`] = `
|
||||
"export * from \\"../../src/private/specs/modules/NativeAnimatedModule\\";
|
||||
declare export default typeof NativeAnimatedModule;
|
||||
|
||||
+13
-10
@@ -8,21 +8,24 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import type {EventSubscription} from '../vendor/emitter/EventEmitter';
|
||||
import type {EventConfig} from './AnimatedEvent';
|
||||
import type {AnimationConfig, EndCallback} from './animations/Animation';
|
||||
import type {EventSubscription} from '../../../Libraries/vendor/emitter/EventEmitter';
|
||||
import type {EventConfig} from '../../../Libraries/Animated/AnimatedEvent';
|
||||
import type {
|
||||
AnimationConfig,
|
||||
EndCallback,
|
||||
} from '../../../Libraries/Animated/animations/Animation';
|
||||
import type {
|
||||
AnimatedNodeConfig,
|
||||
AnimatingNodeConfig,
|
||||
EventMapping,
|
||||
} from './NativeAnimatedModule';
|
||||
} from '../../../Libraries/Animated/NativeAnimatedModule';
|
||||
|
||||
import * as ReactNativeFeatureFlags from '../../src/private/featureflags/ReactNativeFeatureFlags';
|
||||
import NativeEventEmitter from '../EventEmitter/NativeEventEmitter';
|
||||
import RCTDeviceEventEmitter from '../EventEmitter/RCTDeviceEventEmitter';
|
||||
import Platform from '../Utilities/Platform';
|
||||
import NativeAnimatedNonTurboModule from './NativeAnimatedModule';
|
||||
import NativeAnimatedTurboModule from './NativeAnimatedTurboModule';
|
||||
import * as ReactNativeFeatureFlags from '../featureflags/ReactNativeFeatureFlags';
|
||||
import NativeEventEmitter from '../../../Libraries/EventEmitter/NativeEventEmitter';
|
||||
import RCTDeviceEventEmitter from '../../../Libraries/EventEmitter/RCTDeviceEventEmitter';
|
||||
import Platform from '../../../Libraries/Utilities/Platform';
|
||||
import NativeAnimatedNonTurboModule from '../../../Libraries/Animated/NativeAnimatedModule';
|
||||
import NativeAnimatedTurboModule from '../../../Libraries/Animated/NativeAnimatedTurboModule';
|
||||
import invariant from 'invariant';
|
||||
|
||||
// TODO T69437152 @petetheheat - Delete this fork when Fabric ships to 100%.
|
||||
+10
-7
@@ -10,7 +10,7 @@
|
||||
|
||||
jest
|
||||
.clearAllMocks()
|
||||
.mock('../../BatchedBridge/NativeModules', () => ({
|
||||
.mock('../../../../Libraries/BatchedBridge/NativeModules', () => ({
|
||||
NativeAnimatedModule: {},
|
||||
PlatformConstants: {
|
||||
getConstants() {
|
||||
@@ -18,21 +18,24 @@ jest
|
||||
},
|
||||
},
|
||||
}))
|
||||
.mock('../NativeAnimatedModule')
|
||||
.mock('../../EventEmitter/NativeEventEmitter')
|
||||
.mock('../../specs/modules/NativeAnimatedModule')
|
||||
.mock('../../../../Libraries/EventEmitter/NativeEventEmitter')
|
||||
// findNodeHandle is imported from RendererProxy so mock that whole module.
|
||||
.setMock('../../ReactNative/RendererProxy', {findNodeHandle: () => 1});
|
||||
.setMock('../../../../Libraries/ReactNative/RendererProxy', {
|
||||
findNodeHandle: () => 1,
|
||||
});
|
||||
|
||||
import {format} from 'node:util';
|
||||
import * as React from 'react';
|
||||
import {createRef} from 'react';
|
||||
|
||||
const {create, unmount, update} = require('../../../jest/renderer');
|
||||
const Animated = require('../Animated').default;
|
||||
const {create, unmount, update} = require('../../../../jest/renderer');
|
||||
const Animated = require('../../../../Libraries/Animated/Animated').default;
|
||||
const NativeAnimatedHelper = require('../NativeAnimatedHelper').default;
|
||||
|
||||
describe('Native Animated', () => {
|
||||
const NativeAnimatedModule = require('../NativeAnimatedModule').default;
|
||||
const NativeAnimatedModule =
|
||||
require('../../specs/modules/NativeAnimatedModule').default;
|
||||
|
||||
beforeEach(() => {
|
||||
Object.assign(NativeAnimatedModule, {
|
||||
Reference in New Issue
Block a user