react-native-popover-view
Advanced tools
Comparing version 6.0.0 to 6.0.1
@@ -75,4 +75,4 @@ var __extends = (this && this.__extends) || (function () { | ||
import React, { Component } from 'react'; | ||
import { Dimensions, Keyboard } from 'react-native'; | ||
import { DEBUG, isIOS } from './Constants'; | ||
import { Dimensions, Keyboard, Platform, StatusBar } from 'react-native'; | ||
import { DEBUG, DEFAULT_STATUS_BAR_TRANSLUCENT, isIOS } from './Constants'; | ||
import { Rect } from './Types'; | ||
@@ -246,7 +246,7 @@ import { getChangedProps, getRectForRef } from './Utility'; | ||
AdaptivePopover.prototype.calculateRectFromRef = function () { | ||
var _a, _b; | ||
var _a, _b, _c; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var fromRef, initialRect, displayAreaOffset, count, verticalOffset, horizontalOffset, rect; | ||
return __generator(this, function (_c) { | ||
switch (_c.label) { | ||
var fromRef, initialRect, displayAreaOffset, count, shouldAdjustForAndroidStatusBar, verticalOffsetAndroidAdjustment, verticalOffset, horizontalOffset, rect; | ||
return __generator(this, function (_d) { | ||
switch (_d.label) { | ||
case 0: | ||
@@ -258,3 +258,3 @@ fromRef = this.props.fromRef; | ||
count = 0; | ||
_c.label = 1; | ||
_d.label = 1; | ||
case 1: | ||
@@ -266,3 +266,3 @@ if (!!(fromRef === null || fromRef === void 0 ? void 0 : fromRef.current)) return [3 /*break*/, 3]; | ||
case 2: | ||
_c.sent(); | ||
_d.sent(); | ||
// Timeout after 2 seconds | ||
@@ -273,10 +273,15 @@ if (count++ > 20) | ||
case 3: | ||
verticalOffset = ((_b = this.props.verticalOffset) !== null && _b !== void 0 ? _b : 0) - displayAreaOffset.y; | ||
shouldAdjustForAndroidStatusBar = Platform.OS === 'android' && | ||
((_b = this.props.statusBarTranslucent) !== null && _b !== void 0 ? _b : DEFAULT_STATUS_BAR_TRANSLUCENT); | ||
verticalOffsetAndroidAdjustment = shouldAdjustForAndroidStatusBar | ||
? ((_c = StatusBar.currentHeight) !== null && _c !== void 0 ? _c : 0) | ||
: 0; | ||
verticalOffset = verticalOffsetAndroidAdjustment - displayAreaOffset.y; | ||
horizontalOffset = -displayAreaOffset.x; | ||
this.debug('calculateRectFromRef - waiting for ref to move from', initialRect); | ||
count = 0; | ||
_c.label = 4; | ||
_d.label = 4; | ||
case 4: return [4 /*yield*/, getRectForRef(fromRef)]; | ||
case 5: | ||
rect = _c.sent(); | ||
rect = _d.sent(); | ||
if ([rect.x, rect.y, rect.width, rect.height].every(function (i) { return i === undefined; })) { | ||
@@ -294,10 +299,10 @@ this.debug('calculateRectFromRef - rect not found, all properties undefined'); | ||
case 6: | ||
_c.sent(); | ||
_d.sent(); | ||
// Timeout after 2 seconds | ||
if (count++ > 20) | ||
return [2 /*return*/]; | ||
_c.label = 7; | ||
_d.label = 7; | ||
case 7: | ||
if (!AdaptivePopover.hasRetrievedSatisfyingRect(rect, initialRect)) return [3 /*break*/, 4]; | ||
_c.label = 8; | ||
_d.label = 8; | ||
case 8: | ||
@@ -304,0 +309,0 @@ this.debug('calculateRectFromRef - calculated Rect', rect); |
@@ -77,3 +77,3 @@ var __extends = (this && this.__extends) || (function () { | ||
// Make sure a value we care about has actually changed | ||
var importantProps = ['isVisible', 'fromRect', 'displayArea', 'verticalOffset', 'offset', 'placement']; | ||
var importantProps = ['isVisible', 'fromRect', 'displayArea', 'offset', 'placement']; | ||
var changedProps = getChangedProps(this.props, prevProps, importantProps); | ||
@@ -80,0 +80,0 @@ if (!changedProps.length) |
@@ -5,2 +5,3 @@ import { Size } from './Types'; | ||
export declare const DEFAULT_BORDER_RADIUS = 3; | ||
export declare const DEFAULT_STATUS_BAR_TRANSLUCENT = true; | ||
export declare const POPOVER_MARGIN = 10; | ||
@@ -7,0 +8,0 @@ export declare const DEBUG = false; |
@@ -6,2 +6,3 @@ import { Dimensions, Platform, StyleSheet } from 'react-native'; | ||
export var DEFAULT_BORDER_RADIUS = 3; | ||
export var DEFAULT_STATUS_BAR_TRANSLUCENT = true; | ||
export var POPOVER_MARGIN = 10; | ||
@@ -8,0 +9,0 @@ export var DEBUG = false; |
@@ -33,3 +33,2 @@ import { Component, PropsWithChildren, RefObject, ReactNode } from 'react'; | ||
animationConfig: PropTypes.Requireable<object>; | ||
verticalOffset: PropTypes.Requireable<number>; | ||
popoverStyle: any; | ||
@@ -36,0 +35,0 @@ popoverShift: PropTypes.Requireable<PropTypes.InferProps<{ |
@@ -42,3 +42,3 @@ var __extends = (this && this.__extends) || (function () { | ||
import { Rect, Placement, Mode, Size } from './Types'; | ||
import { DEFAULT_ARROW_SIZE } from './Constants'; | ||
import { DEFAULT_ARROW_SIZE, DEFAULT_STATUS_BAR_TRANSLUCENT } from './Constants'; | ||
import JSModalPopover from './JSModalPopover'; | ||
@@ -173,3 +173,2 @@ import RNModalPopover from './RNModalPopover'; | ||
animationConfig: PropTypes.object, | ||
verticalOffset: PropTypes.number, | ||
// style | ||
@@ -199,3 +198,3 @@ popoverStyle: ViewPropTypes.style, | ||
placement: Placement.AUTO, | ||
verticalOffset: 0, | ||
statusBarTranslucent: DEFAULT_STATUS_BAR_TRANSLUCENT, | ||
popoverStyle: {}, | ||
@@ -202,0 +201,0 @@ arrowSize: DEFAULT_ARROW_SIZE, |
@@ -5,3 +5,2 @@ import { RefObject, Component, ReactNode } from 'react'; | ||
interface RNModalPopoverProps extends PopoverProps { | ||
statusBarTranslucent?: boolean; | ||
fromRect?: Rect; | ||
@@ -8,0 +7,0 @@ fromRef?: RefObject<View>; |
@@ -30,3 +30,3 @@ var __extends = (this && this.__extends) || (function () { | ||
import AdaptivePopover from './AdaptivePopover'; | ||
import { MULTIPLE_POPOVER_WARNING } from './Constants'; | ||
import { DEFAULT_STATUS_BAR_TRANSLUCENT, MULTIPLE_POPOVER_WARNING } from './Constants'; | ||
import { Point } from './Types'; | ||
@@ -70,3 +70,3 @@ var RNModalPopover = /** @class */ (function (_super) { | ||
var visible = this.state.visible; | ||
return (React.createElement(Modal, { transparent: true, supportedOrientations: ['portrait', 'portrait-upside-down', 'landscape'], hardwareAccelerated: true, visible: visible, statusBarTranslucent: statusBarTranslucent, onShow: function () { | ||
return (React.createElement(Modal, { transparent: true, supportedOrientations: ['portrait', 'portrait-upside-down', 'landscape'], hardwareAccelerated: true, visible: visible, statusBarTranslucent: statusBarTranslucent !== null && statusBarTranslucent !== void 0 ? statusBarTranslucent : DEFAULT_STATUS_BAR_TRANSLUCENT, onShow: function () { | ||
RNModalPopover.isShowingInModal = true; | ||
@@ -73,0 +73,0 @@ }, |
@@ -32,3 +32,2 @@ import { Animated, StyleProp, ViewStyle } from 'react-native'; | ||
offset?: number; | ||
verticalOffset?: number; | ||
displayArea?: Rect; | ||
@@ -44,2 +43,3 @@ displayAreaInsets?: Insets; | ||
arrowSize?: Size; | ||
statusBarTranslucent?: boolean; | ||
onOpenStart?: () => void; | ||
@@ -46,0 +46,0 @@ onOpenComplete?: () => void; |
@@ -1,5 +0,7 @@ | ||
import { RefObject, ComponentClass, Component } from 'react'; | ||
import { StyleProp, ViewStyle } from 'react-native'; | ||
import { RefObject } from 'react'; | ||
import { MeasureInWindowOnSuccessCallback, StyleProp, ViewStyle } from 'react-native'; | ||
import { Placement, Point, Rect, Size } from './Types'; | ||
declare type RefType = RefObject<number | Component<any, any, any> | ComponentClass<any, any> | null>; | ||
declare type RefType = RefObject<{ | ||
measureInWindow: (callback: MeasureInWindowOnSuccessCallback) => void; | ||
}>; | ||
export declare function getRectForRef(ref: RefType): Promise<Rect>; | ||
@@ -6,0 +8,0 @@ export declare function waitForChange(getFirst: () => Promise<Rect>, getSecond: () => Promise<Rect>): Promise<void>; |
@@ -37,3 +37,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
}; | ||
import { NativeModules, findNodeHandle, StyleSheet } from 'react-native'; | ||
import { StyleSheet } from 'react-native'; | ||
import { Placement, Rect, Size } from './Types'; | ||
@@ -44,3 +44,3 @@ import { DEFAULT_ARROW_SIZE, DEFAULT_BORDER_RADIUS } from './Constants'; | ||
if (ref.current) { | ||
NativeModules.UIManager.measure(findNodeHandle(ref.current), function (_1, _2, width, height, x, y) { | ||
ref.current.measureInWindow(function (x, y, width, height) { | ||
return resolve(new Rect(x, y, width, height)); | ||
@@ -47,0 +47,0 @@ }); |
{ | ||
"name": "react-native-popover-view", | ||
"version": "6.0.0", | ||
"version": "6.0.1", | ||
"description": "A <Popover /> component for react-native iOS, Android, and Web", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -359,5 +359,5 @@ ## react-native-popover-view | ||
The Popover can show in three modes: | ||
* Popover.MODE.RN_MODAL ('rn-modal') | ||
* Popover.MODE.JS_MODAL ('js-modal') | ||
* Popover.MODE.TOOLTIP ('tooltip') | ||
* PopoverMode.RN_MODAL ('rn-modal') | ||
* PopoverMode.JS_MODAL ('js-modal') | ||
* PopoverMode.TOOLTIP ('tooltip') | ||
@@ -364,0 +364,0 @@ #### RN Modal (Default) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
309208
28336
4790
0
0