forked from gorhom/react-native-bottom-sheet
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fixed the mount animation with reduce motion enabled (gorhom#1560,
gorhom#1674) fix: bottom sheet not appearing for users that have reduced motion turned on (gorhom#1743)(by @fobos531)
- Loading branch information
Showing
4 changed files
with
24 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,22 @@ | ||
import { useMemo } from 'react'; | ||
import type { EasingFunction } from 'react-native'; | ||
import type { EasingFunctionFactory } from 'react-native-reanimated'; | ||
import type { WithTimingConfig } from 'react-native-reanimated'; | ||
import { ANIMATION_DURATION, ANIMATION_EASING } from '../constants'; | ||
|
||
interface TimingConfig { | ||
duration?: number; | ||
easing?: EasingFunction | EasingFunctionFactory; | ||
} | ||
|
||
/** | ||
* Generate timing animation configs. | ||
* @default | ||
* - easing: Easing.out(Easing.exp) | ||
* - duration 250 | ||
* - duration: 250 | ||
* @param configs overridable configs. | ||
*/ | ||
export const useBottomSheetTimingConfigs = (configs: TimingConfig) => { | ||
export const useBottomSheetTimingConfigs = (configs: WithTimingConfig) => { | ||
return useMemo(() => { | ||
const _configs: TimingConfig = { | ||
const _configs: WithTimingConfig = { | ||
easing: configs.easing || ANIMATION_EASING, | ||
duration: configs.duration || ANIMATION_DURATION, | ||
reduceMotion: configs.reduceMotion, | ||
}; | ||
|
||
return _configs; | ||
}, [configs.duration, configs.easing]); | ||
}, [configs.duration, configs.easing, configs.reduceMotion]); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters