react-native-push-notification-popup
Advanced tools
Comparing version 1.5.0 to 1.6.0
{ | ||
"name": "react-native-push-notification-popup", | ||
"version": "1.5.0", | ||
"version": "1.6.0", | ||
"description": "React Native Push Notification Popup Component", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -70,2 +70,3 @@ # React Native Push Notification Popup | ||
<Text>{body}</Text> | ||
<Button title='My button' onPress={() => console.log('Popup button onPress!')} /> | ||
</View> | ||
@@ -80,3 +81,5 @@ ); | ||
ref={ref => this.popup = ref} | ||
renderPopupContent={renderCustomPopup} /> | ||
renderPopupContent={renderCustomPopup} | ||
shouldChildHandleResponderStart={true} | ||
shouldChildHandleResponderMove={true} /> | ||
</View> | ||
@@ -109,2 +112,4 @@ ); | ||
| **`renderPopupContent`** | function <br /> `(options?: { appIconSource?: ImageSourcePropType; appTitle?: string; timeText?: string; title?: string;body?: string; }) => React.ReactElement<any>` | null | Render your own custom popup body (Optional) | | ||
| **`shouldChildHandleResponderStart`** | boolean | false | By default, parent popup will prevent bubbling event to child. This should be set to true if you have button inside your custom popup that wants to receive the event. | | ||
| **`shouldChildHandleResponderMove`** | boolean | false | By default, parent popup will prevent bubbling event to child. This should be set to true if you have button inside your custom popup that wants to receive the event. | | ||
@@ -111,0 +116,0 @@ ### Methods |
@@ -46,2 +46,4 @@ import React, { Component } from 'react'; | ||
renderPopupContent: PropTypes.func, | ||
shouldChildHandleResponderStart: PropTypes.bool, | ||
shouldChildHandleResponderMove: PropTypes.bool, | ||
} | ||
@@ -78,5 +80,5 @@ | ||
onStartShouldSetPanResponder: (e, gestureState) => true, | ||
// onStartShouldSetPanResponderCapture: (e, gestureState) => false, | ||
onStartShouldSetPanResponderCapture: (e, gestureState) => props.shouldChildHandleResponderStart ? false : true, // Capture child event | ||
onMoveShouldSetPanResponder: (e, gestureState) => true, | ||
// onMoveShouldSetPanResponderCapture: (e, gestureState) => false, | ||
onMoveShouldSetPanResponderCapture: (e, gestureState) => props.shouldChildHandleResponderMove ? false : true, // Capture child event | ||
onPanResponderGrant: this._onPanResponderGrant, | ||
@@ -123,3 +125,3 @@ onPanResponderMove: this._onPanResponderMove, | ||
this.clearTimerIfExist(); | ||
Animated.timing(containerDragOffsetY, { toValue: 0, duration: 200, useNativeDriver: true }) | ||
Animated.timing(containerDragOffsetY, { toValue: 0, duration: 200, useNativeDriver: false }) | ||
.start(({finished}) => { | ||
@@ -196,3 +198,3 @@ // Reset a new countdown | ||
const { containerScale } = this.state; | ||
Animated.spring(containerScale, { toValue: 0.95, friction: 8, useNativeDriver: true }) | ||
Animated.spring(containerScale, { toValue: 0.95, friction: 8, useNativeDriver: false }) | ||
.start(); | ||
@@ -205,3 +207,3 @@ } | ||
const { containerScale } = this.state; | ||
Animated.spring(containerScale, { toValue: 1, friction: 8, useNativeDriver: true }) | ||
Animated.spring(containerScale, { toValue: 1, friction: 8, useNativeDriver: false }) | ||
.start(); | ||
@@ -228,3 +230,3 @@ } | ||
const { containerSlideOffsetY } = this.state; // Using the new one is fine | ||
Animated.timing(containerSlideOffsetY, { toValue: 1, duration: duration || 400, useNativeDriver: true }) // TODO: customize | ||
Animated.timing(containerSlideOffsetY, { toValue: 1, duration: duration || 400, useNativeDriver: false }) // TODO: customize | ||
.start(({finished}) => { | ||
@@ -246,3 +248,3 @@ this.countdownToSlideOut(); | ||
// Reset animation to 0 && show it && animate | ||
Animated.timing(containerSlideOffsetY, { toValue: 0, duration: duration || 400, useNativeDriver: true }) // TODO: customize | ||
Animated.timing(containerSlideOffsetY, { toValue: 0, duration: duration || 400, useNativeDriver: false }) // TODO: customize | ||
.start(({finished}) => { | ||
@@ -249,0 +251,0 @@ // Reset everything and hide the popup |
@@ -23,2 +23,4 @@ /// <reference types="react"/> | ||
renderPopupContent?: (options: ContentOptionsBase) => ReactElement; | ||
shouldChildHandleResponderStart?: boolean; | ||
shouldChildHandleResponderMove?: boolean; | ||
} | ||
@@ -25,0 +27,0 @@ |
21388
409
163