Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
import Animated, {
Extrapolation,
interpolate,
SharedValue,
useAnimatedStyle,
useDerivedValue,
useSharedValue,
Expand Down Expand Up @@ -101,10 +102,10 @@ const styles = StyleSheet.create({
type ButtonProps = {
item: string;
index: number;
activeIndex: Animated.SharedValue<number>;
activeIndex: SharedValue<number>;
width: number;
position: number;
readonly indicatorPosition: Animated.SharedValue<number>;
readonly indicatorPosition: SharedValue<number>;
};
function Button({
item,
Expand Down Expand Up @@ -146,7 +147,7 @@ function Button({
type ActiveIconProps = {
item: string;
index: number;
activeIndex: Animated.SharedValue<number>;
activeIndex: SharedValue<number>;
width: number;
};
function ActiveIcon({ item, index, activeIndex }: ActiveIconProps) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Dimensions, StyleSheet, View } from 'react-native';
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
import Animated, {
clamp,
SharedValue,
useAnimatedStyle,
useDerivedValue,
useSharedValue,
Expand Down Expand Up @@ -81,8 +82,8 @@ function ChatHeads({
}

type FollowersProps = {
readonly transX: Animated.SharedValue<number>;
readonly transY: Animated.SharedValue<number>;
readonly transX: SharedValue<number>;
readonly transY: SharedValue<number>;
};

function Followers({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ import { StyleSheet, View } from 'react-native';
import Animated, {
Extrapolation,
interpolate,
SharedValue,
useAnimatedStyle,
} from 'react-native-reanimated';

function PaginationElement({
position,
slideIndex,
}: {
position: Animated.SharedValue<number>;
position: SharedValue<number>;
slideIndex: number;
}) {
const inputRange = [slideIndex - 1, slideIndex, slideIndex + 1];
Expand Down Expand Up @@ -48,7 +49,7 @@ export function Pagination({
position,
}: {
numberOfSlides: number;
position: Animated.SharedValue<number>;
position: SharedValue<number>;
}) {
return (
<View style={styles.pagination}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import { StyleSheet, Text } from 'react-native';
import Animated, {
interpolate,
SharedValue,
useAnimatedScrollHandler,
useAnimatedStyle,
useSharedValue,
Expand Down Expand Up @@ -81,7 +82,7 @@ function Item({
}: {
item: number;
index: number;
scrollPosition: Animated.SharedValue<number>;
scrollPosition: SharedValue<number>;
}) {
const style = useAnimatedStyle(() => {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ import { Dimensions, Text } from 'react-native';
import Animated, {
Extrapolation,
interpolate,
SharedValue,
useAnimatedStyle,
} from 'react-native-reanimated';

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

type ButtonProps = {
progress: Animated.SharedValue<number>;
y: Animated.SharedValue<number>;
progress: SharedValue<number>;
y: SharedValue<number>;
};

export default function LiquidButton({ progress, y }: ButtonProps) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { ReactElement, ReactNode } from 'react';
import React, { useRef } from 'react';
import { Platform, SafeAreaView, StyleSheet, Text, View } from 'react-native';
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
import type { AnimatedRef } from 'react-native-reanimated';
import type { AnimatedRef, SharedValue } from 'react-native-reanimated';
import Animated, {
Easing,
measure,
Expand Down Expand Up @@ -89,8 +89,8 @@ export default function OldMeasureExample() {

type SectionProps = {
title: string;
height: Animated.SharedValue<number>;
contentHeight: Animated.SharedValue<number>;
height: SharedValue<number>;
contentHeight: SharedValue<number>;
z: number;
show: boolean;
};
Expand Down Expand Up @@ -156,7 +156,7 @@ function asyncMeasure(
type SectionHeaderProps = {
title: string;
animatedRef: AnimatedRef<React.Component>;
contentHeight: Animated.SharedValue<number>;
contentHeight: SharedValue<number>;
show: boolean;
};

Expand Down
6 changes: 3 additions & 3 deletions apps/common-app/src/apps/reanimated/examples/PinExample.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { Platform, SafeAreaView, StyleSheet, Text, View } from 'react-native';
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
import type { SharedValue } from 'react-native-reanimated';
import { SharedValue } from 'react-native-reanimated';
import Animated, {
scrollTo,
useAnimatedRef,
Expand Down Expand Up @@ -43,7 +43,7 @@ function useDigit(number: SharedValue<number>, i: number) {
});
}

function NumberDisplay({ number }: { number: Animated.SharedValue<number> }) {
function NumberDisplay({ number }: { number: SharedValue<number> }) {
return (
<View style={styles.numberContainerOuter}>
<View style={styles.numberContainerInner}>
Expand Down Expand Up @@ -90,7 +90,7 @@ function Digit({ number, index }: DigitProps) {
);
}

function ProgressBar({ progress }: { progress: Animated.SharedValue<number> }) {
function ProgressBar({ progress }: { progress: SharedValue<number> }) {
const x = useSharedValue(0);
const startX = useSharedValue(0);
const max = useSharedValue(0);
Expand Down
84 changes: 0 additions & 84 deletions packages/react-native-reanimated/src/Animated.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,4 @@
'use strict';
import type {
AnimatedTransform as _AnimatedTransform,
AnimateStyle as _AnimateStyle,
EasingFunction as _EasingFunction,
SharedValue as _SharedValue,
StylesOrDefault as _StylesOrDefault,
} from './commonTypes';
import type { FlatListPropsWithLayout as _FlatListPropsWithLayout } from './component/FlatList';
import type { AnimatedScrollViewProps as _AnimatedScrollViewProps } from './component/ScrollView';
import type {
Adaptable as _Adaptable,
AdaptTransforms as _AdaptTransforms,
AnimateProps as _AnimateProps,
TransformStyleTypes as _TransformStyleTypes,
} from './helperTypes';
import type { DerivedValue as _DerivedValue } from './hook/useDerivedValue';
import type { Extrapolate as _Extrapolate } from './interpolateColor';

export { ReanimatedFlatList as FlatList } from './component/FlatList';
export { AnimatedImage as Image } from './component/Image';
export { AnimatedScrollView as ScrollView } from './component/ScrollView';
Expand All @@ -27,69 +9,3 @@ export {
addWhitelistedUIProps,
} from './ConfigHelper';
export { createAnimatedComponent } from './createAnimatedComponent';
/**
* @deprecated Please import `Extrapolate` directly from
* `react-native-reanimated` instead of `Animated` namespace.
*/
export type Extrapolate = typeof _Extrapolate;
/**
* @deprecated Please import `SharedValue` directly from
* `react-native-reanimated` instead of `Animated` namespace.
*/

export type SharedValue<T> = _SharedValue<T>;
/**
* @deprecated Please import `DerivedValue` directly from
* `react-native-reanimated` instead of `Animated` namespace.
*/
export type DerivedValue<T> = _DerivedValue<T>;
/**
* @deprecated Please import `Adaptable` directly from `react-native-reanimated`
* instead of `Animated` namespace.
*/
export type Adaptable<T> = _Adaptable<T>;
/**
* @deprecated Please import `TransformStyleTypes` directly from
* `react-native-reanimated` instead of `Animated` namespace.
*/
export type TransformStyleTypes = _TransformStyleTypes;
/**
* @deprecated Please import `AdaptTransforms` directly from
* `react-native-reanimated` instead of `Animated` namespace.
*/
export type AdaptTransforms<T> = _AdaptTransforms<T>;
/**
* @deprecated Please import `AnimatedTransform` directly from
* `react-native-reanimated` instead of `Animated` namespace.
*/
export type AnimatedTransform = _AnimatedTransform;
/**
* @deprecated Please import `AnimateStyle` directly from
* `react-native-reanimated` instead of `Animated` namespace.
*/
export type AnimateStyle<S> = _AnimateStyle<S>;
/**
* @deprecated Please import `StylesOrDefault` directly from
* `react-native-reanimated` instead of `Animated` namespace.
*/
export type StylesOrDefault<S> = _StylesOrDefault<S>;
/**
* @deprecated Please import `AnimateProps` directly from
* `react-native-reanimated` instead of `Animated` namespace.
*/
export type AnimateProps<P extends object> = _AnimateProps<P>;
/**
* @deprecated Please import `EasingFunction` directly from
* `react-native-reanimated` instead of `Animated` namespace.
*/
export type EasingFunction = _EasingFunction;
/**
* @deprecated Please import `AnimatedScrollViewProps` directly from
* `react-native-reanimated` instead of `Animated` namespace.
*/
export type AnimatedScrollViewProps = _AnimatedScrollViewProps;
/**
* @deprecated Please import `FlatListPropsWithLayout` directly from
* `react-native-reanimated` instead of `Animated` namespace.
*/
export type FlatListPropsWithLayout<T> = _FlatListPropsWithLayout<T>;
5 changes: 0 additions & 5 deletions packages/react-native-reanimated/src/Easing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,8 @@ import type { EasingFunction } from './commonTypes';
* - [`out`](docs/easing.html#out) runs an easing function backwards
*/

/** @deprecated Please use {@link EasingFunction} type instead. */
export type EasingFn = EasingFunction;

export type EasingFunctionFactory = { factory: () => EasingFunction };

/** @deprecated Please use {@link EasingFunctionFactory} type instead. */
export type EasingFactoryFn = EasingFunctionFactory;
/**
* A linear function, `f(t) = t`. Position correlates to elapsed time one to
* one.
Expand Down
8 changes: 0 additions & 8 deletions packages/react-native-reanimated/src/commonTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,11 +441,3 @@ export type AnimatedStyle<Style = DefaultStyle> =
export type AnimatedTransform = MaybeSharedValueRecursive<
TransformsStyle['transform']
>;

/** @deprecated Please use {@link AnimatedStyle} type instead. */
export type AnimateStyle<Style = DefaultStyle> = AnimatedStyle<Style>;

/** @deprecated This type is no longer relevant. */
export type StylesOrDefault<T> = 'style' extends keyof T
? MaybeSharedValueRecursive<T['style']>
: Record<string, unknown>;
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type {
import React from 'react';
import type { FlatList, FlatListProps } from 'react-native';

import type { AnimateProps } from '../helperTypes';
import type { AnimatedProps } from '../helperTypes';
import type { Options } from './AnimatedComponent';
import AnimatedComponentImpl from './AnimatedComponent';
import type {
Expand All @@ -33,19 +33,19 @@ type AnimatableComponent<C extends ComponentType<any>> = C & {
export function createAnimatedComponent<P extends object>(
component: AnimatableComponent<FunctionComponent<P>>,
options?: Options<P>
): FunctionComponent<AnimateProps<P>>;
): FunctionComponent<AnimatedProps<P>>;

export function createAnimatedComponent<P extends object>(
component: AnimatableComponent<ComponentClass<P>>,
options?: Options<P>
): ComponentClass<AnimateProps<P>>;
): ComponentClass<AnimatedProps<P>>;

export function createAnimatedComponent<P extends object>(
// Actually ComponentType<P = {}> = ComponentClass<P> | FunctionComponent<P> but we need this overload too
// since some external components (like FastImage) are typed just as ComponentType
component: AnimatableComponent<ComponentType<P>>,
options?: Options<P>
): FunctionComponent<AnimateProps<P>> | ComponentClass<AnimateProps<P>>;
): FunctionComponent<AnimatedProps<P>> | ComponentClass<AnimatedProps<P>>;

/**
* @deprecated Please use `Animated.FlatList` component instead of calling
Expand All @@ -55,7 +55,7 @@ export function createAnimatedComponent<P extends object>(
export function createAnimatedComponent(
component: AnimatableComponent<typeof FlatList<unknown>>,
options?: Options<typeof FlatList<unknown>>
): ComponentClass<AnimateProps<FlatListProps<unknown>>>;
): ComponentClass<AnimatedProps<FlatListProps<unknown>>>;

export function createAnimatedComponent(
Component: AnimatableComponent<ComponentType<InitialComponentProps>>,
Expand Down
25 changes: 1 addition & 24 deletions packages/react-native-reanimated/src/helperTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ until time comes to refactor the code and get necessary types right.
This will not be easy though!
*/

import type { RegisteredStyle, StyleProp } from 'react-native';
import type { StyleProp } from 'react-native';

import type {
AnimatedStyle,
EntryExitAnimationFunction,
LayoutAnimationFunction,
SharedValue,
TransformArrayItem,
} from './commonTypes';
import type { AddArrayPropertyType } from './css/types';
import type { BaseAnimationBuilder } from './layoutReanimation/animationBuilder/BaseAnimationBuilder';
Expand Down Expand Up @@ -104,25 +103,3 @@ export type AnimatedProps<Props extends object> = RestProps<Props> &
};

// THE LAND OF THE DEPRECATED

/** @deprecated This type is no longer relevant. */
export type Adaptable<T> =
| T
| ReadonlyArray<T | ReadonlyArray<T>>
| SharedValue<T>;

/** @deprecated This type is no longer relevant. */
export type AdaptTransforms<T> = {
[P in keyof T]: Adaptable<T[P]>;
};

/** @deprecated Please use {@link TransformArrayItem} type instead. */
export type TransformStyleTypes = TransformArrayItem;

/** @deprecated This type is no longer relevant. */
export type AnimatedStyleProp<T> =
| AnimatedStyle<T>
| RegisteredStyle<AnimatedStyle<T>>;

/** @deprecated Please use {@link AnimatedProps} type instead. */
export type AnimateProps<Props extends object> = AnimatedProps<Props>;
Loading