bootstrap-rn 0.4.5 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/module/Context.js.map +1 -1
- package/lib/module/Provider.js +3 -7
- package/lib/module/Provider.js.map +1 -1
- package/lib/module/components/Body.js +10 -5
- package/lib/module/components/Body.js.map +1 -1
- package/lib/module/components/buttons/Button.js +10 -8
- package/lib/module/components/buttons/Button.js.map +1 -1
- package/lib/module/components/close/CloseButton.js +7 -3
- package/lib/module/components/close/CloseButton.js.map +1 -1
- package/lib/module/components/collapse/useCollapse.js +2 -3
- package/lib/module/components/collapse/useCollapse.js.map +1 -1
- package/lib/module/components/dropdown/Dropdown.js +1 -2
- package/lib/module/components/dropdown/Dropdown.js.map +1 -1
- package/lib/module/components/dropdown/DropdownContext.js.map +1 -1
- package/lib/module/components/dropdown/DropdownMenu.js +33 -59
- package/lib/module/components/dropdown/DropdownMenu.js.map +1 -1
- package/lib/module/components/dropdown/useDismissDropdown.js +5 -4
- package/lib/module/components/dropdown/useDismissDropdown.js.map +1 -1
- package/lib/module/components/dropdown/useDropdown.js +35 -11
- package/lib/module/components/dropdown/useDropdown.js.map +1 -1
- package/lib/module/components/dropdown/useToggleDropdown.js +4 -6
- package/lib/module/components/dropdown/useToggleDropdown.js.map +1 -1
- package/lib/module/components/forms/FormCheckInput.js +1 -1
- package/lib/module/components/forms/Input.js +1 -1
- package/lib/module/components/forms/internals/PickerNative.js +1 -1
- package/lib/module/components/forms/internals/PickerNative.js.map +1 -1
- package/lib/module/components/helpers/BackdropHandler.js +6 -92
- package/lib/module/components/helpers/BackdropHandler.js.map +1 -1
- package/lib/module/components/helpers/BackdropHandler.web.js +8 -0
- package/lib/module/components/helpers/BackdropHandler.web.js.map +1 -0
- package/lib/module/components/helpers/Dialog.js +29 -0
- package/lib/module/components/helpers/Dialog.js.map +1 -0
- package/lib/module/components/helpers/Dialog.web.js +117 -0
- package/lib/module/components/helpers/Dialog.web.js.map +1 -0
- package/lib/module/components/helpers/Portal.js +5 -0
- package/lib/module/components/helpers/Portal.js.map +1 -0
- package/lib/module/components/helpers/Portal.web.js +16 -0
- package/lib/module/components/helpers/Portal.web.js.map +1 -0
- package/lib/module/components/helpers/PortalHost.js +5 -0
- package/lib/module/components/helpers/PortalHost.js.map +1 -0
- package/lib/module/components/helpers/PortalHost.web.js +15 -0
- package/lib/module/components/helpers/PortalHost.web.js.map +1 -0
- package/lib/module/components/modal/Modal.js +58 -47
- package/lib/module/components/modal/Modal.js.map +1 -1
- package/lib/module/components/modal/ModalContext.js.map +1 -1
- package/lib/module/components/modal/ModalTitle.js +6 -0
- package/lib/module/components/modal/ModalTitle.js.map +1 -1
- package/lib/module/components/modal/useModal.js +4 -13
- package/lib/module/components/modal/useModal.js.map +1 -1
- package/lib/module/components/nav/useTabbable.js +2 -3
- package/lib/module/components/nav/useTabbable.js.map +1 -1
- package/lib/module/components/navbar/NavbarToggler.js +1 -1
- package/lib/module/components/navbar/useNavbar.js +2 -3
- package/lib/module/components/navbar/useNavbar.js.map +1 -1
- package/lib/module/components/offcanvas/Offcanvas.js +84 -83
- package/lib/module/components/offcanvas/Offcanvas.js.map +1 -1
- package/lib/module/components/offcanvas/OffcanvasContext.js.map +1 -1
- package/lib/module/components/offcanvas/OffcanvasTitle.js +6 -0
- package/lib/module/components/offcanvas/OffcanvasTitle.js.map +1 -1
- package/lib/module/components/offcanvas/useOffcanvas.js +6 -14
- package/lib/module/components/offcanvas/useOffcanvas.js.map +1 -1
- package/lib/module/components/pagination/PaginationItem.js +39 -39
- package/lib/module/components/popover/Popover.js +6 -8
- package/lib/module/components/popover/Popover.js.map +1 -1
- package/lib/module/components/popover/PopoverArrow.js +18 -9
- package/lib/module/components/popover/PopoverArrow.js.map +1 -1
- package/lib/module/components/popover/PopoverContext.js.map +1 -1
- package/lib/module/components/popover/injectPopover.js +48 -45
- package/lib/module/components/popover/injectPopover.js.map +1 -1
- package/lib/module/components/tooltip/Tooltip.js +7 -23
- package/lib/module/components/tooltip/Tooltip.js.map +1 -1
- package/lib/module/components/tooltip/TooltipArrow.js +22 -12
- package/lib/module/components/tooltip/TooltipArrow.js.map +1 -1
- package/lib/module/components/tooltip/TooltipContext.js.map +1 -1
- package/lib/module/components/tooltip/injectTooltip.js +46 -42
- package/lib/module/components/tooltip/injectTooltip.js.map +1 -1
- package/lib/module/hooks/useBackgroundNative.js.map +1 -1
- package/lib/module/hooks/useFocusRing.js +13 -0
- package/lib/module/hooks/useFocusRing.js.map +1 -0
- package/lib/module/hooks/useFocusRing.web.js +5 -0
- package/lib/module/hooks/useFocusRing.web.js.map +1 -0
- package/lib/module/hooks/useInteractionState.js +11 -11
- package/lib/module/hooks/useInteractionState.js.map +1 -1
- package/lib/module/hooks/useOverlay.js +121 -0
- package/lib/module/hooks/useOverlay.js.map +1 -0
- package/lib/module/hooks/useOverlay.web.js +113 -0
- package/lib/module/hooks/useOverlay.web.js.map +1 -0
- package/lib/module/hooks/useScrollbarEffects.js +7 -60
- package/lib/module/hooks/useScrollbarEffects.js.map +1 -1
- package/lib/module/hooks/useScrollbarEffects.web.js +59 -0
- package/lib/module/hooks/useScrollbarEffects.web.js.map +1 -0
- package/lib/module/index.js +3 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/style/StyleSheet.js +1 -3
- package/lib/module/style/StyleSheet.js.map +1 -1
- package/lib/module/theme/variables.js +9 -9
- package/lib/module/utils.js +0 -11
- package/lib/module/utils.js.map +1 -1
- package/lib/typescript/Context.d.ts +0 -1
- package/lib/typescript/Context.d.ts.map +1 -1
- package/lib/typescript/Provider.d.ts.map +1 -1
- package/lib/typescript/components/Body.d.ts +2 -2
- package/lib/typescript/components/Body.d.ts.map +1 -1
- package/lib/typescript/components/Link.d.ts +1 -1
- package/lib/typescript/components/Link.d.ts.map +1 -1
- package/lib/typescript/components/Pressable.d.ts +1 -1
- package/lib/typescript/components/Pressable.d.ts.map +1 -1
- package/lib/typescript/components/TextInput.d.ts +3 -3
- package/lib/typescript/components/TextInput.d.ts.map +1 -1
- package/lib/typescript/components/buttons/Button.d.ts +1 -1
- package/lib/typescript/components/buttons/Button.d.ts.map +1 -1
- package/lib/typescript/components/close/CloseButton.d.ts +1 -1
- package/lib/typescript/components/close/CloseButton.d.ts.map +1 -1
- package/lib/typescript/components/collapse/useCollapse.d.ts.map +1 -1
- package/lib/typescript/components/dropdown/Dropdown.d.ts +0 -1
- package/lib/typescript/components/dropdown/Dropdown.d.ts.map +1 -1
- package/lib/typescript/components/dropdown/DropdownContext.d.ts +14 -3
- package/lib/typescript/components/dropdown/DropdownContext.d.ts.map +1 -1
- package/lib/typescript/components/dropdown/DropdownMenu.d.ts +0 -1
- package/lib/typescript/components/dropdown/DropdownMenu.d.ts.map +1 -1
- package/lib/typescript/components/dropdown/useDismissDropdown.d.ts +1 -1
- package/lib/typescript/components/dropdown/useDismissDropdown.d.ts.map +1 -1
- package/lib/typescript/components/dropdown/useDropdown.d.ts +38 -4
- package/lib/typescript/components/dropdown/useDropdown.d.ts.map +1 -1
- package/lib/typescript/components/dropdown/useToggleDropdown.d.ts +4 -3
- package/lib/typescript/components/dropdown/useToggleDropdown.d.ts.map +1 -1
- package/lib/typescript/components/forms/Picker.d.ts +1 -1
- package/lib/typescript/components/forms/internals/PickerNative.d.ts +1 -1
- package/lib/typescript/components/forms/internals/PickerNative.d.ts.map +1 -1
- package/lib/typescript/components/forms/internals/PickerWeb.d.ts +1 -1
- package/lib/typescript/components/forms/internals/PickerWeb.d.ts.map +1 -1
- package/lib/typescript/components/helpers/BackdropHandler.d.ts +2 -11
- package/lib/typescript/components/helpers/BackdropHandler.d.ts.map +1 -1
- package/lib/typescript/components/helpers/BackdropHandler.web.d.ts +3 -0
- package/lib/typescript/components/helpers/BackdropHandler.web.d.ts.map +1 -0
- package/lib/typescript/components/helpers/Dialog.d.ts +15 -0
- package/lib/typescript/components/helpers/Dialog.d.ts.map +1 -0
- package/lib/typescript/components/helpers/Dialog.web.d.ts +15 -0
- package/lib/typescript/components/helpers/Dialog.web.d.ts.map +1 -0
- package/lib/typescript/components/helpers/Portal.d.ts +8 -0
- package/lib/typescript/components/helpers/Portal.d.ts.map +1 -0
- package/lib/typescript/components/helpers/Portal.web.d.ts +8 -0
- package/lib/typescript/components/helpers/Portal.web.d.ts.map +1 -0
- package/lib/typescript/components/helpers/PortalHost.d.ts +6 -0
- package/lib/typescript/components/helpers/PortalHost.d.ts.map +1 -0
- package/lib/typescript/components/helpers/PortalHost.web.d.ts +7 -0
- package/lib/typescript/components/helpers/PortalHost.web.d.ts.map +1 -0
- package/lib/typescript/components/list-group/ListGroup.d.ts +1 -1
- package/lib/typescript/components/list-group/ListGroupItemAction.d.ts +1 -1
- package/lib/typescript/components/list-group/ListGroupItemAction.d.ts.map +1 -1
- package/lib/typescript/components/modal/Modal.d.ts +1 -1
- package/lib/typescript/components/modal/Modal.d.ts.map +1 -1
- package/lib/typescript/components/modal/ModalContext.d.ts +1 -0
- package/lib/typescript/components/modal/ModalContext.d.ts.map +1 -1
- package/lib/typescript/components/modal/ModalTitle.d.ts.map +1 -1
- package/lib/typescript/components/modal/useModal.d.ts +2 -1
- package/lib/typescript/components/modal/useModal.d.ts.map +1 -1
- package/lib/typescript/components/nav/Nav.d.ts +1 -1
- package/lib/typescript/components/nav/NavLink.d.ts +1 -1
- package/lib/typescript/components/nav/NavLink.d.ts.map +1 -1
- package/lib/typescript/components/nav/useTabbable.d.ts.map +1 -1
- package/lib/typescript/components/navbar/Navbar.d.ts +2 -2
- package/lib/typescript/components/navbar/NavbarBrand.d.ts +1 -1
- package/lib/typescript/components/navbar/NavbarBrand.d.ts.map +1 -1
- package/lib/typescript/components/navbar/NavbarToggler.d.ts +1 -1
- package/lib/typescript/components/navbar/NavbarToggler.d.ts.map +1 -1
- package/lib/typescript/components/navbar/useNavbar.d.ts.map +1 -1
- package/lib/typescript/components/offcanvas/Offcanvas.d.ts +1 -4
- package/lib/typescript/components/offcanvas/Offcanvas.d.ts.map +1 -1
- package/lib/typescript/components/offcanvas/OffcanvasContext.d.ts +3 -1
- package/lib/typescript/components/offcanvas/OffcanvasContext.d.ts.map +1 -1
- package/lib/typescript/components/offcanvas/OffcanvasTitle.d.ts.map +1 -1
- package/lib/typescript/components/offcanvas/useOffcanvas.d.ts +3 -1
- package/lib/typescript/components/offcanvas/useOffcanvas.d.ts.map +1 -1
- package/lib/typescript/components/popover/Popover.d.ts +3 -4
- package/lib/typescript/components/popover/Popover.d.ts.map +1 -1
- package/lib/typescript/components/popover/PopoverArrow.d.ts.map +1 -1
- package/lib/typescript/components/popover/PopoverContext.d.ts +3 -4
- package/lib/typescript/components/popover/PopoverContext.d.ts.map +1 -1
- package/lib/typescript/components/popover/injectPopover.d.ts +5 -7
- package/lib/typescript/components/popover/injectPopover.d.ts.map +1 -1
- package/lib/typescript/components/tooltip/Tooltip.d.ts +3 -4
- package/lib/typescript/components/tooltip/Tooltip.d.ts.map +1 -1
- package/lib/typescript/components/tooltip/TooltipArrow.d.ts.map +1 -1
- package/lib/typescript/components/tooltip/TooltipContext.d.ts +3 -4
- package/lib/typescript/components/tooltip/TooltipContext.d.ts.map +1 -1
- package/lib/typescript/components/tooltip/injectTooltip.d.ts +5 -7
- package/lib/typescript/components/tooltip/injectTooltip.d.ts.map +1 -1
- package/lib/typescript/hooks/useBackgroundNative.d.ts.map +1 -1
- package/lib/typescript/hooks/useFocusRing.d.ts +3 -0
- package/lib/typescript/hooks/useFocusRing.d.ts.map +1 -0
- package/lib/typescript/hooks/useFocusRing.web.d.ts +3 -0
- package/lib/typescript/hooks/useFocusRing.web.d.ts.map +1 -0
- package/lib/typescript/hooks/useInteractionState.d.ts +7 -7
- package/lib/typescript/hooks/useInteractionState.d.ts.map +1 -1
- package/lib/typescript/hooks/useOverlay.d.ts +64 -0
- package/lib/typescript/hooks/useOverlay.d.ts.map +1 -0
- package/lib/typescript/hooks/useOverlay.web.d.ts +37 -0
- package/lib/typescript/hooks/useOverlay.web.d.ts.map +1 -0
- package/lib/typescript/hooks/useScrollbarEffects.d.ts.map +1 -1
- package/lib/typescript/hooks/useScrollbarEffects.web.d.ts +7 -0
- package/lib/typescript/hooks/useScrollbarEffects.web.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +5 -4
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/style/StyleSheet.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +12 -6
- package/lib/typescript/types.d.ts.map +1 -1
- package/lib/typescript/utils.d.ts +2 -3
- package/lib/typescript/utils.d.ts.map +1 -1
- package/package.json +92 -87
- package/src/Context.ts +37 -38
- package/src/Provider.tsx +61 -66
- package/src/components/Body.tsx +22 -22
- package/src/components/TextInput.tsx +66 -66
- package/src/components/buttons/Button.tsx +381 -379
- package/src/components/close/CloseButton.tsx +142 -138
- package/src/components/collapse/useCollapse.ts +25 -26
- package/src/components/dropdown/Dropdown.tsx +77 -80
- package/src/components/dropdown/DropdownContext.ts +14 -3
- package/src/components/dropdown/DropdownMenu.tsx +243 -284
- package/src/components/dropdown/useDismissDropdown.ts +30 -29
- package/src/components/dropdown/useDropdown.ts +55 -38
- package/src/components/dropdown/useToggleDropdown.ts +31 -32
- package/src/components/forms/FormCheckInput.tsx +268 -268
- package/src/components/forms/Input.tsx +220 -220
- package/src/components/forms/internals/PickerNative.tsx +9 -10
- package/src/components/helpers/BackdropHandler.tsx +5 -119
- package/src/components/helpers/BackdropHandler.web.tsx +6 -0
- package/src/components/helpers/Dialog.tsx +49 -0
- package/src/components/helpers/Dialog.web.tsx +145 -0
- package/src/components/helpers/Portal.tsx +10 -0
- package/src/components/helpers/Portal.web.tsx +22 -0
- package/src/components/helpers/PortalHost.tsx +7 -0
- package/src/components/helpers/PortalHost.web.tsx +14 -0
- package/src/components/modal/Modal.tsx +60 -46
- package/src/components/modal/ModalContext.ts +12 -11
- package/src/components/modal/ModalTitle.tsx +41 -31
- package/src/components/modal/useModal.ts +13 -25
- package/src/components/nav/useTabbable.ts +31 -32
- package/src/components/navbar/NavbarToggler.tsx +130 -130
- package/src/components/navbar/useNavbar.ts +30 -31
- package/src/components/offcanvas/Offcanvas.tsx +92 -95
- package/src/components/offcanvas/OffcanvasContext.ts +13 -11
- package/src/components/offcanvas/OffcanvasTitle.tsx +43 -33
- package/src/components/offcanvas/useOffcanvas.ts +12 -20
- package/src/components/pagination/PaginationItem.tsx +139 -139
- package/src/components/popover/Popover.tsx +87 -90
- package/src/components/popover/PopoverArrow.tsx +22 -6
- package/src/components/popover/PopoverContext.ts +13 -18
- package/src/components/popover/injectPopover.tsx +63 -55
- package/src/components/tooltip/Tooltip.tsx +79 -98
- package/src/components/tooltip/TooltipArrow.tsx +26 -8
- package/src/components/tooltip/TooltipContext.ts +13 -18
- package/src/components/tooltip/injectTooltip.tsx +62 -53
- package/src/hooks/useAction.ts +78 -78
- package/src/hooks/useBackgroundNative.tsx +6 -4
- package/src/hooks/useFocusRing.ts +13 -0
- package/src/hooks/useFocusRing.web.ts +3 -0
- package/src/hooks/useInteractionState.ts +75 -81
- package/src/hooks/useOverlay.ts +197 -0
- package/src/hooks/useOverlay.web.ts +190 -0
- package/src/hooks/useScrollbarEffects.ts +5 -83
- package/src/hooks/useScrollbarEffects.web.ts +83 -0
- package/src/index.ts +5 -5
- package/src/style/StyleSheet.ts +2 -5
- package/src/theme/variables.ts +1420 -1420
- package/src/types.ts +14 -14
- package/src/utils.ts +4 -22
- package/lib/module/components/SafeAreaView.js +0 -44
- package/lib/module/components/SafeAreaView.js.map +0 -1
- package/lib/module/components/helpers/Overlay.js +0 -50
- package/lib/module/components/helpers/Overlay.js.map +0 -1
- package/lib/module/hooks/useIdentifier.js +0 -14
- package/lib/module/hooks/useIdentifier.js.map +0 -1
- package/lib/module/hooks/useTrigger.js +0 -97
- package/lib/module/hooks/useTrigger.js.map +0 -1
- package/lib/typescript/components/SafeAreaView.d.ts +0 -13
- package/lib/typescript/components/SafeAreaView.d.ts.map +0 -1
- package/lib/typescript/components/helpers/Overlay.d.ts +0 -28
- package/lib/typescript/components/helpers/Overlay.d.ts.map +0 -1
- package/lib/typescript/hooks/useIdentifier.d.ts +0 -2
- package/lib/typescript/hooks/useIdentifier.d.ts.map +0 -1
- package/lib/typescript/hooks/useTrigger.d.ts +0 -33
- package/lib/typescript/hooks/useTrigger.d.ts.map +0 -1
- package/src/components/SafeAreaView.tsx +0 -71
- package/src/components/helpers/Overlay.tsx +0 -81
- package/src/hooks/useIdentifier.ts +0 -15
- package/src/hooks/useTrigger.ts +0 -141
|
@@ -1,130 +1,130 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import StyleSheet from '../../style/StyleSheet';
|
|
3
|
-
import css from '../../style/css';
|
|
4
|
-
import Pressable, { PressableProps } from '../Pressable';
|
|
5
|
-
import View, { ViewRef } from '../View';
|
|
6
|
-
import useForcedContext from '../../hooks/useForcedContext';
|
|
7
|
-
import { GRID_BREAKPOINTS } from '../../theme/proxies';
|
|
8
|
-
import { infix, next } from '../../theme/breakpoints';
|
|
9
|
-
import { getStyles, each } from '../../utils';
|
|
10
|
-
import NavbarContext from './NavbarContext';
|
|
11
|
-
import useMedia from '../../hooks/useMedia';
|
|
12
|
-
import useToggleNavbar from './useToggleNavbar';
|
|
13
|
-
import useStyle from '../../hooks/useStyle';
|
|
14
|
-
import useBackground from '../../hooks/useBackground';
|
|
15
|
-
import { escapeSvg } from '../../theme/functions';
|
|
16
|
-
import type { ExtendedViewStyle, StyleProp, ThemeVariables } from '../../types';
|
|
17
|
-
|
|
18
|
-
export interface NavbarTogglerProps extends Omit<PressableProps, 'children'> {
|
|
19
|
-
iconStyle?: StyleProp<ExtendedViewStyle>;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const styles = StyleSheet.create({
|
|
23
|
-
'.navbar-toggler': css`
|
|
24
|
-
padding: $navbar-toggler-padding-y $navbar-toggler-padding-x;
|
|
25
|
-
background-color: transparent; // remove default button style
|
|
26
|
-
border: $border-width solid transparent; // remove default button style
|
|
27
|
-
border-radius: $navbar-toggler-border-radius;
|
|
28
|
-
// @include transition($navbar-toggler-transition);
|
|
29
|
-
|
|
30
|
-
&:focus {
|
|
31
|
-
@include platform(web) {
|
|
32
|
-
outline-
|
|
33
|
-
}
|
|
34
|
-
// box-shadow: 0 0 0 $navbar-toggler-focus-width;
|
|
35
|
-
}
|
|
36
|
-
`,
|
|
37
|
-
'.navbar-toggler --text': css`
|
|
38
|
-
font-size: $navbar-toggler-font-size;
|
|
39
|
-
line-height: $navbar-toggler-font-size * $line-height-base;
|
|
40
|
-
|
|
41
|
-
&:hover {
|
|
42
|
-
text-decoration: none;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
&:focus {
|
|
46
|
-
text-decoration: none;
|
|
47
|
-
}
|
|
48
|
-
`,
|
|
49
|
-
'.navbar-toggler-icon': css`
|
|
50
|
-
// display: inline-block;
|
|
51
|
-
width: $navbar-toggler-font-size * 1.5; // 1.5em;
|
|
52
|
-
height: $navbar-toggler-font-size * 1.5; // 1.5em;
|
|
53
|
-
vertical-align: middle;
|
|
54
|
-
background-repeat: no-repeat;
|
|
55
|
-
background-position: center;
|
|
56
|
-
background-size: 100%;
|
|
57
|
-
`,
|
|
58
|
-
...each(GRID_BREAKPOINTS, (breakpoint) => ({
|
|
59
|
-
[`.navbar-expand${infix(next(breakpoint))} .navbar-toggler`]: css`
|
|
60
|
-
@include media-breakpoint-up(${next(breakpoint)}) {
|
|
61
|
-
display: none;
|
|
62
|
-
}
|
|
63
|
-
`,
|
|
64
|
-
})),
|
|
65
|
-
'.navbar-light .navbar-toggler': css`
|
|
66
|
-
border-color: $navbar-light-toggler-border-color;
|
|
67
|
-
`,
|
|
68
|
-
'.navbar-light .navbar-toggler --text': css`
|
|
69
|
-
color: $navbar-light-color;
|
|
70
|
-
`,
|
|
71
|
-
'.navbar-light .navbar-toggler-icon': css`
|
|
72
|
-
background-image: ${(t: ThemeVariables) =>
|
|
73
|
-
escapeSvg(t['navbar-light-toggler-icon-bg'])};
|
|
74
|
-
`,
|
|
75
|
-
'.navbar-dark .navbar-toggler': css`
|
|
76
|
-
border-color: $navbar-dark-toggler-border-color;
|
|
77
|
-
`,
|
|
78
|
-
'.navbar-dark .navbar-toggler --text': css`
|
|
79
|
-
color: $navbar-dark-color;
|
|
80
|
-
`,
|
|
81
|
-
'.navbar-dark .navbar-toggler-icon': css`
|
|
82
|
-
background-image: ${(t: ThemeVariables) =>
|
|
83
|
-
escapeSvg(t['navbar-dark-toggler-icon-bg'])};
|
|
84
|
-
`,
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
const NavbarToggler = React.forwardRef<ViewRef, NavbarTogglerProps>(
|
|
88
|
-
(props, ref) => {
|
|
89
|
-
const { style, textStyle, iconStyle, ...elementProps } = props;
|
|
90
|
-
|
|
91
|
-
const media = useMedia();
|
|
92
|
-
const { variant, expand } = useForcedContext(NavbarContext);
|
|
93
|
-
|
|
94
|
-
const classes = getStyles(styles, [
|
|
95
|
-
'.navbar-toggler',
|
|
96
|
-
`.navbar-${variant} .navbar-toggler`,
|
|
97
|
-
expand &&
|
|
98
|
-
`.navbar-expand${expand === true ? '' : `-${expand}`} .navbar-toggler`,
|
|
99
|
-
]);
|
|
100
|
-
|
|
101
|
-
const textClasses = getStyles(styles, [
|
|
102
|
-
'.navbar-toggler --text',
|
|
103
|
-
`.navbar-${variant} .navbar-toggler --text`,
|
|
104
|
-
]);
|
|
105
|
-
|
|
106
|
-
const iconClasses = getStyles(styles, [
|
|
107
|
-
'.navbar-toggler-icon',
|
|
108
|
-
`.navbar-${variant} .navbar-toggler-icon`,
|
|
109
|
-
]);
|
|
110
|
-
|
|
111
|
-
const resolveIconStyle = useStyle([iconClasses, iconStyle]);
|
|
112
|
-
const background = useBackground(resolveIconStyle({ media }));
|
|
113
|
-
|
|
114
|
-
return (
|
|
115
|
-
<Pressable
|
|
116
|
-
{...elementProps}
|
|
117
|
-
ref={ref}
|
|
118
|
-
toggle={useToggleNavbar}
|
|
119
|
-
style={[classes, style]}
|
|
120
|
-
textStyle={[textClasses, textStyle]}
|
|
121
|
-
>
|
|
122
|
-
<View style={background.style}>{background.element}</View>
|
|
123
|
-
</Pressable>
|
|
124
|
-
);
|
|
125
|
-
},
|
|
126
|
-
);
|
|
127
|
-
|
|
128
|
-
NavbarToggler.displayName = 'NavbarToggler';
|
|
129
|
-
|
|
130
|
-
export default NavbarToggler;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import StyleSheet from '../../style/StyleSheet';
|
|
3
|
+
import css from '../../style/css';
|
|
4
|
+
import Pressable, { PressableProps } from '../Pressable';
|
|
5
|
+
import View, { ViewRef } from '../View';
|
|
6
|
+
import useForcedContext from '../../hooks/useForcedContext';
|
|
7
|
+
import { GRID_BREAKPOINTS } from '../../theme/proxies';
|
|
8
|
+
import { infix, next } from '../../theme/breakpoints';
|
|
9
|
+
import { getStyles, each } from '../../utils';
|
|
10
|
+
import NavbarContext from './NavbarContext';
|
|
11
|
+
import useMedia from '../../hooks/useMedia';
|
|
12
|
+
import useToggleNavbar from './useToggleNavbar';
|
|
13
|
+
import useStyle from '../../hooks/useStyle';
|
|
14
|
+
import useBackground from '../../hooks/useBackground';
|
|
15
|
+
import { escapeSvg } from '../../theme/functions';
|
|
16
|
+
import type { ExtendedViewStyle, StyleProp, ThemeVariables } from '../../types';
|
|
17
|
+
|
|
18
|
+
export interface NavbarTogglerProps extends Omit<PressableProps, 'children'> {
|
|
19
|
+
iconStyle?: StyleProp<ExtendedViewStyle>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const styles = StyleSheet.create({
|
|
23
|
+
'.navbar-toggler': css`
|
|
24
|
+
padding: $navbar-toggler-padding-y $navbar-toggler-padding-x;
|
|
25
|
+
background-color: transparent; // remove default button style
|
|
26
|
+
border: $border-width solid transparent; // remove default button style
|
|
27
|
+
border-radius: $navbar-toggler-border-radius;
|
|
28
|
+
// @include transition($navbar-toggler-transition);
|
|
29
|
+
|
|
30
|
+
&:focus {
|
|
31
|
+
@include platform(web) {
|
|
32
|
+
outline-style: none; // outline: 0;
|
|
33
|
+
}
|
|
34
|
+
// box-shadow: 0 0 0 $navbar-toggler-focus-width;
|
|
35
|
+
}
|
|
36
|
+
`,
|
|
37
|
+
'.navbar-toggler --text': css`
|
|
38
|
+
font-size: $navbar-toggler-font-size;
|
|
39
|
+
line-height: $navbar-toggler-font-size * $line-height-base;
|
|
40
|
+
|
|
41
|
+
&:hover {
|
|
42
|
+
text-decoration: none;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&:focus {
|
|
46
|
+
text-decoration: none;
|
|
47
|
+
}
|
|
48
|
+
`,
|
|
49
|
+
'.navbar-toggler-icon': css`
|
|
50
|
+
// display: inline-block;
|
|
51
|
+
width: $navbar-toggler-font-size * 1.5; // 1.5em;
|
|
52
|
+
height: $navbar-toggler-font-size * 1.5; // 1.5em;
|
|
53
|
+
vertical-align: middle;
|
|
54
|
+
background-repeat: no-repeat;
|
|
55
|
+
background-position: center;
|
|
56
|
+
background-size: 100%;
|
|
57
|
+
`,
|
|
58
|
+
...each(GRID_BREAKPOINTS, (breakpoint) => ({
|
|
59
|
+
[`.navbar-expand${infix(next(breakpoint))} .navbar-toggler`]: css`
|
|
60
|
+
@include media-breakpoint-up(${next(breakpoint)}) {
|
|
61
|
+
display: none;
|
|
62
|
+
}
|
|
63
|
+
`,
|
|
64
|
+
})),
|
|
65
|
+
'.navbar-light .navbar-toggler': css`
|
|
66
|
+
border-color: $navbar-light-toggler-border-color;
|
|
67
|
+
`,
|
|
68
|
+
'.navbar-light .navbar-toggler --text': css`
|
|
69
|
+
color: $navbar-light-color;
|
|
70
|
+
`,
|
|
71
|
+
'.navbar-light .navbar-toggler-icon': css`
|
|
72
|
+
background-image: ${(t: ThemeVariables) =>
|
|
73
|
+
escapeSvg(t['navbar-light-toggler-icon-bg'])};
|
|
74
|
+
`,
|
|
75
|
+
'.navbar-dark .navbar-toggler': css`
|
|
76
|
+
border-color: $navbar-dark-toggler-border-color;
|
|
77
|
+
`,
|
|
78
|
+
'.navbar-dark .navbar-toggler --text': css`
|
|
79
|
+
color: $navbar-dark-color;
|
|
80
|
+
`,
|
|
81
|
+
'.navbar-dark .navbar-toggler-icon': css`
|
|
82
|
+
background-image: ${(t: ThemeVariables) =>
|
|
83
|
+
escapeSvg(t['navbar-dark-toggler-icon-bg'])};
|
|
84
|
+
`,
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
const NavbarToggler = React.forwardRef<ViewRef, NavbarTogglerProps>(
|
|
88
|
+
(props, ref) => {
|
|
89
|
+
const { style, textStyle, iconStyle, ...elementProps } = props;
|
|
90
|
+
|
|
91
|
+
const media = useMedia();
|
|
92
|
+
const { variant, expand } = useForcedContext(NavbarContext);
|
|
93
|
+
|
|
94
|
+
const classes = getStyles(styles, [
|
|
95
|
+
'.navbar-toggler',
|
|
96
|
+
`.navbar-${variant} .navbar-toggler`,
|
|
97
|
+
expand &&
|
|
98
|
+
`.navbar-expand${expand === true ? '' : `-${expand}`} .navbar-toggler`,
|
|
99
|
+
]);
|
|
100
|
+
|
|
101
|
+
const textClasses = getStyles(styles, [
|
|
102
|
+
'.navbar-toggler --text',
|
|
103
|
+
`.navbar-${variant} .navbar-toggler --text`,
|
|
104
|
+
]);
|
|
105
|
+
|
|
106
|
+
const iconClasses = getStyles(styles, [
|
|
107
|
+
'.navbar-toggler-icon',
|
|
108
|
+
`.navbar-${variant} .navbar-toggler-icon`,
|
|
109
|
+
]);
|
|
110
|
+
|
|
111
|
+
const resolveIconStyle = useStyle([iconClasses, iconStyle]);
|
|
112
|
+
const background = useBackground(resolveIconStyle({ media }));
|
|
113
|
+
|
|
114
|
+
return (
|
|
115
|
+
<Pressable
|
|
116
|
+
{...elementProps}
|
|
117
|
+
ref={ref}
|
|
118
|
+
toggle={useToggleNavbar}
|
|
119
|
+
style={[classes, style]}
|
|
120
|
+
textStyle={[textClasses, textStyle]}
|
|
121
|
+
>
|
|
122
|
+
<View style={background.style}>{background.element}</View>
|
|
123
|
+
</Pressable>
|
|
124
|
+
);
|
|
125
|
+
},
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
NavbarToggler.displayName = 'NavbarToggler';
|
|
129
|
+
|
|
130
|
+
export default NavbarToggler;
|
|
@@ -1,31 +1,30 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
1
|
+
import { useId, useMemo } from 'react';
|
|
2
|
+
import useControlledState from '../../hooks/useControlledState';
|
|
3
|
+
import type { NavbarExpand, NavbarVariant } from './NavbarContext';
|
|
4
|
+
|
|
5
|
+
export default function useNavbar(
|
|
6
|
+
variant: NavbarVariant,
|
|
7
|
+
defaultExpanded: boolean,
|
|
8
|
+
controlledExpanded?: boolean,
|
|
9
|
+
onToggle?: () => void,
|
|
10
|
+
expand?: NavbarExpand,
|
|
11
|
+
) {
|
|
12
|
+
const identifier = useId();
|
|
13
|
+
|
|
14
|
+
const [expanded, setExpanded] = useControlledState(
|
|
15
|
+
defaultExpanded,
|
|
16
|
+
controlledExpanded,
|
|
17
|
+
onToggle,
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
return useMemo(
|
|
21
|
+
() => ({
|
|
22
|
+
identifier,
|
|
23
|
+
variant,
|
|
24
|
+
expanded,
|
|
25
|
+
setExpanded,
|
|
26
|
+
expand,
|
|
27
|
+
}),
|
|
28
|
+
[identifier, variant, expanded, expand],
|
|
29
|
+
);
|
|
30
|
+
}
|
|
@@ -1,59 +1,64 @@
|
|
|
1
1
|
import React, { useContext, useRef } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { OverlayProvider } from '@react-native-aria/overlays';
|
|
2
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
4
3
|
import StyleSheet from '../../style/StyleSheet';
|
|
5
4
|
import css from '../../style/css';
|
|
6
|
-
import
|
|
7
|
-
import SafeAreaView from '../SafeAreaView';
|
|
5
|
+
import Dialog from '../helpers/Dialog';
|
|
8
6
|
import View, { ViewProps, ViewRef } from '../View';
|
|
9
7
|
import { GRID_BREAKPOINTS } from '../../theme/proxies';
|
|
10
8
|
import { infix, next } from '../../theme/breakpoints';
|
|
11
9
|
import { getStyles, each, concatRefs } from '../../utils';
|
|
12
10
|
import useMedia from '../../hooks/useMedia';
|
|
13
11
|
import NavbarContext from '../navbar/NavbarContext';
|
|
12
|
+
import BackdropHandler from '../helpers/BackdropHandler';
|
|
14
13
|
import useOffcanvas from './useOffcanvas';
|
|
15
14
|
import OffcanvasContext from './OffcanvasContext';
|
|
16
15
|
import OffcanvasHeader from './OffcanvasHeader';
|
|
17
16
|
import OffcanvasTitle from './OffcanvasTitle';
|
|
18
17
|
import OffcanvasBody from './OffcanvasBody';
|
|
19
|
-
import type {
|
|
20
|
-
ExtendedTextStyle,
|
|
21
|
-
ExtendedViewStyle,
|
|
22
|
-
StyleProp,
|
|
23
|
-
} from '../../types';
|
|
24
18
|
|
|
25
19
|
export interface OffcanvasProps extends ViewProps {
|
|
26
20
|
visible?: boolean;
|
|
27
21
|
placement?: 'top' | 'bottom' | 'start' | 'end';
|
|
28
22
|
backdrop?: boolean | 'static';
|
|
29
23
|
scroll?: boolean;
|
|
30
|
-
|
|
31
|
-
dialogStyle?: StyleProp<ExtendedViewStyle>;
|
|
32
|
-
dialogTextStyle?: StyleProp<ExtendedTextStyle>;
|
|
24
|
+
onClose: () => void;
|
|
33
25
|
}
|
|
34
26
|
|
|
35
27
|
const styles = StyleSheet.create({
|
|
36
28
|
'.offcanvas': css`
|
|
37
|
-
position: absolute; //
|
|
29
|
+
position: absolute; // added for bootstrap-rn
|
|
30
|
+
@include platform(web) {
|
|
31
|
+
position: fixed;
|
|
32
|
+
}
|
|
38
33
|
// bottom: 0;
|
|
39
|
-
z-index: $zindex-offcanvas;
|
|
34
|
+
// z-index: $zindex-offcanvas;
|
|
40
35
|
display: flex;
|
|
41
36
|
flex-direction: column;
|
|
42
37
|
max-width: 100%;
|
|
43
38
|
// visibility: hidden;
|
|
39
|
+
background-color: $offcanvas-bg-color;
|
|
40
|
+
// background-clip: padding-box;
|
|
41
|
+
@include platform(web) {
|
|
42
|
+
outline-style: none; // outline: 0;
|
|
43
|
+
}
|
|
44
|
+
// @include box-shadow($offcanvas-box-shadow);
|
|
45
|
+
// @include transition(transform $offcanvas-transition-duration ease-in-out);
|
|
44
46
|
`,
|
|
45
47
|
'.offcanvas --text': css`
|
|
46
48
|
color: $offcanvas-color;
|
|
47
49
|
`,
|
|
48
50
|
'.offcanvas-backdrop': css`
|
|
49
|
-
position: absolute;
|
|
51
|
+
position: absolute; // added for bootstrap-rn
|
|
52
|
+
@include platform(web) {
|
|
53
|
+
position: fixed;
|
|
54
|
+
}
|
|
50
55
|
top: 0;
|
|
51
56
|
left: 0;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
bottom: 0; // added for bootstrap-rn
|
|
58
|
+
right: 0; // added for bootstrap-rn
|
|
59
|
+
// z-index: $zindex-offcanvas-backdrop;
|
|
60
|
+
// width: 100vw;
|
|
61
|
+
// height: 100vh;
|
|
57
62
|
background-color: $offcanvas-backdrop-bg;
|
|
58
63
|
opacity: $offcanvas-backdrop-opacity;
|
|
59
64
|
`,
|
|
@@ -61,48 +66,26 @@ const styles = StyleSheet.create({
|
|
|
61
66
|
top: 0;
|
|
62
67
|
bottom: 0; // added for bootstrap-rn
|
|
63
68
|
left: 0;
|
|
64
|
-
`,
|
|
65
|
-
'.offcanvas-end': css`
|
|
66
|
-
top: 0;
|
|
67
|
-
bottom: 0; // added for bootstrap-rn
|
|
68
|
-
right: 0;
|
|
69
|
-
`,
|
|
70
|
-
'.offcanvas-top': css`
|
|
71
|
-
top: 0;
|
|
72
|
-
right: 0;
|
|
73
|
-
left: 0;
|
|
74
|
-
`,
|
|
75
|
-
'.offcanvas-bottom': css`
|
|
76
|
-
bottom: 0; // added for bootstrap-rn
|
|
77
|
-
right: 0;
|
|
78
|
-
left: 0;
|
|
79
|
-
`,
|
|
80
|
-
'.offcanvas-inset': css`
|
|
81
|
-
max-width: 100%; // added for bootstrap-rn
|
|
82
|
-
max-height: 100%; // added for bootstrap-rn
|
|
83
|
-
background-color: $offcanvas-bg-color;
|
|
84
|
-
// background-clip: padding-box;
|
|
85
|
-
@include platform(web) {
|
|
86
|
-
outline-width: 0; // outline: 0;
|
|
87
|
-
}
|
|
88
|
-
// @include box-shadow($offcanvas-box-shadow);
|
|
89
|
-
// @include transition(transform $offcanvas-transition-duration ease-in-out);
|
|
90
|
-
`,
|
|
91
|
-
'.offcanvas-inset-start': css`
|
|
92
69
|
width: $offcanvas-horizontal-width;
|
|
93
70
|
border-right-width: $offcanvas-border-width;
|
|
94
71
|
border-style: solid;
|
|
95
72
|
border-color: $offcanvas-border-color;
|
|
96
73
|
// transform: translateX(-100%);
|
|
97
74
|
`,
|
|
98
|
-
'.offcanvas-
|
|
75
|
+
'.offcanvas-end': css`
|
|
76
|
+
top: 0;
|
|
77
|
+
bottom: 0; // added for bootstrap-rn
|
|
78
|
+
right: 0;
|
|
99
79
|
width: $offcanvas-horizontal-width;
|
|
100
80
|
border-left-width: $offcanvas-border-width;
|
|
101
81
|
border-style: solid;
|
|
102
82
|
border-color: $offcanvas-border-color;
|
|
103
83
|
// transform: translateX(100%);
|
|
104
84
|
`,
|
|
105
|
-
'.offcanvas-
|
|
85
|
+
'.offcanvas-top': css`
|
|
86
|
+
top: 0;
|
|
87
|
+
right: 0;
|
|
88
|
+
left: 0;
|
|
106
89
|
height: $offcanvas-vertical-height;
|
|
107
90
|
max-height: 100%;
|
|
108
91
|
border-bottom-width: $offcanvas-border-width;
|
|
@@ -110,7 +93,10 @@ const styles = StyleSheet.create({
|
|
|
110
93
|
border-color: $offcanvas-border-color;
|
|
111
94
|
// transform: translateY(-100%);
|
|
112
95
|
`,
|
|
113
|
-
'.offcanvas-
|
|
96
|
+
'.offcanvas-bottom': css`
|
|
97
|
+
bottom: 0; // added for bootstrap-rn
|
|
98
|
+
right: 0;
|
|
99
|
+
left: 0;
|
|
114
100
|
height: $offcanvas-vertical-height;
|
|
115
101
|
max-height: 100%;
|
|
116
102
|
width: 100%;
|
|
@@ -119,6 +105,14 @@ const styles = StyleSheet.create({
|
|
|
119
105
|
border-color: $offcanvas-border-color;
|
|
120
106
|
// transform: translateY(100%);
|
|
121
107
|
`,
|
|
108
|
+
'.offcanvas-dialog': css`
|
|
109
|
+
max-width: 100%; // added for bootstrap-rn
|
|
110
|
+
max-height: 100%; // added for bootstrap-rn
|
|
111
|
+
`,
|
|
112
|
+
'.offcanvas-dialog-start': css``,
|
|
113
|
+
'.offcanvas-dialog-end': css``,
|
|
114
|
+
'.offcanvas-dialog-top': css``,
|
|
115
|
+
'.offcanvas-dialog-bottom': css``,
|
|
122
116
|
// Navbar styles
|
|
123
117
|
...each(GRID_BREAKPOINTS, (breakpoint) => ({
|
|
124
118
|
[`.navbar-expand${infix(next(breakpoint))} .offcanvas`]: css`
|
|
@@ -146,22 +140,23 @@ const Offcanvas = React.forwardRef<ViewRef, OffcanvasProps>((props, ref) => {
|
|
|
146
140
|
placement = 'top',
|
|
147
141
|
backdrop = true,
|
|
148
142
|
scroll = false,
|
|
149
|
-
|
|
143
|
+
onClose: handleClose,
|
|
150
144
|
style,
|
|
151
|
-
dialogStyle,
|
|
152
145
|
textStyle,
|
|
153
|
-
dialogTextStyle,
|
|
154
146
|
...elementProps
|
|
155
147
|
} = props;
|
|
156
148
|
|
|
157
149
|
const media = useMedia();
|
|
158
150
|
const navbar = useContext(NavbarContext);
|
|
159
|
-
const offcanvasRef = useRef(null);
|
|
160
151
|
|
|
161
|
-
const
|
|
152
|
+
const offcanvasRef = useRef<ViewRef>(null);
|
|
153
|
+
const backdropRef = useRef<ViewRef>(null);
|
|
154
|
+
|
|
155
|
+
const insets = useSafeAreaInsets();
|
|
156
|
+
|
|
157
|
+
const offcanvas = useOffcanvas();
|
|
162
158
|
|
|
163
159
|
const backdropClasses = getStyles(styles, ['.offcanvas-backdrop']);
|
|
164
|
-
const backdropInsetClasses = getStyles(styles, ['.offcanvas-backdrop-inset']);
|
|
165
160
|
const classes = getStyles(styles, [
|
|
166
161
|
'.offcanvas',
|
|
167
162
|
`.offcanvas-${placement}`,
|
|
@@ -171,10 +166,10 @@ const Offcanvas = React.forwardRef<ViewRef, OffcanvasProps>((props, ref) => {
|
|
|
171
166
|
navbar.expand === true ? '' : `-${navbar.expand}`
|
|
172
167
|
} .offcanvas`,
|
|
173
168
|
]);
|
|
174
|
-
const dialogClasses = getStyles(styles, [
|
|
175
|
-
'.offcanvas-
|
|
176
|
-
`.offcanvas-
|
|
177
|
-
]);
|
|
169
|
+
/* const dialogClasses = getStyles(styles, [
|
|
170
|
+
'.offcanvas-dialog',
|
|
171
|
+
`.offcanvas-dialog-${placement}`,
|
|
172
|
+
]); */
|
|
178
173
|
const textClasses = getStyles(styles, ['.offcanvas-content --text']);
|
|
179
174
|
|
|
180
175
|
// Render children without modal for navbar.
|
|
@@ -195,45 +190,47 @@ const Offcanvas = React.forwardRef<ViewRef, OffcanvasProps>((props, ref) => {
|
|
|
195
190
|
);
|
|
196
191
|
}
|
|
197
192
|
|
|
193
|
+
if (!visible) {
|
|
194
|
+
return null;
|
|
195
|
+
}
|
|
196
|
+
|
|
198
197
|
return (
|
|
199
|
-
<
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
198
|
+
<Dialog
|
|
199
|
+
id={offcanvas.identifier}
|
|
200
|
+
dialogRef={offcanvasRef}
|
|
201
|
+
backgroundRef={backdropRef}
|
|
202
|
+
onClose={handleClose}
|
|
203
|
+
backdrop={backdrop}
|
|
204
|
+
backdropElement={
|
|
205
|
+
<View ref={backdropRef} style={[backdropClasses, insets]} />
|
|
206
|
+
}
|
|
207
|
+
scroll={scroll}
|
|
205
208
|
>
|
|
206
|
-
{backdrop
|
|
207
|
-
|
|
208
|
-
style={backdropClasses}
|
|
209
|
-
edges={placement !== 'bottom' ? ['top'] : []}
|
|
210
|
-
>
|
|
211
|
-
<SafeAreaView style={[{ flexGrow: 1 }, backdropInsetClasses]}>
|
|
212
|
-
<BackdropHandler
|
|
213
|
-
dialogRef={offcanvasRef}
|
|
214
|
-
onClose={handleToggle}
|
|
215
|
-
backdrop={backdrop}
|
|
216
|
-
/>
|
|
217
|
-
</SafeAreaView>
|
|
218
|
-
</SafeAreaView>
|
|
219
|
-
)}
|
|
220
|
-
<SafeAreaView
|
|
209
|
+
<BackdropHandler onClose={handleClose} backdrop={backdrop} />
|
|
210
|
+
<View
|
|
221
211
|
{...elementProps}
|
|
222
|
-
ref={concatRefs(
|
|
223
|
-
|
|
212
|
+
ref={concatRefs(ref, offcanvasRef)}
|
|
213
|
+
role="dialog"
|
|
214
|
+
aria-modal
|
|
215
|
+
aria-labelledby={`${offcanvas.identifier}-title`}
|
|
216
|
+
tabIndex={-1}
|
|
217
|
+
style={[
|
|
218
|
+
classes,
|
|
219
|
+
{
|
|
220
|
+
marginTop: insets.top,
|
|
221
|
+
marginBottom: insets.bottom,
|
|
222
|
+
marginRight: insets.right,
|
|
223
|
+
marginLeft: insets.left,
|
|
224
|
+
},
|
|
225
|
+
style,
|
|
226
|
+
]}
|
|
224
227
|
textStyle={[textClasses, textStyle]}
|
|
225
|
-
edges={placement !== 'bottom' ? ['top'] : []}
|
|
226
228
|
>
|
|
227
|
-
<
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
<OverlayProvider>{children}</OverlayProvider>
|
|
233
|
-
</OffcanvasContext.Provider>
|
|
234
|
-
</SafeAreaView>
|
|
235
|
-
</SafeAreaView>
|
|
236
|
-
</BaseModal>
|
|
229
|
+
<OffcanvasContext.Provider value={offcanvas}>
|
|
230
|
+
{children}
|
|
231
|
+
</OffcanvasContext.Provider>
|
|
232
|
+
</View>
|
|
233
|
+
</Dialog>
|
|
237
234
|
);
|
|
238
235
|
});
|
|
239
236
|
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
export interface OffcanvasContextProps {
|
|
4
|
+
identifier: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
const OffcanvasContext = React.createContext<OffcanvasContextProps | null>(
|
|
8
|
+
null,
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
OffcanvasContext.displayName = 'OffcanvasContext';
|
|
12
|
+
|
|
13
|
+
export default OffcanvasContext;
|