Skip to content

Commit

Permalink
chore: fixed types import from reanimated
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhom committed Apr 23, 2022
1 parent 4012a6f commit 831df9c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 36 deletions.
11 changes: 7 additions & 4 deletions src/components/bottomSheet/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import type React from 'react';
import type { ViewStyle, Insets, StyleProp } from 'react-native';
import type Animated from 'react-native-reanimated';
import type Animated, {
WithSpringConfig,
WithTimingConfig,
} from 'react-native-reanimated';
import type { PanGestureHandlerProps } from 'react-native-gesture-handler';
import type { BottomSheetHandleProps } from '../bottomSheetHandle';
import type { BottomSheetBackdropProps } from '../bottomSheetBackdrop';
Expand Down Expand Up @@ -293,14 +296,14 @@ export interface BottomSheetAnimationConfigs {
* Animation configs, this could be created by:
* - `useBottomSheetSpringConfigs`
* - `useBottomSheetTimingConfigs`
* @type Animated.WithSpringConfig | Animated.WithTimingConfig
* @type WithSpringConfig | WithTimingConfig
*/
animationConfigs?: Animated.WithSpringConfig | Animated.WithTimingConfig;
animationConfigs?: WithSpringConfig | WithTimingConfig;
}

export type AnimateToPositionType = (
position: number,
source: ANIMATION_SOURCE,
velocity?: number,
configs?: Animated.WithTimingConfig | Animated.WithSpringConfig
configs?: WithTimingConfig | WithSpringConfig
) => void;
57 changes: 25 additions & 32 deletions src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ import type {
GestureEventPayload,
PanGestureHandlerEventPayload,
} from 'react-native-gesture-handler';
import type Animated from 'react-native-reanimated';
import type Animated, {
WithSpringConfig,
WithTimingConfig,
} from 'react-native-reanimated';
import type { GESTURE_SOURCE } from './constants';

//#region Methods
Expand All @@ -19,65 +22,57 @@ export interface BottomSheetMethods {
* @param index snap point index.
* @param animationConfigs snap animation configs.
*
* @see {Animated.WithSpringConfig}
* @see {Animated.WithTimingConfig}
* @see {WithSpringConfig}
* @see {WithTimingConfig}
*/
snapToIndex: (
index: number,
animationConfigs?: Animated.WithSpringConfig | Animated.WithTimingConfig
animationConfigs?: WithSpringConfig | WithTimingConfig
) => void;
/**
* Snap to a position out of provided `snapPoints`.
* @param position position in pixel or percentage.
* @param animationConfigs snap animation configs.
*
* @see {Animated.WithSpringConfig}
* @see {Animated.WithTimingConfig}
* @see {WithSpringConfig}
* @see {WithTimingConfig}
*/
snapToPosition: (
position: number | string,
animationConfigs?: Animated.WithSpringConfig | Animated.WithTimingConfig
animationConfigs?: WithSpringConfig | WithTimingConfig
) => void;
/**
* Snap to the maximum provided point from `snapPoints`.
* @param animationConfigs snap animation configs.
*
* @see {Animated.WithSpringConfig}
* @see {Animated.WithTimingConfig}
* @see {WithSpringConfig}
* @see {WithTimingConfig}
*/
expand: (
animationConfigs?: Animated.WithSpringConfig | Animated.WithTimingConfig
) => void;
expand: (animationConfigs?: WithSpringConfig | WithTimingConfig) => void;
/**
* Snap to the minimum provided point from `snapPoints`.
* @param animationConfigs snap animation configs.
*
* @see {Animated.WithSpringConfig}
* @see {Animated.WithTimingConfig}
* @see {WithSpringConfig}
* @see {WithTimingConfig}
*/
collapse: (
animationConfigs?: Animated.WithSpringConfig | Animated.WithTimingConfig
) => void;
collapse: (animationConfigs?: WithSpringConfig | WithTimingConfig) => void;
/**
* Close the bottom sheet.
* @param animationConfigs snap animation configs.
*
* @see {Animated.WithSpringConfig}
* @see {Animated.WithTimingConfig}
* @see {WithSpringConfig}
* @see {WithTimingConfig}
*/
close: (
animationConfigs?: Animated.WithSpringConfig | Animated.WithTimingConfig
) => void;
close: (animationConfigs?: WithSpringConfig | WithTimingConfig) => void;
/**
* Force close the bottom sheet, this prevent any interruptions till the sheet is closed.
* @param animationConfigs snap animation configs.
*
* @see {Animated.WithSpringConfig}
* @see {Animated.WithTimingConfig}
* @see {WithSpringConfig}
* @see {WithTimingConfig}
*/
forceClose: (
animationConfigs?: Animated.WithSpringConfig | Animated.WithTimingConfig
) => void;
forceClose: (animationConfigs?: WithSpringConfig | WithTimingConfig) => void;
}
export interface BottomSheetModalMethods extends BottomSheetMethods {
/**
Expand All @@ -88,12 +83,10 @@ export interface BottomSheetModalMethods extends BottomSheetMethods {
* Close and unmount the bottom sheet modal.
* @param animationConfigs snap animation configs.
*
* @see {Animated.WithSpringConfig}
* @see {Animated.WithTimingConfig}
* @see {WithSpringConfig}
* @see {WithTimingConfig}
*/
dismiss: (
animationConfigs?: Animated.WithSpringConfig | Animated.WithTimingConfig
) => void;
dismiss: (animationConfigs?: WithSpringConfig | WithTimingConfig) => void;
}
//#endregion

Expand Down

0 comments on commit 831df9c

Please sign in to comment.