bootstrap-rn 0.3.1 → 0.3.2

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