Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions packages/react-native/Libraries/LayoutAnimation/LayoutAnimation.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,25 @@ import * as ReactNativeFeatureFlags from '../../src/private/featureflags/ReactNa
import {getFabricUIManager} from '../ReactNative/FabricUIManager';
import Platform from '../Utilities/Platform';

export type {
LayoutAnimationType,
LayoutAnimationProperty,
LayoutAnimationAnimationConfig as LayoutAnimationAnim,
} from '../Renderer/shims/ReactNativeTypes';

const UIManager = require('../ReactNative/UIManager').default;

// Reexport type
export type LayoutAnimationConfig = LayoutAnimationConfig_;

export type LayoutAnimationTypes = $ReadOnly<{
[type in LayoutAnimationType]: type,
}>;

export type LayoutAnimationProperties = $ReadOnly<{
[prop in LayoutAnimationProperty]: prop,
}>;

type OnAnimationDidEndCallback = () => void;
type OnAnimationDidFailCallback = () => void;

Expand Down Expand Up @@ -103,8 +117,8 @@ function configureNext(

function create(
duration: number,
type: LayoutAnimationType,
property: LayoutAnimationProperty,
type?: LayoutAnimationType,
property?: LayoutAnimationProperty,
): LayoutAnimationConfig {
return {
duration,
Expand Down Expand Up @@ -174,13 +188,13 @@ const LayoutAnimation = {
easeIn: 'easeIn',
easeOut: 'easeOut',
keyboard: 'keyboard',
}) as $ReadOnly<{[K in LayoutAnimationType]: K}>,
}) as LayoutAnimationTypes,
Properties: Object.freeze({
opacity: 'opacity',
scaleX: 'scaleX',
scaleY: 'scaleY',
scaleXY: 'scaleXY',
}) as $ReadOnly<{[K in LayoutAnimationProperty]: K}>,
}) as LayoutAnimationProperties,
checkConfig(...args: Array<mixed>) {
console.error('LayoutAnimation.checkConfig(...) has been disabled.');
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4921,7 +4921,18 @@ declare export default typeof TouchHistoryMath;
`;

exports[`public API should not change unintentionally Libraries/LayoutAnimation/LayoutAnimation.js 1`] = `
"export type LayoutAnimationConfig = LayoutAnimationConfig_;
"export type {
LayoutAnimationType,
LayoutAnimationProperty,
LayoutAnimationAnimationConfig as LayoutAnimationAnim,
} from \\"../Renderer/shims/ReactNativeTypes\\";
export type LayoutAnimationConfig = LayoutAnimationConfig_;
export type LayoutAnimationTypes = $ReadOnly<{
[type in LayoutAnimationType]: type,
}>;
export type LayoutAnimationProperties = $ReadOnly<{
[prop in LayoutAnimationProperty]: prop,
}>;
type OnAnimationDidEndCallback = () => void;
type OnAnimationDidFailCallback = () => void;
declare function setEnabled(value: boolean): void;
Expand All @@ -4932,8 +4943,8 @@ declare function configureNext(
): void;
declare function create(
duration: number,
type: LayoutAnimationType,
property: LayoutAnimationProperty
type?: LayoutAnimationType,
property?: LayoutAnimationProperty
): LayoutAnimationConfig;
declare const Presets: {
easeInEaseOut: LayoutAnimationConfig,
Expand All @@ -4943,8 +4954,8 @@ declare const Presets: {
declare const LayoutAnimation: {
configureNext: configureNext,
create: create,
Types: $ReadOnly<{ [K in LayoutAnimationType]: K }>,
Properties: $ReadOnly<{ [K in LayoutAnimationProperty]: K }>,
Types: LayoutAnimationTypes,
Properties: LayoutAnimationProperties,
checkConfig(...args: Array<mixed>): void,
Presets: Presets,
easeInEaseOut: (onAnimationDidEnd?: OnAnimationDidEndCallback) => void,
Expand Down
1 change: 1 addition & 0 deletions scripts/build/build-types/buildTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const ENTRY_POINTS = [
'packages/react-native/Libraries/EventEmitter/NativeEventEmitter.js',
'packages/react-native/Libraries/EventEmitter/RCTDeviceEventEmitter.js',
'packages/react-native/Libraries/EventEmitter/RCTNativeAppEventEmitter.js',
'packages/react-native/Libraries/LayoutAnimation/LayoutAnimation.js',
'packages/react-native/Libraries/LogBox/LogBox.js',
'packages/react-native/Libraries/Performance/Systrace.js',
'packages/react-native/Libraries/ReactNative/I18nManager.js',
Expand Down