Skip to content

Commit

Permalink
chore: fixed types import
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhom committed Apr 24, 2022
1 parent 1bf6139 commit 95cb80d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 23 deletions.
34 changes: 17 additions & 17 deletions src/components/bottomSheet/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import type React from 'react';
import type { ViewStyle, Insets, StyleProp } from 'react-native';
import type Animated, {
import type {
SharedValue,
AnimateStyle,
WithSpringConfig,
WithTimingConfig,
} from 'react-native-reanimated';
Expand Down Expand Up @@ -46,9 +48,7 @@ export interface BottomSheetProps
* snapPoints={['%100']}
* @type Array<string | number>
*/
snapPoints:
| Array<string | number>
| Animated.SharedValue<Array<string | number>>;
snapPoints: Array<string | number> | SharedValue<Array<string | number>>;
/**
* Defines how violently sheet has to be stopped while over dragging.
* @type number
Expand Down Expand Up @@ -100,24 +100,24 @@ export interface BottomSheetProps
* unless `handleHeight` is provided.
* @type number
*/
handleHeight?: number | Animated.SharedValue<number>;
handleHeight?: number | SharedValue<number>;
/**
* Container height helps to calculate the internal sheet layouts,
* if `containerHeight` not provided, the library internally will calculate it,
* however this will cause an extra re-rendering.
* @type number | Animated.SharedValue<number>;
* @type number | SharedValue<number>;
*/
containerHeight?: number | Animated.SharedValue<number>;
containerHeight?: number | SharedValue<number>;
/**
* Content height helps dynamic snap points calculation.
* @type number | Animated.SharedValue<number>;
* @type number | SharedValue<number>;
*/
contentHeight?: number | Animated.SharedValue<number>;
contentHeight?: number | SharedValue<number>;
/**
* Container offset helps to accurately detect container offsets.
* @type Animated.SharedValue<number>;
* @type SharedValue<number>;
*/
containerOffset?: Animated.SharedValue<Required<Insets>>;
containerOffset?: SharedValue<Required<Insets>>;
/**
* Top inset value helps to calculate percentage snap points values,
* usually comes from `@react-navigation/stack` hook `useHeaderHeight` or
Expand Down Expand Up @@ -165,11 +165,11 @@ export interface BottomSheetProps
/**
* View style to be applied to the sheet container component,
* it also could be an Animated Style.
* @type Animated.AnimateStyle<ViewStyle>
* @type AnimateStyle<ViewStyle>
* @default undefined
*/
style?: StyleProp<
Animated.AnimateStyle<
AnimateStyle<
Omit<
ViewStyle,
| 'flexDirection'
Expand Down Expand Up @@ -218,14 +218,14 @@ export interface BottomSheetProps
//#region animated nodes
/**
* Animated value to be used as a callback of the position node internally.
* @type Animated.Value<number>
* @type SharedValue<number>
*/
animatedPosition?: Animated.SharedValue<number>;
animatedPosition?: SharedValue<number>;
/**
* Animated value to be used as a callback for the position index node internally.
* @type Animated.Value<number>
* @type SharedValue<number>
*/
animatedIndex?: Animated.SharedValue<number>;
animatedIndex?: SharedValue<number>;
//#endregion

//#region callbacks
Expand Down
13 changes: 7 additions & 6 deletions src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import type {
GestureEventPayload,
PanGestureHandlerEventPayload,
} from 'react-native-gesture-handler';
import type Animated, {
import type {
SharedValue,
WithSpringConfig,
WithTimingConfig,
} from 'react-native-reanimated';
Expand Down Expand Up @@ -93,14 +94,14 @@ export interface BottomSheetModalMethods extends BottomSheetMethods {
export interface BottomSheetVariables {
/**
* Current sheet position index.
* @type Animated.Value<number>
* @type SharedValue<number>
*/
animatedIndex: Animated.SharedValue<number>;
animatedIndex: SharedValue<number>;
/**
* Current sheet position.
* @type Animated.Value<number>
* @type SharedValue<number>
*/
animatedPosition: Animated.SharedValue<number>;
animatedPosition: SharedValue<number>;
}

//#region scrollables
Expand Down Expand Up @@ -148,7 +149,7 @@ type ScrollEventHandlerCallbackType<C = any> = (

export type ScrollEventsHandlersHookType = (
ref: React.RefObject<Scrollable>,
contentOffsetY: Animated.SharedValue<number>
contentOffsetY: SharedValue<number>
) => {
handleOnScroll?: ScrollEventHandlerCallbackType;
handleOnBeginDrag?: ScrollEventHandlerCallbackType;
Expand Down

0 comments on commit 95cb80d

Please sign in to comment.