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
2 changes: 1 addition & 1 deletion packages/react-native/Libraries/Animated/Animated.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import Platform from '../Utilities/Platform';
import AnimatedImplementation from './AnimatedImplementation';
import AnimatedMock from './AnimatedMock';

const Animated = ((Platform.isTesting
const Animated = ((Platform.isDisableAnimations
? AnimatedMock
: AnimatedImplementation): typeof AnimatedImplementation);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function configureNext(
onAnimationDidEnd?: OnAnimationDidEndCallback,
onAnimationDidFail?: OnAnimationDidFailCallback,
) {
if (Platform.isTesting) {
if (Platform.isDisableAnimations) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry';
export interface Spec extends TurboModule {
+getConstants: () => {|
isTesting: boolean,
isDisableAnimations?: boolean,
reactNativeVersion: {|
major: number,
minor: number,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry';
export interface Spec extends TurboModule {
+getConstants: () => {|
isTesting: boolean,
isDisableAnimations?: boolean,
reactNativeVersion: {|
major: number,
minor: number,
Expand Down
6 changes: 6 additions & 0 deletions packages/react-native/Libraries/Utilities/Platform.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const Platform = {
// $FlowFixMe[unsafe-getters-setters]
get constants(): {|
isTesting: boolean,
isDisableAnimations?: boolean,
reactNativeVersion: {|
major: number,
minor: number,
Expand Down Expand Up @@ -61,6 +62,11 @@ const Platform = {
return false;
},
// $FlowFixMe[unsafe-getters-setters]
get isDisableAnimations(): boolean {
// $FlowFixMe[object-this-reference]
return this.constants.isDisableAnimations ?? this.isTesting;
},
// $FlowFixMe[unsafe-getters-setters]
get isTV(): boolean {
// $FlowFixMe[object-this-reference]
return this.constants.uiMode === 'tv';
Expand Down
1 change: 1 addition & 0 deletions packages/react-native/Libraries/Utilities/Platform.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export type PlatformOSType =
| 'native';
type PlatformConstants = {
isTesting: boolean;
isDisableAnimations?: boolean | undefined;
reactNativeVersion: {
major: number;
minor: number;
Expand Down
6 changes: 6 additions & 0 deletions packages/react-native/Libraries/Utilities/Platform.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const Platform = {
forceTouchAvailable: boolean,
interfaceIdiom: string,
isTesting: boolean,
isDisableAnimations?: boolean,
osVersion: string,
reactNativeVersion: {|
major: number,
Expand Down Expand Up @@ -65,6 +66,11 @@ const Platform = {
}
return false;
},
// $FlowFixMe[unsafe-getters-setters]
get isDisableAnimations(): boolean {
// $FlowFixMe[object-this-reference]
return this.constants.isDisableAnimations ?? this.isTesting;
},
select: <T>(spec: PlatformSelectSpec<T>): T =>
// $FlowFixMe[incompatible-return]
'ios' in spec ? spec.ios : 'native' in spec ? spec.native : spec.default,
Expand Down