Skip to content

Commit 40c7352

Browse files
authored
chore: Remove deprecated types from library and examples (#7910)
## Summary This PR removes types that are deprecated for a long time. We might have done that before the stable v4 release, but I think that there's nothing wrong to remove them in the `4.1.0`.
1 parent 18b2030 commit 40c7352

File tree

13 files changed

+30
-159
lines changed

13 files changed

+30
-159
lines changed

apps/common-app/src/apps/reanimated/examples/AnimatedTabBarExample.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
import Animated, {
1111
Extrapolation,
1212
interpolate,
13+
SharedValue,
1314
useAnimatedStyle,
1415
useDerivedValue,
1516
useSharedValue,
@@ -101,10 +102,10 @@ const styles = StyleSheet.create({
101102
type ButtonProps = {
102103
item: string;
103104
index: number;
104-
activeIndex: Animated.SharedValue<number>;
105+
activeIndex: SharedValue<number>;
105106
width: number;
106107
position: number;
107-
readonly indicatorPosition: Animated.SharedValue<number>;
108+
readonly indicatorPosition: SharedValue<number>;
108109
};
109110
function Button({
110111
item,
@@ -146,7 +147,7 @@ function Button({
146147
type ActiveIconProps = {
147148
item: string;
148149
index: number;
149-
activeIndex: Animated.SharedValue<number>;
150+
activeIndex: SharedValue<number>;
150151
width: number;
151152
};
152153
function ActiveIcon({ item, index, activeIndex }: ActiveIconProps) {

apps/common-app/src/apps/reanimated/examples/ChatHeadsExample.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Dimensions, StyleSheet, View } from 'react-native';
33
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
44
import Animated, {
55
clamp,
6+
SharedValue,
67
useAnimatedStyle,
78
useDerivedValue,
89
useSharedValue,
@@ -81,8 +82,8 @@ function ChatHeads({
8182
}
8283

8384
type FollowersProps = {
84-
readonly transX: Animated.SharedValue<number>;
85-
readonly transY: Animated.SharedValue<number>;
85+
readonly transX: SharedValue<number>;
86+
readonly transY: SharedValue<number>;
8687
};
8788

8889
function Followers({

apps/common-app/src/apps/reanimated/examples/CustomHandler/Pagination.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ import { StyleSheet, View } from 'react-native';
33
import Animated, {
44
Extrapolation,
55
interpolate,
6+
SharedValue,
67
useAnimatedStyle,
78
} from 'react-native-reanimated';
89

910
function PaginationElement({
1011
position,
1112
slideIndex,
1213
}: {
13-
position: Animated.SharedValue<number>;
14+
position: SharedValue<number>;
1415
slideIndex: number;
1516
}) {
1617
const inputRange = [slideIndex - 1, slideIndex, slideIndex + 1];
@@ -48,7 +49,7 @@ export function Pagination({
4849
position,
4950
}: {
5051
numberOfSlides: number;
51-
position: Animated.SharedValue<number>;
52+
position: SharedValue<number>;
5253
}) {
5354
return (
5455
<View style={styles.pagination}>

apps/common-app/src/apps/reanimated/examples/InvertedFlatListExample.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22
import { StyleSheet, Text } from 'react-native';
33
import Animated, {
44
interpolate,
5+
SharedValue,
56
useAnimatedScrollHandler,
67
useAnimatedStyle,
78
useSharedValue,
@@ -81,7 +82,7 @@ function Item({
8182
}: {
8283
item: number;
8384
index: number;
84-
scrollPosition: Animated.SharedValue<number>;
85+
scrollPosition: SharedValue<number>;
8586
}) {
8687
const style = useAnimatedStyle(() => {
8788
return {

apps/common-app/src/apps/reanimated/examples/LiquidSwipe/LiquidButton.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@ import { Dimensions, Text } from 'react-native';
33
import Animated, {
44
Extrapolation,
55
interpolate,
6+
SharedValue,
67
useAnimatedStyle,
78
} from 'react-native-reanimated';
89

910
const { width } = Dimensions.get('window');
1011
const size = 50;
1112

1213
type ButtonProps = {
13-
progress: Animated.SharedValue<number>;
14-
y: Animated.SharedValue<number>;
14+
progress: SharedValue<number>;
15+
y: SharedValue<number>;
1516
};
1617

1718
export default function LiquidButton({ progress, y }: ButtonProps) {

apps/common-app/src/apps/reanimated/examples/OldMeasureExample.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { ReactElement, ReactNode } from 'react';
44
import React, { useRef } from 'react';
55
import { Platform, SafeAreaView, StyleSheet, Text, View } from 'react-native';
66
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
7-
import type { AnimatedRef } from 'react-native-reanimated';
7+
import type { AnimatedRef, SharedValue } from 'react-native-reanimated';
88
import Animated, {
99
Easing,
1010
measure,
@@ -89,8 +89,8 @@ export default function OldMeasureExample() {
8989

9090
type SectionProps = {
9191
title: string;
92-
height: Animated.SharedValue<number>;
93-
contentHeight: Animated.SharedValue<number>;
92+
height: SharedValue<number>;
93+
contentHeight: SharedValue<number>;
9494
z: number;
9595
show: boolean;
9696
};
@@ -156,7 +156,7 @@ function asyncMeasure(
156156
type SectionHeaderProps = {
157157
title: string;
158158
animatedRef: AnimatedRef<React.Component>;
159-
contentHeight: Animated.SharedValue<number>;
159+
contentHeight: SharedValue<number>;
160160
show: boolean;
161161
};
162162

apps/common-app/src/apps/reanimated/examples/PinExample.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import { Platform, SafeAreaView, StyleSheet, Text, View } from 'react-native';
33
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
4-
import type { SharedValue } from 'react-native-reanimated';
4+
import { SharedValue } from 'react-native-reanimated';
55
import Animated, {
66
scrollTo,
77
useAnimatedRef,
@@ -43,7 +43,7 @@ function useDigit(number: SharedValue<number>, i: number) {
4343
});
4444
}
4545

46-
function NumberDisplay({ number }: { number: Animated.SharedValue<number> }) {
46+
function NumberDisplay({ number }: { number: SharedValue<number> }) {
4747
return (
4848
<View style={styles.numberContainerOuter}>
4949
<View style={styles.numberContainerInner}>
@@ -90,7 +90,7 @@ function Digit({ number, index }: DigitProps) {
9090
);
9191
}
9292

93-
function ProgressBar({ progress }: { progress: Animated.SharedValue<number> }) {
93+
function ProgressBar({ progress }: { progress: SharedValue<number> }) {
9494
const x = useSharedValue(0);
9595
const startX = useSharedValue(0);
9696
const max = useSharedValue(0);
Lines changed: 0 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,4 @@
11
'use strict';
2-
import type {
3-
AnimatedTransform as _AnimatedTransform,
4-
AnimateStyle as _AnimateStyle,
5-
EasingFunction as _EasingFunction,
6-
SharedValue as _SharedValue,
7-
StylesOrDefault as _StylesOrDefault,
8-
} from './commonTypes';
9-
import type { FlatListPropsWithLayout as _FlatListPropsWithLayout } from './component/FlatList';
10-
import type { AnimatedScrollViewProps as _AnimatedScrollViewProps } from './component/ScrollView';
11-
import type {
12-
Adaptable as _Adaptable,
13-
AdaptTransforms as _AdaptTransforms,
14-
AnimateProps as _AnimateProps,
15-
TransformStyleTypes as _TransformStyleTypes,
16-
} from './helperTypes';
17-
import type { DerivedValue as _DerivedValue } from './hook/useDerivedValue';
18-
import type { Extrapolate as _Extrapolate } from './interpolateColor';
19-
202
export { ReanimatedFlatList as FlatList } from './component/FlatList';
213
export { AnimatedImage as Image } from './component/Image';
224
export { AnimatedScrollView as ScrollView } from './component/ScrollView';
@@ -27,69 +9,3 @@ export {
279
addWhitelistedUIProps,
2810
} from './ConfigHelper';
2911
export { createAnimatedComponent } from './createAnimatedComponent';
30-
/**
31-
* @deprecated Please import `Extrapolate` directly from
32-
* `react-native-reanimated` instead of `Animated` namespace.
33-
*/
34-
export type Extrapolate = typeof _Extrapolate;
35-
/**
36-
* @deprecated Please import `SharedValue` directly from
37-
* `react-native-reanimated` instead of `Animated` namespace.
38-
*/
39-
40-
export type SharedValue<T> = _SharedValue<T>;
41-
/**
42-
* @deprecated Please import `DerivedValue` directly from
43-
* `react-native-reanimated` instead of `Animated` namespace.
44-
*/
45-
export type DerivedValue<T> = _DerivedValue<T>;
46-
/**
47-
* @deprecated Please import `Adaptable` directly from `react-native-reanimated`
48-
* instead of `Animated` namespace.
49-
*/
50-
export type Adaptable<T> = _Adaptable<T>;
51-
/**
52-
* @deprecated Please import `TransformStyleTypes` directly from
53-
* `react-native-reanimated` instead of `Animated` namespace.
54-
*/
55-
export type TransformStyleTypes = _TransformStyleTypes;
56-
/**
57-
* @deprecated Please import `AdaptTransforms` directly from
58-
* `react-native-reanimated` instead of `Animated` namespace.
59-
*/
60-
export type AdaptTransforms<T> = _AdaptTransforms<T>;
61-
/**
62-
* @deprecated Please import `AnimatedTransform` directly from
63-
* `react-native-reanimated` instead of `Animated` namespace.
64-
*/
65-
export type AnimatedTransform = _AnimatedTransform;
66-
/**
67-
* @deprecated Please import `AnimateStyle` directly from
68-
* `react-native-reanimated` instead of `Animated` namespace.
69-
*/
70-
export type AnimateStyle<S> = _AnimateStyle<S>;
71-
/**
72-
* @deprecated Please import `StylesOrDefault` directly from
73-
* `react-native-reanimated` instead of `Animated` namespace.
74-
*/
75-
export type StylesOrDefault<S> = _StylesOrDefault<S>;
76-
/**
77-
* @deprecated Please import `AnimateProps` directly from
78-
* `react-native-reanimated` instead of `Animated` namespace.
79-
*/
80-
export type AnimateProps<P extends object> = _AnimateProps<P>;
81-
/**
82-
* @deprecated Please import `EasingFunction` directly from
83-
* `react-native-reanimated` instead of `Animated` namespace.
84-
*/
85-
export type EasingFunction = _EasingFunction;
86-
/**
87-
* @deprecated Please import `AnimatedScrollViewProps` directly from
88-
* `react-native-reanimated` instead of `Animated` namespace.
89-
*/
90-
export type AnimatedScrollViewProps = _AnimatedScrollViewProps;
91-
/**
92-
* @deprecated Please import `FlatListPropsWithLayout` directly from
93-
* `react-native-reanimated` instead of `Animated` namespace.
94-
*/
95-
export type FlatListPropsWithLayout<T> = _FlatListPropsWithLayout<T>;

packages/react-native-reanimated/src/Easing.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,8 @@ import type { EasingFunction } from './commonTypes';
4848
* - [`out`](docs/easing.html#out) runs an easing function backwards
4949
*/
5050

51-
/** @deprecated Please use {@link EasingFunction} type instead. */
52-
export type EasingFn = EasingFunction;
53-
5451
export type EasingFunctionFactory = { factory: () => EasingFunction };
5552

56-
/** @deprecated Please use {@link EasingFunctionFactory} type instead. */
57-
export type EasingFactoryFn = EasingFunctionFactory;
5853
/**
5954
* A linear function, `f(t) = t`. Position correlates to elapsed time one to
6055
* one.

packages/react-native-reanimated/src/commonTypes.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -441,11 +441,3 @@ export type AnimatedStyle<Style = DefaultStyle> =
441441
export type AnimatedTransform = MaybeSharedValueRecursive<
442442
TransformsStyle['transform']
443443
>;
444-
445-
/** @deprecated Please use {@link AnimatedStyle} type instead. */
446-
export type AnimateStyle<Style = DefaultStyle> = AnimatedStyle<Style>;
447-
448-
/** @deprecated This type is no longer relevant. */
449-
export type StylesOrDefault<T> = 'style' extends keyof T
450-
? MaybeSharedValueRecursive<T['style']>
451-
: Record<string, unknown>;

0 commit comments

Comments
 (0)