Skip to content

Commit bf094c8

Browse files
committed
chore: fixed typescript issue with external interfaces
1 parent 88f81a3 commit bf094c8

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/hooks/useBottomSheetTimingConfigs.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
import { useMemo } from 'react';
2-
import { type WithTimingConfig } from 'react-native-reanimated';
2+
import { EasingFunctionFactory, ReduceMotion } from 'react-native-reanimated';
33
import { ANIMATION_DURATION, ANIMATION_EASING } from '../constants';
4+
import { EasingFunction } from 'react-native';
5+
6+
/**
7+
* this is needed to avoid TS4023
8+
* https://github.com/microsoft/TypeScript/issues/5711
9+
*/
10+
interface TimingConfig {
11+
duration?: number;
12+
easing?: EasingFunction | EasingFunctionFactory;
13+
reduceMotion?: ReduceMotion;
14+
}
415

516
/**
617
* Generate timing animation configs.
@@ -9,9 +20,9 @@ import { ANIMATION_DURATION, ANIMATION_EASING } from '../constants';
920
* - duration: 250
1021
* @param configs overridable configs.
1122
*/
12-
export const useBottomSheetTimingConfigs = (configs: WithTimingConfig) => {
23+
export const useBottomSheetTimingConfigs = (configs: TimingConfig) => {
1324
return useMemo(() => {
14-
const _configs: WithTimingConfig = {
25+
const _configs: TimingConfig = {
1526
easing: configs.easing || ANIMATION_EASING,
1627
duration: configs.duration || ANIMATION_DURATION,
1728
reduceMotion: configs.reduceMotion,

0 commit comments

Comments
 (0)