Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added Reanimated v2 compatibility (#15 by @sa8ab) #24

Merged
merged 2 commits into from
Aug 21, 2020
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
7 changes: 6 additions & 1 deletion src/components/bottomSheet/BottomSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import Animated, {
and,
// concat,
greaterThan,
interpolate,
Extrapolate,
set,
// defined,
Expand Down Expand Up @@ -54,6 +53,12 @@ import type { ScrollableRef, BottomSheetMethods } from '../../types';
import type { BottomSheetProps } from './types';
import { styles } from './styles';

const {
interpolate: interpolateV1,
interpolateNode: interpolateV2,
} = require('react-native-reanimated');
const interpolate = interpolateV2 || interpolateV1;

type BottomSheet = BottomSheetMethods;

Animated.addWhitelistedUIProps({
Expand Down
8 changes: 7 additions & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import Animated, { Easing } from 'react-native-reanimated';
import Animated from 'react-native-reanimated';

const {
Easing: EasingV1,
EasingNode: EasingV2,
} = require('react-native-reanimated');
const Easing = EasingV2 || EasingV1;

export const DEFAULT_ANIMATION_EASING: Animated.EasingFunction = Easing.out(
Easing.back(0.75)
Expand Down