react-native-popover-view
Advanced tools
Comparing version 1.0.3 to 1.0.4
{ | ||
"name": "react-native-popover-view", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "A <Popover /> component for react-native", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -91,2 +91,3 @@ ## react-native-popover-view | ||
animationConfig | object | Yes | | An object containing any configuration options that can be passed to Animated.timing (e.g. `{ duration: 600, easing: Easing.inOut(Easing.quad) }`). The configuration options you pass will override the defaults for all animations. | ||
verticalOffset | number | Yes | 0 | The amount to vertically shift the popover on the screen. In certain Android configurations, you may need to apply a `verticalOffset` of `-StatusBar.currentHeight` for the popover to originate from the correct place. | ||
@@ -193,2 +194,3 @@ If neither `fromRect` or `fromView` are provided, the popover will float in the center of the screen. | ||
`animationConfig` | object | | Passed through to `Popover` | ||
`verticalOffset` | number | 0 | Passed through to `Popover` | ||
@@ -195,0 +197,0 @@ Note: If you pass a value through the `stackConfig`, and pass the same option for an individual screen, the value passed for the screen overrides. |
@@ -471,3 +471,3 @@ 'use strict'; | ||
else if (props.fromView) | ||
waitForNewRect(props.fromView, initialRect, callback); | ||
waitForNewRect(props.fromView, initialRect, callback, this.props.verticalOffset); | ||
else | ||
@@ -743,2 +743,3 @@ callback(props.fromRect); | ||
showBackground: true, | ||
verticalOffset: 0 | ||
} | ||
@@ -760,5 +761,6 @@ | ||
arrowStyle: PropTypes.object, | ||
animationConfig: PropTypes.object | ||
animationConfig: PropTypes.object, | ||
verticalOffset: PropTypes.number | ||
} | ||
export default Popover; |
@@ -44,3 +44,3 @@ import Popover from './Popover' | ||
const child = React.cloneElement(this.props.children, {goBack: () => this.goBack()}); | ||
const { contentContainerStyle, popoverStyle, arrowStyle, placement, showInModal, layoutRtl, showBackground, getRegisteredView, displayArea, showInPopover, backgroundColor, animationConfig } = this.props; | ||
const { contentContainerStyle, popoverStyle, arrowStyle, placement, showInModal, layoutRtl, showBackground, getRegisteredView, displayArea, showInPopover, backgroundColor, animationConfig, verticalOffset } = this.props; | ||
@@ -61,2 +61,3 @@ if (showInPopover) { | ||
doneClosingCallback={() => this.props.children.props.navigation.goBack()} | ||
verticalOffset={verticalOffset} | ||
fromView={getRegisteredView() || this.getParam('showFromView')} | ||
@@ -92,3 +93,4 @@ calculateRect={this.getParam('calculateRect')} | ||
arrowStyle: PropTypes.object, | ||
animationConfig: PropTypes.object | ||
animationConfig: PropTypes.object, | ||
verticalOffset: PropTypes.number | ||
} |
@@ -1,2 +0,2 @@ | ||
import { Platform, Animated, NativeModules, findNodeHandle, Dimensions, StatusBar } from 'react-native' | ||
import { Platform, Animated, NativeModules, findNodeHandle, Dimensions } from 'react-native' | ||
@@ -59,11 +59,10 @@ export function Point(x, y) { | ||
export function waitForNewRect(ref, initialRect, onFinish) { | ||
let androidOffset = isIOS() ? 0 : StatusBar.currentHeight; | ||
export function waitForNewRect(ref, initialRect, onFinish, verticalOffset) { | ||
runAfterChange(callback => { | ||
NativeModules.UIManager.measure(findNodeHandle(ref), (x0, y0, width, height, x, y) => { | ||
callback(new Rect(x, y - androidOffset, width, height)); | ||
callback(new Rect(x, y + verticalOffset, width, height)); | ||
}) | ||
}, initialRect, () => { | ||
NativeModules.UIManager.measure(findNodeHandle(ref), (x0, y0, width, height, x, y) => { | ||
onFinish(new Rect(x, y - androidOffset, width, height)) | ||
onFinish(new Rect(x, y + verticalOffset, width, height)) | ||
}) | ||
@@ -70,0 +69,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
132800
1410
455