bootstrap-rn 0.3.1 → 0.3.3
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/commonjs/Provider.js +3 -0
- package/lib/commonjs/Provider.js.map +1 -1
- package/lib/commonjs/components/Caret.js +1 -1
- package/lib/commonjs/components/badge/Badge.js +1 -1
- package/lib/commonjs/components/buttons/Button.js +3 -3
- package/lib/commonjs/components/close/CloseButton.js +2 -2
- package/lib/commonjs/components/dropdown/DropdownItem.js +1 -1
- package/lib/commonjs/components/dropdown/useToggleDropdown.js +1 -0
- package/lib/commonjs/components/dropdown/useToggleDropdown.js.map +1 -1
- package/lib/commonjs/components/forms/FormCheckInput.js +1 -1
- package/lib/commonjs/components/list-group/ListGroupItem.js +1 -1
- package/lib/commonjs/components/modal/Modal.js +3 -8
- package/lib/commonjs/components/modal/Modal.js.map +1 -1
- package/lib/commonjs/components/modal/useModal.js +13 -1
- package/lib/commonjs/components/modal/useModal.js.map +1 -1
- package/lib/commonjs/components/navbar/NavbarToggler.js +1 -1
- package/lib/commonjs/components/offcanvas/Offcanvas.js +1 -6
- package/lib/commonjs/components/offcanvas/Offcanvas.js.map +1 -1
- package/lib/commonjs/components/offcanvas/useOffcanvas.js +13 -1
- package/lib/commonjs/components/offcanvas/useOffcanvas.js.map +1 -1
- package/lib/commonjs/components/toasts/Toast.js +1 -1
- package/lib/commonjs/components/toasts/ToastContainer.js +1 -1
- package/lib/commonjs/hooks/useScrollbarEffects.js +48 -41
- package/lib/commonjs/hooks/useScrollbarEffects.js.map +1 -1
- package/lib/commonjs/theme/utilities.js +8 -8
- package/lib/commonjs/theme/utilities.js.map +1 -1
- package/lib/module/Provider.js +3 -0
- package/lib/module/Provider.js.map +1 -1
- package/lib/module/components/Caret.js +1 -1
- package/lib/module/components/badge/Badge.js +1 -1
- package/lib/module/components/buttons/Button.js +3 -3
- package/lib/module/components/close/CloseButton.js +2 -2
- package/lib/module/components/dropdown/DropdownItem.js +1 -1
- package/lib/module/components/dropdown/useToggleDropdown.js +1 -0
- package/lib/module/components/dropdown/useToggleDropdown.js.map +1 -1
- package/lib/module/components/forms/FormCheckInput.js +1 -1
- package/lib/module/components/list-group/ListGroupItem.js +1 -1
- package/lib/module/components/modal/Modal.js +3 -8
- package/lib/module/components/modal/Modal.js.map +1 -1
- package/lib/module/components/modal/useModal.js +13 -2
- package/lib/module/components/modal/useModal.js.map +1 -1
- package/lib/module/components/navbar/NavbarToggler.js +1 -1
- package/lib/module/components/offcanvas/Offcanvas.js +1 -6
- package/lib/module/components/offcanvas/Offcanvas.js.map +1 -1
- package/lib/module/components/offcanvas/useOffcanvas.js +13 -2
- package/lib/module/components/offcanvas/useOffcanvas.js.map +1 -1
- package/lib/module/components/toasts/Toast.js +1 -1
- package/lib/module/components/toasts/ToastContainer.js +1 -1
- package/lib/module/hooks/useScrollbarEffects.js +49 -41
- package/lib/module/hooks/useScrollbarEffects.js.map +1 -1
- package/lib/module/theme/utilities.js +8 -8
- package/lib/module/theme/utilities.js.map +1 -1
- package/package.json +69 -69
- package/src/Provider.js +63 -59
- package/src/components/Caret.js +127 -127
- package/src/components/badge/Badge.js +52 -52
- package/src/components/buttons/Button.js +381 -381
- package/src/components/close/CloseButton.js +146 -146
- package/src/components/dropdown/DropdownItem.js +151 -151
- package/src/components/dropdown/useToggleDropdown.js +1 -0
- package/src/components/forms/FormCheckInput.js +247 -247
- package/src/components/list-group/ListGroupItem.js +1 -1
- package/src/components/modal/Modal.js +235 -241
- package/src/components/modal/useModal.js +25 -10
- package/src/components/navbar/NavbarToggler.js +132 -132
- package/src/components/offcanvas/Offcanvas.js +252 -258
- package/src/components/offcanvas/useOffcanvas.js +20 -5
- package/src/components/toasts/Toast.js +1 -1
- package/src/components/toasts/ToastContainer.js +43 -43
- package/src/hooks/useScrollbarEffects.js +61 -41
- package/src/theme/utilities.js +4 -4
|
@@ -1,258 +1,252 @@
|
|
|
1
|
-
import React, { useContext, useRef } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { Modal as BaseModal, SafeAreaView } from 'react-native';
|
|
4
|
-
import { OverlayProvider } from '@react-native-aria/overlays';
|
|
5
|
-
import StyleSheet from '../../style/StyleSheet';
|
|
6
|
-
import css from '../../style/css';
|
|
7
|
-
import BackdropHandler from '../helpers/BackdropHandler';
|
|
8
|
-
import View from '../View';
|
|
9
|
-
import { GRID_BREAKPOINTS } from '../../theme/proxies';
|
|
10
|
-
import { infix, next } from '../../theme/breakpoints';
|
|
11
|
-
import { getStyles, each, concatRefs } from '../../utils';
|
|
12
|
-
import useMedia from '../../hooks/useMedia';
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
background-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
// @include
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
border-
|
|
77
|
-
border-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
border-
|
|
87
|
-
border-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
border-
|
|
98
|
-
border-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
width:
|
|
109
|
-
border-
|
|
110
|
-
border-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
//
|
|
115
|
-
//
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
max-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
border-
|
|
144
|
-
|
|
145
|
-
// @include
|
|
146
|
-
//
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
const
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
Offcanvas.
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
Offcanvas.Context = OffcanvasContext;
|
|
254
|
-
Offcanvas.Header = OffcanvasHeader;
|
|
255
|
-
Offcanvas.Title = OffcanvasTitle;
|
|
256
|
-
Offcanvas.Body = OffcanvasBody;
|
|
257
|
-
|
|
258
|
-
export default Offcanvas;
|
|
1
|
+
import React, { useContext, useRef } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { Modal as BaseModal, SafeAreaView } from 'react-native';
|
|
4
|
+
import { OverlayProvider } from '@react-native-aria/overlays';
|
|
5
|
+
import StyleSheet from '../../style/StyleSheet';
|
|
6
|
+
import css from '../../style/css';
|
|
7
|
+
import BackdropHandler from '../helpers/BackdropHandler';
|
|
8
|
+
import View from '../View';
|
|
9
|
+
import { GRID_BREAKPOINTS } from '../../theme/proxies';
|
|
10
|
+
import { infix, next } from '../../theme/breakpoints';
|
|
11
|
+
import { getStyles, each, concatRefs } from '../../utils';
|
|
12
|
+
import useMedia from '../../hooks/useMedia';
|
|
13
|
+
import NavbarContext from '../navbar/NavbarContext';
|
|
14
|
+
import useOffcanvas from './useOffcanvas';
|
|
15
|
+
import OffcanvasContext from './OffcanvasContext';
|
|
16
|
+
import OffcanvasHeader from './OffcanvasHeader';
|
|
17
|
+
import OffcanvasTitle from './OffcanvasTitle';
|
|
18
|
+
import OffcanvasBody from './OffcanvasBody';
|
|
19
|
+
|
|
20
|
+
export const PLACEMENTS = ['top', 'bottom', 'start', 'end']; // , 'auto'
|
|
21
|
+
|
|
22
|
+
const propTypes = {
|
|
23
|
+
children: PropTypes.node.isRequired,
|
|
24
|
+
visible: PropTypes.bool,
|
|
25
|
+
placement: PropTypes.oneOf(PLACEMENTS),
|
|
26
|
+
backdrop: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['static'])]),
|
|
27
|
+
// Currently only supported on web.
|
|
28
|
+
scroll: PropTypes.bool,
|
|
29
|
+
onToggle: PropTypes.func,
|
|
30
|
+
// eslint-disable-next-line react/forbid-prop-types
|
|
31
|
+
style: PropTypes.any,
|
|
32
|
+
// eslint-disable-next-line react/forbid-prop-types
|
|
33
|
+
dialogStyle: PropTypes.any,
|
|
34
|
+
// eslint-disable-next-line react/forbid-prop-types
|
|
35
|
+
textStyle: PropTypes.any,
|
|
36
|
+
// eslint-disable-next-line react/forbid-prop-types
|
|
37
|
+
dialogTextStyle: PropTypes.any,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const styles = StyleSheet.create({
|
|
41
|
+
'.offcanvas': css`
|
|
42
|
+
position: absolute; // fixed;
|
|
43
|
+
// bottom: 0;
|
|
44
|
+
z-index: $zindex-offcanvas;
|
|
45
|
+
display: flex;
|
|
46
|
+
flex-direction: column;
|
|
47
|
+
max-width: 100%;
|
|
48
|
+
// visibility: hidden;
|
|
49
|
+
background-color: $offcanvas-bg-color;
|
|
50
|
+
// background-clip: padding-box;
|
|
51
|
+
@include platform(web) {
|
|
52
|
+
outline-width: 0; // outline: 0;
|
|
53
|
+
}
|
|
54
|
+
// @include box-shadow($offcanvas-box-shadow);
|
|
55
|
+
// @include transition(transform $offcanvas-transition-duration ease-in-out);
|
|
56
|
+
`,
|
|
57
|
+
'.offcanvas --text': css`
|
|
58
|
+
color: $offcanvas-color;
|
|
59
|
+
`,
|
|
60
|
+
'.offcanvas-backdrop': css`
|
|
61
|
+
position: absolute;
|
|
62
|
+
top: 0;
|
|
63
|
+
left: 0;
|
|
64
|
+
z-index: $zindex-offcanvas-backdrop;
|
|
65
|
+
width: 100%;
|
|
66
|
+
height: 100%;
|
|
67
|
+
background-color: $offcanvas-backdrop-bg;
|
|
68
|
+
opacity: $offcanvas-backdrop-opacity;
|
|
69
|
+
`,
|
|
70
|
+
'.offcanvas-start': css`
|
|
71
|
+
top: 0;
|
|
72
|
+
bottom: 0; // added for bootstrap-rn
|
|
73
|
+
left: 0;
|
|
74
|
+
// width: $offcanvas-horizontal-width;
|
|
75
|
+
border-right-width: $offcanvas-border-width;
|
|
76
|
+
border-style: solid;
|
|
77
|
+
border-color: $offcanvas-border-color;
|
|
78
|
+
// transform: translateX(-100%);
|
|
79
|
+
`,
|
|
80
|
+
'.offcanvas-end': css`
|
|
81
|
+
top: 0;
|
|
82
|
+
bottom: 0; // added for bootstrap-rn
|
|
83
|
+
right: 0;
|
|
84
|
+
// width: $offcanvas-horizontal-width;
|
|
85
|
+
border-left-width: $offcanvas-border-width;
|
|
86
|
+
border-style: solid;
|
|
87
|
+
border-color: $offcanvas-border-color;
|
|
88
|
+
// transform: translateX(100%);
|
|
89
|
+
`,
|
|
90
|
+
'.offcanvas-top': css`
|
|
91
|
+
top: 0;
|
|
92
|
+
right: 0;
|
|
93
|
+
left: 0;
|
|
94
|
+
// height: $offcanvas-vertical-height;
|
|
95
|
+
max-height: 100%;
|
|
96
|
+
border-bottom-width: $offcanvas-border-width;
|
|
97
|
+
border-style: solid;
|
|
98
|
+
border-color: $offcanvas-border-color;
|
|
99
|
+
// transform: translateY(-100%);
|
|
100
|
+
`,
|
|
101
|
+
'.offcanvas-bottom': css`
|
|
102
|
+
bottom: 0; // added for bootstrap-rn
|
|
103
|
+
right: 0;
|
|
104
|
+
left: 0;
|
|
105
|
+
// height: $offcanvas-vertical-height;
|
|
106
|
+
max-height: 100%;
|
|
107
|
+
width: 100%;
|
|
108
|
+
border-top-width: $offcanvas-border-width;
|
|
109
|
+
border-style: solid;
|
|
110
|
+
border-color: $offcanvas-border-color;
|
|
111
|
+
// transform: translateY(100%);
|
|
112
|
+
`,
|
|
113
|
+
// The following .offcanvas-dialog classes are added for bootstrap-rn,
|
|
114
|
+
// because otherwise the text would exceed a width of 100% on native
|
|
115
|
+
// and also additional width by SafeAreaView would not be applied.
|
|
116
|
+
'.offcanvas-dialog': css`
|
|
117
|
+
max-width: 100%;
|
|
118
|
+
max-height: 100%;
|
|
119
|
+
`,
|
|
120
|
+
'.offcanvas-dialog-start': css`
|
|
121
|
+
width: $offcanvas-horizontal-width;
|
|
122
|
+
`,
|
|
123
|
+
'.offcanvas-dialog-end': css`
|
|
124
|
+
width: $offcanvas-horizontal-width;
|
|
125
|
+
`,
|
|
126
|
+
'.offcanvas-dialog-top': css`
|
|
127
|
+
height: $offcanvas-vertical-height;
|
|
128
|
+
`,
|
|
129
|
+
'.offcanvas-dialog-bottom': css`
|
|
130
|
+
height: $offcanvas-vertical-height;
|
|
131
|
+
`,
|
|
132
|
+
// Navbar styles
|
|
133
|
+
...each(GRID_BREAKPOINTS, (breakpoint) => ({
|
|
134
|
+
[`.navbar-expand${infix(next(breakpoint))} .offcanvas`]: css`
|
|
135
|
+
@include media-breakpoint-up(${next(breakpoint)}) {
|
|
136
|
+
position: relative; // inherit;
|
|
137
|
+
bottom: 0;
|
|
138
|
+
// z-index: auto;
|
|
139
|
+
flex-grow: 1;
|
|
140
|
+
// visibility: visible !important; // stylelint-disable-line declaration-no-important
|
|
141
|
+
background-color: transparent;
|
|
142
|
+
border-right-width: 0;
|
|
143
|
+
border-left-width: 0;
|
|
144
|
+
// @include box-shadow(none);
|
|
145
|
+
// @include transition(none);
|
|
146
|
+
// transform: none;
|
|
147
|
+
}
|
|
148
|
+
`,
|
|
149
|
+
})),
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
const Offcanvas = React.forwardRef((props, ref) => {
|
|
153
|
+
const {
|
|
154
|
+
children,
|
|
155
|
+
visible,
|
|
156
|
+
placement = 'top',
|
|
157
|
+
backdrop = true,
|
|
158
|
+
scroll = false,
|
|
159
|
+
onToggle: handleToggle,
|
|
160
|
+
style,
|
|
161
|
+
dialogStyle,
|
|
162
|
+
textStyle,
|
|
163
|
+
dialogTextStyle,
|
|
164
|
+
...elementProps
|
|
165
|
+
} = props;
|
|
166
|
+
|
|
167
|
+
const media = useMedia();
|
|
168
|
+
const navbar = useContext(NavbarContext);
|
|
169
|
+
const offcanvasRef = useRef();
|
|
170
|
+
|
|
171
|
+
const offcanvas = useOffcanvas(visible, scroll);
|
|
172
|
+
|
|
173
|
+
const backdropClasses = getStyles(styles, ['.offcanvas-backdrop']);
|
|
174
|
+
const classes = getStyles(styles, [
|
|
175
|
+
'.offcanvas',
|
|
176
|
+
`.offcanvas-${placement}`,
|
|
177
|
+
navbar &&
|
|
178
|
+
navbar.expand &&
|
|
179
|
+
`.navbar-expand${
|
|
180
|
+
navbar.expand === true ? '' : `-${navbar.expand}`
|
|
181
|
+
} .offcanvas`,
|
|
182
|
+
]);
|
|
183
|
+
const dialogClasses = getStyles(styles, [
|
|
184
|
+
'.offcanvas-dialog',
|
|
185
|
+
`.offcanvas-dialog-${placement}`,
|
|
186
|
+
]);
|
|
187
|
+
const textClasses = getStyles(styles, ['.offcanvas-content --text']);
|
|
188
|
+
|
|
189
|
+
// Render children without modal for navbar.
|
|
190
|
+
if (
|
|
191
|
+
navbar &&
|
|
192
|
+
navbar.expand &&
|
|
193
|
+
(navbar.expand === true || media.up(navbar.expand))
|
|
194
|
+
) {
|
|
195
|
+
return (
|
|
196
|
+
<View
|
|
197
|
+
{...elementProps}
|
|
198
|
+
ref={ref}
|
|
199
|
+
style={[classes, style]}
|
|
200
|
+
textStyle={[textClasses, textStyle]}
|
|
201
|
+
>
|
|
202
|
+
{children}
|
|
203
|
+
</View>
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return (
|
|
208
|
+
<BaseModal
|
|
209
|
+
transparent
|
|
210
|
+
visible={navbar ? navbar.expanded : visible}
|
|
211
|
+
onRequestClose={handleToggle}
|
|
212
|
+
>
|
|
213
|
+
{placement !== 'bottom' && <SafeAreaView style={{ flexGrow: 0 }} />}
|
|
214
|
+
<SafeAreaView style={{ flexGrow: 1 }}>
|
|
215
|
+
{backdrop && (
|
|
216
|
+
<View style={backdropClasses}>
|
|
217
|
+
<BackdropHandler
|
|
218
|
+
dialogRef={offcanvasRef}
|
|
219
|
+
onClose={handleToggle}
|
|
220
|
+
backdrop={backdrop}
|
|
221
|
+
/>
|
|
222
|
+
</View>
|
|
223
|
+
)}
|
|
224
|
+
<View
|
|
225
|
+
{...elementProps}
|
|
226
|
+
ref={concatRefs(offcanvasRef, ref)}
|
|
227
|
+
style={[classes, style]}
|
|
228
|
+
textStyle={[textClasses, textStyle]}
|
|
229
|
+
>
|
|
230
|
+
<View
|
|
231
|
+
style={[dialogClasses, dialogStyle]}
|
|
232
|
+
textStyle={dialogTextStyle}
|
|
233
|
+
>
|
|
234
|
+
<OffcanvasContext.Provider value={offcanvas}>
|
|
235
|
+
<OverlayProvider>{children}</OverlayProvider>
|
|
236
|
+
</OffcanvasContext.Provider>
|
|
237
|
+
</View>
|
|
238
|
+
</View>
|
|
239
|
+
</SafeAreaView>
|
|
240
|
+
</BaseModal>
|
|
241
|
+
);
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
Offcanvas.displayName = 'Offcanvas';
|
|
245
|
+
Offcanvas.propTypes = propTypes;
|
|
246
|
+
|
|
247
|
+
Offcanvas.Context = OffcanvasContext;
|
|
248
|
+
Offcanvas.Header = OffcanvasHeader;
|
|
249
|
+
Offcanvas.Title = OffcanvasTitle;
|
|
250
|
+
Offcanvas.Body = OffcanvasBody;
|
|
251
|
+
|
|
252
|
+
export default Offcanvas;
|
|
@@ -1,5 +1,20 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { useContext, useEffect, useMemo } from 'react';
|
|
2
|
+
import Context from '../../Context';
|
|
3
|
+
|
|
4
|
+
export default function useOffcanvas(visible, scroll) {
|
|
5
|
+
const context = useContext(Context);
|
|
6
|
+
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
if (!visible || scroll) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
context.scrollbars.hide();
|
|
13
|
+
|
|
14
|
+
return () => {
|
|
15
|
+
context.scrollbars.show();
|
|
16
|
+
};
|
|
17
|
+
}, [visible, scroll]);
|
|
18
|
+
|
|
19
|
+
return useMemo(() => ({}), []);
|
|
20
|
+
}
|
|
@@ -21,7 +21,7 @@ const styles = StyleSheet.create({
|
|
|
21
21
|
'.toast': css`
|
|
22
22
|
width: $toast-max-width;
|
|
23
23
|
max-width: 100%;
|
|
24
|
-
|
|
24
|
+
pointer-events: auto;
|
|
25
25
|
background-color: $toast-background-color;
|
|
26
26
|
// background-clip: padding-box;
|
|
27
27
|
border: $toast-border-width solid $toast-border-color;
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import StyleSheet from '../../style/StyleSheet';
|
|
4
|
-
import css from '../../style/css';
|
|
5
|
-
import View from '../View';
|
|
6
|
-
import { getStyles } from '../../utils';
|
|
7
|
-
import ToastContainerContext from './ToastContainerContext';
|
|
8
|
-
import useList from '../../hooks/useList';
|
|
9
|
-
|
|
10
|
-
const propTypes = {
|
|
11
|
-
children: PropTypes.node.isRequired,
|
|
12
|
-
// eslint-disable-next-line react/forbid-prop-types
|
|
13
|
-
style: PropTypes.any,
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const styles = StyleSheet.create({
|
|
17
|
-
'.toast-container': css`
|
|
18
|
-
width: 100%; // max-content;
|
|
19
|
-
max-width: 100%;
|
|
20
|
-
|
|
21
|
-
`,
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
const ToastContainer = React.forwardRef((props, ref) => {
|
|
25
|
-
const { children, style, ...elementProps } = props;
|
|
26
|
-
|
|
27
|
-
const list = useList(children);
|
|
28
|
-
|
|
29
|
-
const classes = getStyles(styles, ['.toast-container']);
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<View {...elementProps} ref={ref} style={[classes, style]}>
|
|
33
|
-
<ToastContainerContext.Provider value>
|
|
34
|
-
{list}
|
|
35
|
-
</ToastContainerContext.Provider>
|
|
36
|
-
</View>
|
|
37
|
-
);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
ToastContainer.displayName = 'ToastContainer';
|
|
41
|
-
ToastContainer.propTypes = propTypes;
|
|
42
|
-
|
|
43
|
-
export default ToastContainer;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import StyleSheet from '../../style/StyleSheet';
|
|
4
|
+
import css from '../../style/css';
|
|
5
|
+
import View from '../View';
|
|
6
|
+
import { getStyles } from '../../utils';
|
|
7
|
+
import ToastContainerContext from './ToastContainerContext';
|
|
8
|
+
import useList from '../../hooks/useList';
|
|
9
|
+
|
|
10
|
+
const propTypes = {
|
|
11
|
+
children: PropTypes.node.isRequired,
|
|
12
|
+
// eslint-disable-next-line react/forbid-prop-types
|
|
13
|
+
style: PropTypes.any,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const styles = StyleSheet.create({
|
|
17
|
+
'.toast-container': css`
|
|
18
|
+
width: 100%; // max-content;
|
|
19
|
+
max-width: 100%;
|
|
20
|
+
pointer-events: none;
|
|
21
|
+
`,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const ToastContainer = React.forwardRef((props, ref) => {
|
|
25
|
+
const { children, style, ...elementProps } = props;
|
|
26
|
+
|
|
27
|
+
const list = useList(children);
|
|
28
|
+
|
|
29
|
+
const classes = getStyles(styles, ['.toast-container']);
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<View {...elementProps} ref={ref} style={[classes, style]}>
|
|
33
|
+
<ToastContainerContext.Provider value>
|
|
34
|
+
{list}
|
|
35
|
+
</ToastContainerContext.Provider>
|
|
36
|
+
</View>
|
|
37
|
+
);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
ToastContainer.displayName = 'ToastContainer';
|
|
41
|
+
ToastContainer.propTypes = propTypes;
|
|
42
|
+
|
|
43
|
+
export default ToastContainer;
|