react-native-modal
Advanced tools
Comparing version 11.9.0 to 11.10.0
import { ReactNativeModal } from './modal'; | ||
export { ModalProps, ReactNativeModal, OnSwipeCompleteParams } from './modal'; | ||
export { AnimationEvent, Animations, SupportedAnimation, Orientation, Direction, PresentationStyle, OnOrientationChange, } from './types'; | ||
export { AnimationEvent, Animations, SupportedAnimation, Orientation, Direction, PresentationStyle, OnOrientationChange, GestureResponderEvent, } from './types'; | ||
export default ReactNativeModal; |
@@ -5,3 +5,3 @@ import * as React from 'react'; | ||
import { Animation, CustomAnimation } from 'react-native-animatable'; | ||
import { Direction, Orientation, OrNull, PresentationStyle, OnOrientationChange } from './types'; | ||
import { Direction, Orientation, OrNull, PresentationStyle, OnOrientationChange, GestureResponderEvent } from './types'; | ||
export declare type OnSwipeCompleteParams = { | ||
@@ -48,3 +48,3 @@ swipingDirection: Direction; | ||
hideModalContentWhileAnimating: boolean; | ||
propagateSwipe: boolean; | ||
propagateSwipe: boolean | ((event: GestureResponderEvent, gestureState: PanResponderGestureState) => boolean); | ||
isVisible: boolean; | ||
@@ -85,3 +85,3 @@ onModalShow: () => void; | ||
hideModalContentWhileAnimating: PropTypes.Requireable<boolean>; | ||
propagateSwipe: PropTypes.Requireable<boolean>; | ||
propagateSwipe: PropTypes.Requireable<boolean | ((...args: any[]) => any)>; | ||
onModalShow: PropTypes.Requireable<(...args: any[]) => any>; | ||
@@ -162,2 +162,3 @@ onModalWillShow: PropTypes.Requireable<(...args: any[]) => any>; | ||
onBackButtonPress: () => boolean; | ||
shouldPropagateSwipe: (evt: GestureResponderEvent, gestureState: PanResponderGestureState) => boolean; | ||
buildPanResponder: () => void; | ||
@@ -164,0 +165,0 @@ getAccDistancePerDirection: (gestureState: PanResponderGestureState) => number; |
@@ -42,2 +42,7 @@ import * as React from 'react'; | ||
}; | ||
this.shouldPropagateSwipe = (evt, gestureState) => { | ||
return typeof this.props.propagateSwipe === 'function' | ||
? this.props.propagateSwipe(evt, gestureState) | ||
: this.props.propagateSwipe; | ||
}; | ||
this.buildPanResponder = () => { | ||
@@ -49,3 +54,3 @@ let animEvt = null; | ||
// https://github.com/react-native-community/react-native-modal/pull/246 | ||
if (!this.props.propagateSwipe) { | ||
if (!this.shouldPropagateSwipe(evt, gestureState)) { | ||
// The number "4" is just a good tradeoff to make the panResponder | ||
@@ -72,3 +77,3 @@ // work correctly even when the modal has touchable buttons. | ||
if (hasScrollableView && | ||
this.props.propagateSwipe && | ||
this.shouldPropagateSwipe(e, gestureState) && | ||
this.props.scrollTo && | ||
@@ -495,3 +500,3 @@ this.props.scrollOffset > 0) { | ||
hideModalContentWhileAnimating: PropTypes.bool, | ||
propagateSwipe: PropTypes.bool, | ||
propagateSwipe: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]), | ||
onModalShow: PropTypes.func, | ||
@@ -498,0 +503,0 @@ onModalWillShow: PropTypes.func, |
import { Animation, CustomAnimation } from 'react-native-animatable'; | ||
import { NativeSyntheticEvent } from 'react-native'; | ||
import { NativeSyntheticEvent, NativeTouchEvent } from 'react-native'; | ||
export declare type OrNull<T> = null | T; | ||
@@ -14,1 +14,3 @@ export declare type SupportedAnimation = Animation | CustomAnimation; | ||
export declare type OnOrientationChange = (orientation: NativeSyntheticEvent<any>) => void; | ||
export interface GestureResponderEvent extends NativeSyntheticEvent<NativeTouchEvent> { | ||
} |
{ | ||
"name": "react-native-modal", | ||
"version": "11.9.0", | ||
"version": "11.10.0", | ||
"description": "An enhanced React Native modal", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
66109
881