@neovici/cosmoz-bottom-bar 4.1.1 → 4.5.0
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/cosmoz-bottom-bar-view.js +36 -48
- package/cosmoz-bottom-bar.html.js +77 -130
- package/cosmoz-bottom-bar.js +5 -23
- package/package.json +11 -18
- package/lib/use-bottom-bar-view.js +0 -62
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { component } from 'haunted';
|
|
2
2
|
import { html } from 'lit-html';
|
|
3
3
|
import { ifDefined } from 'lit-html/directives/if-defined';
|
|
4
|
-
import { ref } from '@neovici/cosmoz-utils/lib/directives/ref';
|
|
5
|
-
import { useBottomBarView } from './lib/use-bottom-bar-view';
|
|
6
4
|
import { bottomBarSlots } from './cosmoz-bottom-bar';
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
10
6
|
/**
|
|
11
7
|
* `cosmoz-bottom-bar-view` contains a content section and a bottom bar with actions.
|
|
12
8
|
*
|
|
@@ -18,49 +14,41 @@ import { bottomBarSlots } from './cosmoz-bottom-bar';
|
|
|
18
14
|
*/
|
|
19
15
|
|
|
20
16
|
const CosmozBottomBarView = ({
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
<slot name="scroller-content"></slot>
|
|
58
|
-
</div>
|
|
59
|
-
<cosmoz-bottom-bar id="bar" ?active=${ active } bar-height=${ ifDefined(barHeight) } part="bar">
|
|
60
|
-
<slot></slot>
|
|
61
|
-
${ bottomBarSlots }
|
|
62
|
-
</cosmoz-bottom-bar>
|
|
63
|
-
`;
|
|
64
|
-
};
|
|
17
|
+
active = true,
|
|
18
|
+
barHeight
|
|
19
|
+
}) => html`
|
|
20
|
+
<style>
|
|
21
|
+
:host {
|
|
22
|
+
position: relative;
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
flex: var(--cosmoz-bottom-bar-view-flex, auto);
|
|
26
|
+
overflow: hidden;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
#content {
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: column;
|
|
32
|
+
flex: auto;
|
|
33
|
+
-webkit-overflow-scrolling: touch;
|
|
34
|
+
overflow-y: auto;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
#bar {
|
|
38
|
+
background-color: var(--cosmoz-bottom-bar-view-bar-color, rgba(230, 230, 230, 0.8));
|
|
39
|
+
box-shadow: var(--cosmoz-bottom-bar-view-bar-shadow, none);
|
|
40
|
+
position: static;
|
|
41
|
+
flex: none;
|
|
42
|
+
}
|
|
43
|
+
</style>
|
|
44
|
+
<div id="content" part="content">
|
|
45
|
+
<slot name="content"></slot>
|
|
46
|
+
<slot name="scroller-content"></slot>
|
|
47
|
+
</div>
|
|
48
|
+
<cosmoz-bottom-bar id="bar" ?active=${ active } bar-height=${ ifDefined(barHeight) } part="bar">
|
|
49
|
+
<slot></slot>
|
|
50
|
+
${ bottomBarSlots }
|
|
51
|
+
</cosmoz-bottom-bar>
|
|
52
|
+
`;
|
|
65
53
|
customElements.define('cosmoz-bottom-bar-view', component(CosmozBottomBarView));
|
|
66
54
|
|
|
@@ -1,133 +1,80 @@
|
|
|
1
|
-
import '@
|
|
2
|
-
|
|
3
|
-
import '@polymer/iron-icons';
|
|
4
|
-
import '@polymer/paper-icon-button';
|
|
5
|
-
import '@polymer/paper-menu-button';
|
|
6
|
-
import '@polymer/paper-listbox';
|
|
7
|
-
import '@polymer/iron-selector/iron-selector';
|
|
8
|
-
|
|
1
|
+
import '@neovici/cosmoz-dropdown';
|
|
9
2
|
import { html } from '@polymer/polymer/lib/utils/html-tag';
|
|
10
|
-
export default html`
|
|
11
|
-
<style>
|
|
12
|
-
:host {
|
|
13
|
-
display: block;
|
|
14
|
-
position: absolute;
|
|
15
|
-
bottom: 0;
|
|
16
|
-
left: 0;
|
|
17
|
-
width: 100%;
|
|
18
|
-
max-width: 100%; /* Firefox fix */
|
|
19
|
-
background-color: inherit;
|
|
20
|
-
transition: max-height 0.3s ease;
|
|
21
|
-
z-index: 10;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
[hidden] {
|
|
25
|
-
display: none !important;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
#bar, #info, #toolbar, #extraToolbarSlot, #menu, #dropdown ::slotted(:not(slot)) {
|
|
29
|
-
display: flex;
|
|
30
|
-
align-items: center;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
#bar {
|
|
34
|
-
padding: 0 3%;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
#info {
|
|
38
|
-
min-width: 5px;
|
|
39
|
-
padding-right: 3%;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
#dropdownButton {
|
|
43
|
-
color: var(--cosmoz-bottom-bar-menubutton-color, var(--light-primary-color));
|
|
44
|
-
background-color: var(--cosmoz-bottom-bar-menubutton-background-color, var(--dark-primary-color));
|
|
45
|
-
@apply --cosmoz-bottom-bar-menubutton;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
#extraToolbarSlot ::slotted(:not(slot)) {
|
|
49
|
-
@apply --cosmoz-bottom-bar-extra-toolbar-item;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
#flex {
|
|
53
|
-
flex: 1 0.000000000001px;
|
|
54
|
-
}
|
|
55
3
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
</div>
|
|
4
|
+
export default html`
|
|
5
|
+
<style>
|
|
6
|
+
:host {
|
|
7
|
+
display: block;
|
|
8
|
+
position: absolute;
|
|
9
|
+
bottom: 0;
|
|
10
|
+
left: 0;
|
|
11
|
+
width: 100%;
|
|
12
|
+
max-width: 100%; /* Firefox fix */
|
|
13
|
+
background-color: inherit;
|
|
14
|
+
transition: max-height 0.3s ease;
|
|
15
|
+
z-index: 10;
|
|
16
|
+
--cosmoz-dropdown-anchor-spacing: 12px 6px;
|
|
17
|
+
--paper-button: {
|
|
18
|
+
background-color: inherit;
|
|
19
|
+
text-transform: none;
|
|
20
|
+
border: 0;
|
|
21
|
+
border-radius: 0;
|
|
22
|
+
font-size: inherit;
|
|
23
|
+
color: inherit;
|
|
24
|
+
font-weight: inherit;
|
|
25
|
+
margin: 0;
|
|
26
|
+
padding: 0;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
[hidden], ::slotted([hidden]) {
|
|
30
|
+
display: none !important;
|
|
31
|
+
}
|
|
32
|
+
#bar {
|
|
33
|
+
padding: 0 3%;
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
}
|
|
37
|
+
#info {
|
|
38
|
+
min-width: 5px;
|
|
39
|
+
padding-right: 3%;
|
|
40
|
+
margin-right: auto;
|
|
41
|
+
white-space: nowrap;
|
|
42
|
+
}
|
|
43
|
+
#bottomBarToolbar::slotted(:not(slot)) {
|
|
44
|
+
margin: 0 0.29em;
|
|
45
|
+
min-width: 40px;
|
|
46
|
+
min-height: 40px;
|
|
47
|
+
text-overflow: ellipsis;
|
|
48
|
+
white-space: nowrap;
|
|
49
|
+
background: var(--cosmoz-bottom-bar-button-bg-color, var(--cosmoz-button-bg-color, #101010));
|
|
50
|
+
color: var(--cosmoz-bottom-bar-button-color, var(--cosmoz-button-color, #fff));
|
|
51
|
+
border-radius: 6px;
|
|
52
|
+
padding: 0 18px;
|
|
53
|
+
font-size: 14px;
|
|
54
|
+
font-weight: 500;
|
|
55
|
+
line-height: 40px;
|
|
56
|
+
}
|
|
57
|
+
#bottomBarToolbar::slotted(:not(slot):hover) {
|
|
58
|
+
background: var(--cosmoz-bottom-bar-button-hover-bg-color, var(--cosmoz-button-hover-bg-color, #3A3F44));
|
|
59
|
+
}
|
|
60
|
+
#dropdown::part(dropdown) {
|
|
61
|
+
max-width: 300px;
|
|
62
|
+
}
|
|
63
|
+
</style>
|
|
64
|
+
<div id="bar" style$="[[ _getHeightStyle(computedBarHeight) ]]" part="bar">
|
|
65
|
+
<div id="info"><slot name="info"></slot></div>
|
|
66
|
+
<slot id="bottomBarToolbar" name="bottom-bar-toolbar"></slot>
|
|
67
|
+
<cosmoz-dropdown-menu id="dropdown" hidden="[[ !hasMenuItems ]]" placement="[[ topPlacement ]]">
|
|
68
|
+
<svg slot="button" width="4" height="16" viewBox="0 0 4 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
69
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M1.50996e-07 2C1.02714e-07 3.10457 0.89543 4 2 4C3.10457 4 4 3.10457 4 2C4 0.89543 3.10457 -3.91405e-08 2 -8.74228e-08C0.895431 -1.35705e-07 1.99278e-07 0.89543 1.50996e-07 2Z" fill="white"/>
|
|
70
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M1.50996e-07 8C1.02714e-07 9.10457 0.89543 10 2 10C3.10457 10 4 9.10457 4 8C4 6.89543 3.10457 6 2 6C0.895431 6 1.99278e-07 6.89543 1.50996e-07 8Z" fill="white"/>
|
|
71
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M1.50996e-07 14C1.02714e-07 15.1046 0.89543 16 2 16C3.10457 16 4 15.1046 4 14C4 12.8954 3.10457 12 2 12C0.895431 12 1.99278e-07 12.8954 1.50996e-07 14Z" fill="white"/>
|
|
72
|
+
</svg>
|
|
73
|
+
<slot id="bottomBarMenu" name="bottom-bar-menu"></slot>
|
|
74
|
+
</cosmoz-dropdown-menu>
|
|
75
|
+
<slot name="extra" id="extraSlot"></slot>
|
|
76
|
+
</div>
|
|
77
|
+
<div hidden style="display:none">
|
|
78
|
+
<slot id="content"></slot>
|
|
79
|
+
</div>
|
|
133
80
|
`;
|
package/cosmoz-bottom-bar.js
CHANGED
|
@@ -7,6 +7,7 @@ import { Debouncer } from '@polymer/polymer/lib/utils/debounce.js';
|
|
|
7
7
|
import { timeOut } from '@polymer/polymer/lib/utils/async';
|
|
8
8
|
import template from './cosmoz-bottom-bar.html.js';
|
|
9
9
|
import { html } from 'haunted';
|
|
10
|
+
import { defaultPlacement } from '@neovici/cosmoz-dropdown';
|
|
10
11
|
|
|
11
12
|
const
|
|
12
13
|
BOTTOM_BAR_TOOLBAR_SLOT = 'bottom-bar-toolbar',
|
|
@@ -155,6 +156,10 @@ class CosmozBottomBar extends PolymerElement {
|
|
|
155
156
|
_matchHeightElement: {
|
|
156
157
|
type: Object,
|
|
157
158
|
computed: '_getHeightMatchingElement(matchParent)'
|
|
159
|
+
},
|
|
160
|
+
|
|
161
|
+
topPlacement: {
|
|
162
|
+
value: ['top-right', ...defaultPlacement]
|
|
158
163
|
}
|
|
159
164
|
};
|
|
160
165
|
}
|
|
@@ -167,7 +172,6 @@ class CosmozBottomBar extends PolymerElement {
|
|
|
167
172
|
|
|
168
173
|
constructor() {
|
|
169
174
|
super();
|
|
170
|
-
this._boundDropdownClosed = this._dropdownClosed.bind(this);
|
|
171
175
|
this._boundChildrenUpdated = this._childrenUpdated.bind(this);
|
|
172
176
|
this._boundLayoutActions = this._layoutActions.bind(this);
|
|
173
177
|
this._resizeObserver = new ResizeObserver((...args) => {
|
|
@@ -179,7 +183,6 @@ class CosmozBottomBar extends PolymerElement {
|
|
|
179
183
|
connectedCallback() {
|
|
180
184
|
super.connectedCallback();
|
|
181
185
|
|
|
182
|
-
this.addEventListener('iron-closed-overlay', this._boundDropdownClosed);
|
|
183
186
|
|
|
184
187
|
const layoutOnRemove = info => info.removedNodes.filter(this._isActionNode) && this._debounceLayoutActions();
|
|
185
188
|
this._nodeObservers = [
|
|
@@ -196,7 +199,6 @@ class CosmozBottomBar extends PolymerElement {
|
|
|
196
199
|
disconnectedCallback() {
|
|
197
200
|
super.disconnectedCallback();
|
|
198
201
|
|
|
199
|
-
this.removeEventListener('iron-closed-overlay', this._boundDropdownClosed);
|
|
200
202
|
[...this._nodeObservers, this._hiddenMutationObserver].forEach(e => e.disconnect(e));
|
|
201
203
|
this._layoutDebouncer?.cancel(); /* eslint-disable-line no-unused-expressions */
|
|
202
204
|
this._resizeObserver.unobserve(this);
|
|
@@ -240,20 +242,6 @@ class CosmozBottomBar extends PolymerElement {
|
|
|
240
242
|
);
|
|
241
243
|
}
|
|
242
244
|
|
|
243
|
-
_dropdownClosed() {
|
|
244
|
-
this.$.dropdownButton.active = false;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
_fireAction(item) {
|
|
248
|
-
item?.dispatchEvent?.(new window.CustomEvent('action', {
|
|
249
|
-
bubbles: true,
|
|
250
|
-
cancelable: true,
|
|
251
|
-
detail: {
|
|
252
|
-
item
|
|
253
|
-
}
|
|
254
|
-
}));
|
|
255
|
-
}
|
|
256
|
-
|
|
257
245
|
_getHeightMatchingElement(matchParent) {
|
|
258
246
|
if (matchParent) {
|
|
259
247
|
return this.parentElement;
|
|
@@ -317,7 +305,6 @@ class CosmozBottomBar extends PolymerElement {
|
|
|
317
305
|
toolbarElements.forEach(el => this._moveElement(el, true));
|
|
318
306
|
menuElements.forEach(el => this._moveElement(el));
|
|
319
307
|
this._setHasMenuItems(menuElements.length > 0);
|
|
320
|
-
this.$.menu.$.dropdown.notifyResize();
|
|
321
308
|
}
|
|
322
309
|
|
|
323
310
|
_moveElement(element, toToolbar) {
|
|
@@ -330,11 +317,6 @@ class CosmozBottomBar extends PolymerElement {
|
|
|
330
317
|
this.updateStyles();
|
|
331
318
|
}
|
|
332
319
|
|
|
333
|
-
_onActionSelected(event, detail) {
|
|
334
|
-
this._fireAction(detail.item);
|
|
335
|
-
event.currentTarget.selected = undefined;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
320
|
_onResize([entry]) {
|
|
339
321
|
const hidden = entry.borderBoxSize?.[0]?.inlineSize === 0 || entry.contentRect?.width === 0;
|
|
340
322
|
if (hidden) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neovici/cosmoz-bottom-bar",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0",
|
|
4
4
|
"description": "A responsive bottom-bar that can house buttons/actions and a menu for the buttons that won't fit the available width.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"polymer",
|
|
@@ -51,35 +51,28 @@
|
|
|
51
51
|
]
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@neovici/cosmoz-
|
|
55
|
-
"@neovici/cosmoz-viewinfo": "^3.1.3",
|
|
56
|
-
"@polymer/iron-icons": "^3.0.1",
|
|
57
|
-
"@polymer/iron-selector": "^3.0.0",
|
|
58
|
-
"@polymer/paper-icon-button": "^3.0.0",
|
|
59
|
-
"@polymer/paper-listbox": "^3.0.0",
|
|
60
|
-
"@polymer/paper-menu-button": "^3.0.0",
|
|
54
|
+
"@neovici/cosmoz-dropdown": "^1.1.0",
|
|
61
55
|
"@polymer/polymer": "^3.3.1",
|
|
62
|
-
"@webcomponents/shadycss": "^1.10.2",
|
|
63
56
|
"haunted": "^4.8.0",
|
|
64
57
|
"lit-html": "^1.4.0"
|
|
65
58
|
},
|
|
66
59
|
"devDependencies": {
|
|
67
|
-
"@commitlint/cli": "^
|
|
68
|
-
"@commitlint/config-conventional": "^
|
|
60
|
+
"@commitlint/cli": "^15.0.0",
|
|
61
|
+
"@commitlint/config-conventional": "^15.0.0",
|
|
69
62
|
"@neovici/eslint-config": "^1.3.0",
|
|
70
63
|
"@open-wc/testing": "^2.5.0",
|
|
71
64
|
"@polymer/iron-icon": "^3.0.1",
|
|
65
|
+
"@polymer/iron-icons": "^3.0.1",
|
|
72
66
|
"@polymer/paper-button": "^3.0.0",
|
|
73
67
|
"@polymer/paper-toggle-button": "^3.0.0",
|
|
74
|
-
"@semantic-release/changelog": "^
|
|
75
|
-
"@semantic-release/git": "^
|
|
76
|
-
"@web/dev-server": "^0.1.
|
|
68
|
+
"@semantic-release/changelog": "^6.0.0",
|
|
69
|
+
"@semantic-release/git": "^10.0.0",
|
|
70
|
+
"@web/dev-server": "^0.1.0",
|
|
77
71
|
"@web/test-runner": "^0.13.0",
|
|
78
72
|
"@web/test-runner-selenium": "^0.5.0",
|
|
79
73
|
"@webcomponents/webcomponentsjs": "^2.5.0",
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"sinon": "^11.0.0"
|
|
74
|
+
"husky": "^7.0.0",
|
|
75
|
+
"semantic-release": "^18.0.0",
|
|
76
|
+
"sinon": "^12.0.0"
|
|
84
77
|
}
|
|
85
78
|
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useEffect,
|
|
3
|
-
useState,
|
|
4
|
-
useMemo
|
|
5
|
-
} from 'haunted';
|
|
6
|
-
import { useViewInfo } from '@neovici/cosmoz-viewinfo';
|
|
7
|
-
|
|
8
|
-
const useBottomBarView = ({
|
|
9
|
-
active: initialActive = true,
|
|
10
|
-
fixed
|
|
11
|
-
}) => { /* eslint-disable no-return-assign */
|
|
12
|
-
const { desktop } = useViewInfo(),
|
|
13
|
-
isFixed = fixed ?? desktop,
|
|
14
|
-
[active, setActive] = useState(initialActive),
|
|
15
|
-
info = useMemo(() => ({}), []);
|
|
16
|
-
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
if (isFixed) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
const
|
|
22
|
-
{ current: el } = info,
|
|
23
|
-
opts = { passive: true },
|
|
24
|
-
onScroll = () => {
|
|
25
|
-
if (info.raf) {
|
|
26
|
-
cancelAnimationFrame(info.raf);
|
|
27
|
-
}
|
|
28
|
-
info.raf = requestAnimationFrame(() => info.raf = requestAnimationFrame(() => {
|
|
29
|
-
const { scrollTop } = el;
|
|
30
|
-
setActive(
|
|
31
|
-
scrollTop < 2 // at top
|
|
32
|
-
|| info.scrollTop > scrollTop // scrolling up
|
|
33
|
-
|| el.scrollHeight - scrollTop - el.offsetHeight < 3 // at bottom
|
|
34
|
-
);
|
|
35
|
-
Object.assign(info, {
|
|
36
|
-
scrollTop,
|
|
37
|
-
raf: undefined
|
|
38
|
-
});
|
|
39
|
-
}));
|
|
40
|
-
};
|
|
41
|
-
el.addEventListener('scroll', onScroll, opts);
|
|
42
|
-
onScroll();
|
|
43
|
-
return () => {
|
|
44
|
-
el.removeEventListener('scroll', onScroll, opts);
|
|
45
|
-
if (info.raf) {
|
|
46
|
-
cancelAnimationFrame(info.raf);
|
|
47
|
-
info.raf = undefined;
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
}, [isFixed, info]);
|
|
51
|
-
|
|
52
|
-
useEffect(() => {
|
|
53
|
-
setActive(initialActive);
|
|
54
|
-
}, [initialActive, setActive]);
|
|
55
|
-
|
|
56
|
-
return {
|
|
57
|
-
active,
|
|
58
|
-
info
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
export { useBottomBarView };
|