From 4c5e0f9824fcd43781d2ebfdbbfe41afd1cc4eaa Mon Sep 17 00:00:00 2001 From: Abraham Przewodnik Date: Wed, 16 Dec 2020 09:08:17 +0100 Subject: [PATCH] Export the type for BottomSheet's Props This can come in handy for users of this library --- src/index.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index fea09b1..d976a12 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -7,7 +7,7 @@ import { State as GestureState, } from 'react-native-gesture-handler' -type Props = { +export type BottomSheetProps = { /** * Points for snapping of bottom sheet component. They define distance from bottom of the screen. * Might be number or percent (as string e.g. '20%') for points or percents of screen height from bottom. @@ -292,7 +292,7 @@ function withDecaying( ]) } -export default class BottomSheetBehavior extends React.Component { +export default class BottomSheetBehavior extends React.Component { static defaultProps = { overdragResistanceFactor: 0, initialSnap: 0, @@ -337,7 +337,7 @@ export default class BottomSheetBehavior extends React.Component { private onCloseStartValue: Animated.Value = new Value(1) private onCloseEndValue: Animated.Value = new Value(0) - constructor(props: Props) { + constructor(props: BottomSheetProps) { super(props) this.panRef = props.innerGestureHandlerRefs[0] @@ -493,7 +493,7 @@ export default class BottomSheetBehavior extends React.Component { ) } - componentDidUpdate(_prevProps: Props, prevState: State) { + componentDidUpdate(_prevProps: BottomSheetProps, prevState: State) { const { snapPoints } = this.state if (this.props.enabledBottomClamp && snapPoints !== prevState.snapPoints) { this.clampingValue.setValue(snapPoints[snapPoints.length - 1]) @@ -721,7 +721,7 @@ export default class BottomSheetBehavior extends React.Component { (Number(str.split('%')[0]) * screenHeight) / 100 static getDerivedStateFromProps( - props: Props, + props: BottomSheetProps, state: State | undefined ): State { let snapPoints