@bifrostui/react 2.0.0-alpha.14 → 2.0.0-alpha.17

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.
@@ -12,5 +12,5 @@ declare const Modal: React.ForwardRefExoticComponent<Omit<ViewProps & {
12
12
  keepMounted?: boolean;
13
13
  } & import("@bifrostui/types").ICommonProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
14
14
  ref?: React.Ref<HTMLDivElement>;
15
- }, "open" | "container" | keyof import("@bifrostui/types").ICommonProps | "disablePortal" | "hideBackdrop" | "BackdropProps" | "onClose" | "disableScrollLock" | "keepMounted">, "ref"> & React.RefAttributes<HTMLDivElement>>;
15
+ }, keyof import("@bifrostui/types").ICommonProps | "open" | "container" | "onClose" | "disablePortal" | "hideBackdrop" | "BackdropProps" | "disableScrollLock" | "keepMounted">, "ref"> & React.RefAttributes<HTMLDivElement>>;
16
16
  export default Modal;
package/dist/Tabs/Tab.css CHANGED
@@ -17,7 +17,6 @@
17
17
  .bui-tab-active {
18
18
  color: var(--bui-tab-active-color);
19
19
  font-weight: var(--bui-font-weight-bold);
20
- font-family: var(--bui-tab-active-font-family);
21
20
  }
22
21
  .bui-tab-disabled {
23
22
  opacity: 0.5;
@@ -16,7 +16,6 @@ xhs-page {
16
16
  --bui-tab-height: 100%;
17
17
  --bui-tab-padding: var(--bui-spacing-lg) var(--bui-spacing-lg) 10px;
18
18
  --bui-tab-active-color: var(--bui-color-fg-default);
19
- --bui-tab-active-font-family: var(--bui-font-family-accent, inherit);
20
19
  }
21
20
  .bui-tabs {
22
21
  position: relative;
package/dist/Tabs/Tabs.js CHANGED
@@ -1,6 +1,8 @@
1
1
  var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
7
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
8
  var __getProtoOf = Object.getPrototypeOf;
@@ -18,6 +20,7 @@ var __spreadValues = (a, b) => {
18
20
  }
19
21
  return a;
20
22
  };
23
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
24
  var __objRest = (source, exclude) => {
22
25
  var target = {};
23
26
  for (var prop in source)
@@ -147,7 +150,7 @@ const Tabs = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
147
150
  if (process.env.NODE_ENV !== "production") {
148
151
  console.count("Tabs render......");
149
152
  }
150
- return /* @__PURE__ */ import_react.default.createElement("div", __spreadValues({ ref, className: (0, import_clsx.default)(import_classes.tabsRootClass, className) }, others), /* @__PURE__ */ import_react.default.createElement(import_TabMask.default, { tabsContainerRef: tabsRef, position: "left" }), /* @__PURE__ */ import_react.default.createElement(import_TabMask.default, { tabsContainerRef: tabsRef, position: "right" }), /* @__PURE__ */ import_react.default.createElement(
153
+ return /* @__PURE__ */ import_react.default.createElement("div", __spreadProps(__spreadValues({ className: (0, import_clsx.default)(import_classes.tabsRootClass, className) }, others), { ref }), /* @__PURE__ */ import_react.default.createElement(import_TabMask.default, { tabsContainerRef: tabsRef, position: "left" }), /* @__PURE__ */ import_react.default.createElement(import_TabMask.default, { tabsContainerRef: tabsRef, position: "right" }), /* @__PURE__ */ import_react.default.createElement(
151
154
  "div",
152
155
  {
153
156
  className: `${import_classes.tabsRootClass}-tabs`,
@@ -16,7 +16,6 @@ xhs-page {
16
16
  --bui-tab-height: 100%;
17
17
  --bui-tab-padding: var(--bui-spacing-lg) var(--bui-spacing-lg) 10px;
18
18
  --bui-tab-active-color: var(--bui-color-fg-default);
19
- --bui-tab-active-font-family: var(--bui-font-family-accent, inherit);
20
19
  }
21
20
  .bui-tabs {
22
21
  position: relative;
@@ -107,7 +106,6 @@ xhs-page {
107
106
  .bui-tab-active {
108
107
  color: var(--bui-tab-active-color);
109
108
  font-weight: var(--bui-font-weight-bold);
110
- font-family: var(--bui-tab-active-font-family);
111
109
  }
112
110
  .bui-tab-disabled {
113
111
  opacity: 0.5;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import { TabProps } from '../Tab.types';
3
3
  import '../Tab.less';
4
- declare const _default: React.NamedExoticComponent<TabProps<"div", {}>>;
4
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<TabProps<"div", {}>, "ref"> & React.RefAttributes<HTMLDivElement>>>;
5
5
  export default _default;
@@ -36,7 +36,7 @@ var import_utils = require("@bifrostui/utils");
36
36
  var import_TabsContext = __toESM(require("./TabsContext"));
37
37
  var import_classes = require("../classes");
38
38
  var import_Tab2 = require("../Tab.css");
39
- const Tab = (props) => {
39
+ const Tab = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
40
40
  const {
41
41
  className,
42
42
  children,
@@ -45,6 +45,8 @@ const Tab = (props) => {
45
45
  onClick,
46
46
  style
47
47
  } = props;
48
+ const innerRef = (0, import_react.useRef)(null);
49
+ const handleRef = (0, import_utils.useForkRef)(ref, innerRef);
48
50
  const isActive = (0, import_utils.useContextSelector)(
49
51
  import_TabsContext.default,
50
52
  (ctx) => ctx.value === index
@@ -85,6 +87,7 @@ const Tab = (props) => {
85
87
  "div",
86
88
  {
87
89
  id: tabId,
90
+ ref: handleRef,
88
91
  className: rootCls,
89
92
  style,
90
93
  onClick: (e) => {
@@ -96,7 +99,7 @@ const Tab = (props) => {
96
99
  },
97
100
  children
98
101
  );
99
- };
102
+ });
100
103
  Tab.displayName = "BuiTab";
101
104
  var Tab_default = /* @__PURE__ */ import_react.default.memo(Tab, (prevProps, nextProps) => {
102
105
  return prevProps.index === nextProps.index && prevProps.disabled === nextProps.disabled && prevProps.className === nextProps.className && prevProps.children === nextProps.children;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import { TabsProps } from '../Tabs.types';
3
3
  import '../Tabs.less';
4
- declare const Tabs: React.FC<TabsProps>;
4
+ declare const Tabs: React.ForwardRefExoticComponent<Omit<TabsProps<"div", {}>, "ref"> & React.RefAttributes<HTMLDivElement>>;
5
5
  export default Tabs;
@@ -62,7 +62,7 @@ var import_TabsContext = require("./TabsContext");
62
62
  var import_classes = require("../classes");
63
63
  var import_queryBatch = require("./utils/queryBatch");
64
64
  var import_Tabs2 = require("../Tabs.css");
65
- const Tabs = (props) => {
65
+ const Tabs = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
66
66
  const {
67
67
  children,
68
68
  className,
@@ -126,8 +126,8 @@ const Tabs = (props) => {
126
126
  });
127
127
  const handleClick = (0, import_utils.useEventCallback)(
128
128
  (e, item) => {
129
- const { index, disabled: isDisabled = false } = item;
130
- if (isDisabled || [void 0, null].includes(index))
129
+ const { index, disabled = false } = item;
130
+ if (disabled || [void 0, null].includes(index))
131
131
  return;
132
132
  if (index !== currentValue) {
133
133
  triggerValueChange(e, index);
@@ -164,33 +164,47 @@ const Tabs = (props) => {
164
164
  }
165
165
  }));
166
166
  }, [scrollViewId, registrationVersion, registeredTabValues.length]);
167
+ const centerActiveTab = (0, import_utils.useEventCallback)(() => __async(void 0, null, function* () {
168
+ if (!currentValue || registeredTabValues.length === 0) {
169
+ return;
170
+ }
171
+ const { scrollView, scrollFields, wrapper, currentTab } = yield (0, import_queryBatch.batchQueryForScroll)({
172
+ scrollViewId,
173
+ wrapperId,
174
+ currentTabValue: currentValue
175
+ });
176
+ if (!scrollView || !scrollFields || !wrapper || !currentTab || currentTab.width === 0) {
177
+ return;
178
+ }
179
+ const tabLeftRelativeToWrapper = currentTab.left - wrapper.left;
180
+ const tabWidth = currentTab.width;
181
+ const containerViewWidth = scrollView.width;
182
+ const currentScrollWidth = scrollFields.scrollWidth || scrollView.width;
183
+ const targetScrollLeft = tabLeftRelativeToWrapper - (containerViewWidth - tabWidth) / 2;
184
+ const maxScrollDistance = currentScrollWidth - containerViewWidth;
185
+ const finalScrollLeft = Math.max(
186
+ 0,
187
+ Math.min(targetScrollLeft, maxScrollDistance)
188
+ );
189
+ setScrollLeft(finalScrollLeft);
190
+ lastScrollLeftRef.current = finalScrollLeft;
191
+ }));
167
192
  import_react.default.useEffect(() => {
168
193
  if (!currentValue || registeredTabValues.length === 0) {
169
194
  return;
170
195
  }
171
- import_taro.default.nextTick(() => __async(void 0, null, function* () {
172
- const { scrollView, scrollFields, wrapper, currentTab } = yield (0, import_queryBatch.batchQueryForScroll)({
173
- scrollViewId,
174
- wrapperId,
175
- currentTabValue: currentValue
176
- });
177
- if (!scrollView || !scrollFields || !wrapper || !currentTab || currentTab.width === 0) {
178
- return;
179
- }
180
- const tabLeftRelativeToWrapper = currentTab.left - wrapper.left;
181
- const tabWidth = currentTab.width;
182
- const containerViewWidth = scrollView.width;
183
- const currentScrollWidth = scrollFields.scrollWidth || scrollView.width;
184
- const targetScrollLeft = tabLeftRelativeToWrapper - (containerViewWidth - tabWidth) / 2;
185
- const maxScrollDistance = currentScrollWidth - containerViewWidth;
186
- const finalScrollLeft = Math.max(
187
- 0,
188
- Math.min(targetScrollLeft, maxScrollDistance)
189
- );
190
- setScrollLeft(finalScrollLeft);
191
- lastScrollLeftRef.current = finalScrollLeft;
192
- }));
193
- }, [currentValue, scrollViewId, wrapperId]);
196
+ import_taro.default.nextTick(() => {
197
+ centerActiveTab();
198
+ });
199
+ }, [currentValue, centerActiveTab]);
200
+ import_react.default.useEffect(() => {
201
+ if (!currentValue || registeredTabValues.length === 0) {
202
+ return;
203
+ }
204
+ import_taro.default.nextTick(() => {
205
+ centerActiveTab();
206
+ });
207
+ }, [registrationVersion, centerActiveTab]);
194
208
  const contextValue = (0, import_react.useMemo)(
195
209
  () => ({
196
210
  value: currentValue,
@@ -214,7 +228,7 @@ const Tabs = (props) => {
214
228
  }
215
229
  };
216
230
  }, []);
217
- return /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_clsx.default)(import_classes.tabsRootClass, className), style }, /* @__PURE__ */ import_react.default.createElement(
231
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_clsx.default)(import_classes.tabsRootClass, className), style, ref }, /* @__PURE__ */ import_react.default.createElement(
218
232
  import_TabMask.default,
219
233
  {
220
234
  position: "left",
@@ -256,6 +270,6 @@ const Tabs = (props) => {
256
270
  }
257
271
  ), /* @__PURE__ */ import_react.default.createElement(import_TabsContext.TabsContextProvider, { value: contextValue }, renderedTabs))
258
272
  ));
259
- };
273
+ });
260
274
  Tabs.displayName = "BuiTabs";
261
275
  var Tabs_default = Tabs;
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { DatePickerProps } from './DatePicker.types';
3
- declare const DatePicker: React.ForwardRefExoticComponent<Omit<DatePickerProps<"div", Omit<import("../Picker").PickerProps<"div", import("..").DrawerProps>, "defaultValue" | "onChange" | "value" | "onClose" | "onConfirm">>, "ref"> & React.RefAttributes<HTMLDivElement>>;
3
+ declare const DatePicker: React.ForwardRefExoticComponent<Omit<DatePickerProps<"div", Omit<import("../Picker").PickerProps<"div", import("..").DrawerProps>, "value" | "defaultValue" | "onChange" | "onClose" | "onConfirm">>, "ref"> & React.RefAttributes<HTMLDivElement>>;
4
4
  export default DatePicker;
@@ -12,5 +12,5 @@ declare const Modal: React.ForwardRefExoticComponent<Omit<ViewProps & {
12
12
  keepMounted?: boolean;
13
13
  } & import("@bifrostui/types").ICommonProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
14
14
  ref?: React.Ref<HTMLDivElement>;
15
- }, "open" | "container" | keyof import("@bifrostui/types").ICommonProps | "disablePortal" | "hideBackdrop" | "BackdropProps" | "onClose" | "disableScrollLock" | "keepMounted">, "ref"> & React.RefAttributes<HTMLDivElement>>;
15
+ }, keyof import("@bifrostui/types").ICommonProps | "container" | "open" | "disablePortal" | "hideBackdrop" | "BackdropProps" | "onClose" | "disableScrollLock" | "keepMounted">, "ref"> & React.RefAttributes<HTMLDivElement>>;
16
16
  export default Modal;
package/es/Tabs/Tab.css CHANGED
@@ -17,7 +17,6 @@
17
17
  .bui-tab-active {
18
18
  color: var(--bui-tab-active-color);
19
19
  font-weight: var(--bui-font-weight-bold);
20
- font-family: var(--bui-tab-active-font-family);
21
20
  }
22
21
  .bui-tab-disabled {
23
22
  opacity: 0.5;
package/es/Tabs/Tabs.css CHANGED
@@ -16,7 +16,6 @@ xhs-page {
16
16
  --bui-tab-height: 100%;
17
17
  --bui-tab-padding: var(--bui-spacing-lg) var(--bui-spacing-lg) 10px;
18
18
  --bui-tab-active-color: var(--bui-color-fg-default);
19
- --bui-tab-active-font-family: var(--bui-font-family-accent, inherit);
20
19
  }
21
20
  .bui-tabs {
22
21
  position: relative;
package/es/Tabs/Tabs.js CHANGED
@@ -1,4 +1,6 @@
1
1
  var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
2
4
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
4
6
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
@@ -14,6 +16,7 @@ var __spreadValues = (a, b) => {
14
16
  }
15
17
  return a;
16
18
  };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
17
20
  var __objRest = (source, exclude) => {
18
21
  var target = {};
19
22
  for (var prop in source)
@@ -117,7 +120,7 @@ const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
117
120
  if (process.env.NODE_ENV !== "production") {
118
121
  console.count("Tabs render......");
119
122
  }
120
- return /* @__PURE__ */ React.createElement("div", __spreadValues({ ref, className: clsx(tabsRootClass, className) }, others), /* @__PURE__ */ React.createElement(TabMask, { tabsContainerRef: tabsRef, position: "left" }), /* @__PURE__ */ React.createElement(TabMask, { tabsContainerRef: tabsRef, position: "right" }), /* @__PURE__ */ React.createElement(
123
+ return /* @__PURE__ */ React.createElement("div", __spreadProps(__spreadValues({ className: clsx(tabsRootClass, className) }, others), { ref }), /* @__PURE__ */ React.createElement(TabMask, { tabsContainerRef: tabsRef, position: "left" }), /* @__PURE__ */ React.createElement(TabMask, { tabsContainerRef: tabsRef, position: "right" }), /* @__PURE__ */ React.createElement(
121
124
  "div",
122
125
  {
123
126
  className: `${tabsRootClass}-tabs`,
package/es/Tabs/index.css CHANGED
@@ -16,7 +16,6 @@ xhs-page {
16
16
  --bui-tab-height: 100%;
17
17
  --bui-tab-padding: var(--bui-spacing-lg) var(--bui-spacing-lg) 10px;
18
18
  --bui-tab-active-color: var(--bui-color-fg-default);
19
- --bui-tab-active-font-family: var(--bui-font-family-accent, inherit);
20
19
  }
21
20
  .bui-tabs {
22
21
  position: relative;
@@ -107,7 +106,6 @@ xhs-page {
107
106
  .bui-tab-active {
108
107
  color: var(--bui-tab-active-color);
109
108
  font-weight: var(--bui-font-weight-bold);
110
- font-family: var(--bui-tab-active-font-family);
111
109
  }
112
110
  .bui-tab-disabled {
113
111
  opacity: 0.5;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import { TabProps } from '../Tab.types';
3
3
  import '../Tab.less';
4
- declare const _default: React.NamedExoticComponent<TabProps<"div", {}>>;
4
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<TabProps<"div", {}>, "ref"> & React.RefAttributes<HTMLDivElement>>>;
5
5
  export default _default;
@@ -1,10 +1,10 @@
1
- import React, { useEffect } from "react";
1
+ import React, { useEffect, useRef } from "react";
2
2
  import clsx from "clsx";
3
- import { useContextSelector } from "@bifrostui/utils";
3
+ import { useContextSelector, useForkRef } from "@bifrostui/utils";
4
4
  import TabsContext from "./TabsContext";
5
5
  import { tabRootClass, tabActiveClass, tabDisabledClass } from "../classes";
6
6
  import "../Tab.css";
7
- const Tab = (props) => {
7
+ const Tab = /* @__PURE__ */ React.forwardRef((props, ref) => {
8
8
  const {
9
9
  className,
10
10
  children,
@@ -13,6 +13,8 @@ const Tab = (props) => {
13
13
  onClick,
14
14
  style
15
15
  } = props;
16
+ const innerRef = useRef(null);
17
+ const handleRef = useForkRef(ref, innerRef);
16
18
  const isActive = useContextSelector(
17
19
  TabsContext,
18
20
  (ctx) => ctx.value === index
@@ -53,6 +55,7 @@ const Tab = (props) => {
53
55
  "div",
54
56
  {
55
57
  id: tabId,
58
+ ref: handleRef,
56
59
  className: rootCls,
57
60
  style,
58
61
  onClick: (e) => {
@@ -64,7 +67,7 @@ const Tab = (props) => {
64
67
  },
65
68
  children
66
69
  );
67
- };
70
+ });
68
71
  Tab.displayName = "BuiTab";
69
72
  var Tab_default = /* @__PURE__ */ React.memo(Tab, (prevProps, nextProps) => {
70
73
  return prevProps.index === nextProps.index && prevProps.disabled === nextProps.disabled && prevProps.className === nextProps.className && prevProps.children === nextProps.children;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import { TabsProps } from '../Tabs.types';
3
3
  import '../Tabs.less';
4
- declare const Tabs: React.FC<TabsProps>;
4
+ declare const Tabs: React.ForwardRefExoticComponent<Omit<TabsProps<"div", {}>, "ref"> & React.RefAttributes<HTMLDivElement>>;
5
5
  export default Tabs;
@@ -37,7 +37,7 @@ import {
37
37
  batchQueryForScroll
38
38
  } from "./utils/queryBatch";
39
39
  import "../Tabs.css";
40
- const Tabs = (props) => {
40
+ const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
41
41
  const {
42
42
  children,
43
43
  className,
@@ -101,8 +101,8 @@ const Tabs = (props) => {
101
101
  });
102
102
  const handleClick = useEventCallback(
103
103
  (e, item) => {
104
- const { index, disabled: isDisabled = false } = item;
105
- if (isDisabled || [void 0, null].includes(index))
104
+ const { index, disabled = false } = item;
105
+ if (disabled || [void 0, null].includes(index))
106
106
  return;
107
107
  if (index !== currentValue) {
108
108
  triggerValueChange(e, index);
@@ -139,33 +139,47 @@ const Tabs = (props) => {
139
139
  }
140
140
  }));
141
141
  }, [scrollViewId, registrationVersion, registeredTabValues.length]);
142
+ const centerActiveTab = useEventCallback(() => __async(void 0, null, function* () {
143
+ if (!currentValue || registeredTabValues.length === 0) {
144
+ return;
145
+ }
146
+ const { scrollView, scrollFields, wrapper, currentTab } = yield batchQueryForScroll({
147
+ scrollViewId,
148
+ wrapperId,
149
+ currentTabValue: currentValue
150
+ });
151
+ if (!scrollView || !scrollFields || !wrapper || !currentTab || currentTab.width === 0) {
152
+ return;
153
+ }
154
+ const tabLeftRelativeToWrapper = currentTab.left - wrapper.left;
155
+ const tabWidth = currentTab.width;
156
+ const containerViewWidth = scrollView.width;
157
+ const currentScrollWidth = scrollFields.scrollWidth || scrollView.width;
158
+ const targetScrollLeft = tabLeftRelativeToWrapper - (containerViewWidth - tabWidth) / 2;
159
+ const maxScrollDistance = currentScrollWidth - containerViewWidth;
160
+ const finalScrollLeft = Math.max(
161
+ 0,
162
+ Math.min(targetScrollLeft, maxScrollDistance)
163
+ );
164
+ setScrollLeft(finalScrollLeft);
165
+ lastScrollLeftRef.current = finalScrollLeft;
166
+ }));
142
167
  React.useEffect(() => {
143
168
  if (!currentValue || registeredTabValues.length === 0) {
144
169
  return;
145
170
  }
146
- Taro.nextTick(() => __async(void 0, null, function* () {
147
- const { scrollView, scrollFields, wrapper, currentTab } = yield batchQueryForScroll({
148
- scrollViewId,
149
- wrapperId,
150
- currentTabValue: currentValue
151
- });
152
- if (!scrollView || !scrollFields || !wrapper || !currentTab || currentTab.width === 0) {
153
- return;
154
- }
155
- const tabLeftRelativeToWrapper = currentTab.left - wrapper.left;
156
- const tabWidth = currentTab.width;
157
- const containerViewWidth = scrollView.width;
158
- const currentScrollWidth = scrollFields.scrollWidth || scrollView.width;
159
- const targetScrollLeft = tabLeftRelativeToWrapper - (containerViewWidth - tabWidth) / 2;
160
- const maxScrollDistance = currentScrollWidth - containerViewWidth;
161
- const finalScrollLeft = Math.max(
162
- 0,
163
- Math.min(targetScrollLeft, maxScrollDistance)
164
- );
165
- setScrollLeft(finalScrollLeft);
166
- lastScrollLeftRef.current = finalScrollLeft;
167
- }));
168
- }, [currentValue, scrollViewId, wrapperId]);
171
+ Taro.nextTick(() => {
172
+ centerActiveTab();
173
+ });
174
+ }, [currentValue, centerActiveTab]);
175
+ React.useEffect(() => {
176
+ if (!currentValue || registeredTabValues.length === 0) {
177
+ return;
178
+ }
179
+ Taro.nextTick(() => {
180
+ centerActiveTab();
181
+ });
182
+ }, [registrationVersion, centerActiveTab]);
169
183
  const contextValue = useMemo(
170
184
  () => ({
171
185
  value: currentValue,
@@ -189,7 +203,7 @@ const Tabs = (props) => {
189
203
  }
190
204
  };
191
205
  }, []);
192
- return /* @__PURE__ */ React.createElement("div", { className: clsx(tabsRootClass, className), style }, /* @__PURE__ */ React.createElement(
206
+ return /* @__PURE__ */ React.createElement("div", { className: clsx(tabsRootClass, className), style, ref }, /* @__PURE__ */ React.createElement(
193
207
  TabMask,
194
208
  {
195
209
  position: "left",
@@ -231,7 +245,7 @@ const Tabs = (props) => {
231
245
  }
232
246
  ), /* @__PURE__ */ React.createElement(TabsContextProvider, { value: contextValue }, renderedTabs))
233
247
  ));
234
- };
248
+ });
235
249
  Tabs.displayName = "BuiTabs";
236
250
  var Tabs_default = Tabs;
237
251
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bifrostui/react",
3
- "version": "2.0.0-alpha.14",
3
+ "version": "2.0.0-alpha.17",
4
4
  "description": "React components for building mobile application",
5
5
  "homepage": "http://bui.taopiaopiao.com",
6
6
  "license": "MIT",
@@ -43,10 +43,10 @@
43
43
  "clsx": "^2.1.1",
44
44
  "dayjs": "^1.11.7",
45
45
  "swiper": "^8.1.5",
46
- "@bifrostui/icons": "2.0.0-alpha.14",
47
- "@bifrostui/types": "2.0.0-alpha.14",
48
- "@bifrostui/styles": "2.0.0-alpha.14",
49
- "@bifrostui/utils": "2.0.0-alpha.14"
46
+ "@bifrostui/styles": "2.0.0-alpha.17",
47
+ "@bifrostui/types": "2.0.0-alpha.17",
48
+ "@bifrostui/icons": "2.0.0-alpha.17",
49
+ "@bifrostui/utils": "2.0.0-alpha.17"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "@tarojs/components": "^3.0.0",