You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mode | string | Yes | 'rn-modal' | One of: 'rn-modal', 'js-modal', 'tooltip'. See [Mode](#mode) section below for details.
299
-
from | element OR ref OR rect | Yes | null | Either a React element, a function that returns a React element, a `ref` created from `React.createRef` or `React.useRef`, or a Rect object created by `new Rect(x, y, width, height)`.
300
-
displayArea | rect | Yes | rect | Area where the popover is allowed to be displayed
301
-
placement | string | Yes | 'auto' | How to position the popover - top | bottom | left | right | center | auto. When 'auto' is specified, it will determine the ideal placement so that the popover is fully visible within `displayArea`.
302
-
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.
303
-
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.
304
-
statusBarTranslucent | bool | Yes | null | For 'rn-modal' mode only. Determines whether the background should go under the status bar. Passed through to RN `Modal` component, see [their docs](https://reactnative.dev/docs/modal#statusbartranslucent-1) as well.
305
-
safeAreaInsets | object | Yes | null | Inset configuration for the `SafeAreaView` wrapping the modal. This may be useful if you use popovers within views that render into the safe areas insets. Passed through to the `SafeAreaView` component, see [their docs](https://github.com/react-native-community/react-native-safe-area-view#forceinset) for usage.
306
-
popoverStyle | object | Yes | {} | The style of the popover itself. You can override the `borderRadius`, `backgroundColor`, or any other [`style` prop for a `View`](https://facebook.github.io/react-native/docs/view-style-props.html).
307
-
backgroundStyle | object | Yes | {} | The style of the background that fades in.
308
-
arrowStyle | object | Yes | {} | The style of the arrow that points to the rect. Supported options are `width`, `height`, and `backgroundColor`. You can use `{backgroundColor: 'transparent'}` to hide the arrow completely.
309
-
arrowShift | number | Yes | 0 | How much to shift the arrow to either side, as a multiplier. `-1` will shift it all the way to the left (or top) corner of the source view, while `1` will shift all the way to the right (or bottom) corner. A value of `0.5` or `-0.8` will shift it partly to one side.
310
-
onOpenStart | function | Yes | | Callback to be fired when the open animation starts (before animation)
311
-
onOpenComplete | function | Yes | | Callback to be fired when the open animation ends (after animation)
312
-
onRequestClose | function | Yes | | Callback to be fired when the user taps outside the popover (on the background) or taps the "hardware" back button on Android
313
-
onCloseStart | function | Yes | | Callback to be fired when the popover starts closing (before animation)
314
-
onCloseComplete | function | Yes | | Callback to be fired when the popover is finished closing (after animation)
315
-
debug | bool | Yes | false | Set this to `true` to turn on debug logging to the console. This is useful for figuring out why a Popover isn't showing.
mode | string | 'rn-modal' | One of: 'rn-modal', 'js-modal', 'tooltip'. See [Mode](#mode) section below for details.
302
+
from | element OR | Yes | null | Either a React element, a function that returns a React element, a `ref` created from `React.createRef` or `React.useRef`, or a Rect object created by `new Rect(x, y, width, height)`.
303
+
displayArea | rect | rect | Area where the popover is allowed to be displayed
304
+
placement | string | 'auto' | How to position the popover - top | bottom | left | right | center | auto. When 'auto' is specified, it will determine the ideal placement so that the popover is fully visible within `displayArea`.
305
+
animationConfig | object | | 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.
306
+
verticalOffset | number | 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.
307
+
statusBarTranslucent | bool | null | For 'rn-modal' mode only. Determines whether the background should go under the status bar. Passed through to RN `Modal` component, see [their docs](https://reactnative.dev/docs/modal#statusbartranslucent-1) as well.
308
+
displayAreaInsets | object | { left: 10, right: 10, top: 20, bottom: 20 } | Insets to apply to the display area. The Popover will not be allowed to go beyond the display area minus the insets.
309
+
popoverStyle | object | {} | The style of the popover itself. You can override the `borderRadius`, `backgroundColor`, or any other [`style` prop for a `View`](https://facebook.github.io/react-native/docs/view-style-props.html).
310
+
backgroundStyle | object | {} | The style of the background that fades in.
311
+
arrowStyle | object | {} | The style of the arrow that points to the rect. Supported options are `width`, `height`, and `backgroundColor`. You can use `{backgroundColor: 'transparent'}` to hide the arrow completely.
312
+
arrowShift | number | 0 | How much to shift the arrow to either side, as a multiplier. `-1` will shift it all the way to the left (or top) corner of the source view, while `1` will shift all the way to the right (or bottom) corner. A value of `0.5` or `-0.8` will shift it partly to one side.
313
+
onOpenStart | function | | Callback to be fired when the open animation starts (before animation)
314
+
onOpenComplete | function | | Callback to be fired when the open animation ends (after animation)
315
+
onRequestClose | function | | Callback to be fired when the user taps outside the popover (on the background) or taps the "hardware" back button on Android
316
+
onCloseStart | function | | Callback to be fired when the popover starts closing (before animation)
317
+
onCloseComplete | function | | Callback to be fired when the popover is finished closing (after animation)
318
+
debug | bool | false | Set this to `true` to turn on debug logging to the console. This is useful for figuring out why a Popover isn't showing.
316
319
317
320
If no `from` is provided, the popover will float in the center of the screen.
318
321
@@ -335,6 +338,22 @@ Shows the popover in the space provided, filling the `Popover` component's paren
335
338
336
339
Shows the `Popover` without taking over the screen, no background is faded in and taps to the area around the popover fall through to those views (as expected). The `onRequestClose` callback will never be called, so the `Popover` will have to be dismissed some other way.
337
340
341
+
## Usage with Safe Area Context
342
+
343
+
Some devices have notches or other screen features that create zones where you might want to avoid showing a `Popover`. To do so, follow the instructions to setup [`react-native-safe-area-context`](https://github.com/th3rdwave/react-native-safe-area-context), then use the provided hooks to pass the safe area insets straight to the `displayAreaInsets` prop:
Removed internal safe area view; if you want the Popover to avoid showing behind notches on some devices, follow the instructions: [Usage with Safe Area Context](#safeArea).
390
+
368
391
#### `2.x` to `3.0`
369
392
370
393
*`fromRect` and `fromView` have been consolidated into a single `from` prop, where you can pass a Rect or a Ref. All Refs passed in must now be a `RefObject` created from `React.createRef` or `React.useRef`. All Rects passed in must be an actual Rect object (e.g. `from={new Rect(x, y, width, height)}`).
exportconstMULTIPLE_POPOVER_WARNING=`Popover Warning - Can't Show - Attempted to show a Popover while another one was already showing. You can only show one Popover at a time, and must wait for one to close completely before showing a different one. You can use the onCloseComplete prop to detect when a Popover has finished closing. To show multiple Popovers simultaneously, all but one should have mode={Popover.MODE.JS_MODAL}. Once you change the mode, you can show as many Popovers as you want, but you are responsible for keeping them above other views.`;
0 commit comments