@hi-ui/tabs 4.0.0-beta.11 → 4.0.0-beta.12

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.
@@ -100,11 +100,12 @@ var TabList = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
100
100
  setTranslateY = _useState4[1];
101
101
 
102
102
  var itemsRef = React.useRef({});
103
- var showScrollBtn = React.useMemo(function () {
104
- if (scrollRef && innerRef) {
105
- return direction === 'horizontal' ? (scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.clientWidth) > (innerRef === null || innerRef === void 0 ? void 0 : innerRef.clientWidth) : (scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.clientHeight) > (innerRef === null || innerRef === void 0 ? void 0 : innerRef.clientHeight);
106
- }
107
- }, [scrollRef, innerRef, direction]);
103
+ var showScrollBtn = false;
104
+
105
+ if (scrollRef && innerRef) {
106
+ showScrollBtn = direction === 'horizontal' ? scrollRef.clientWidth > innerRef.clientWidth : scrollRef.clientHeight > innerRef.clientHeight;
107
+ }
108
+
108
109
  var onClickTab = React.useCallback(function (key, event) {
109
110
  if (onTabClick) {
110
111
  onTabClick(key, event);
@@ -7,7 +7,7 @@
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
9
  */
10
- import React, { forwardRef, useState, useRef, useMemo, useCallback } from 'react';
10
+ import React, { forwardRef, useState, useRef, useCallback } from 'react';
11
11
  import { __DEV__ } from '@hi-ui/env';
12
12
  import { TabItem } from './TabItem.js';
13
13
  import { useUncontrolledState } from '@hi-ui/use-uncontrolled-state';
@@ -75,11 +75,12 @@ var TabList = /*#__PURE__*/forwardRef(function (_ref, ref) {
75
75
  setTranslateY = _useState4[1];
76
76
 
77
77
  var itemsRef = useRef({});
78
- var showScrollBtn = useMemo(function () {
79
- if (scrollRef && innerRef) {
80
- return direction === 'horizontal' ? (scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.clientWidth) > (innerRef === null || innerRef === void 0 ? void 0 : innerRef.clientWidth) : (scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.clientHeight) > (innerRef === null || innerRef === void 0 ? void 0 : innerRef.clientHeight);
81
- }
82
- }, [scrollRef, innerRef, direction]);
78
+ var showScrollBtn = false;
79
+
80
+ if (scrollRef && innerRef) {
81
+ showScrollBtn = direction === 'horizontal' ? scrollRef.clientWidth > innerRef.clientWidth : scrollRef.clientHeight > innerRef.clientHeight;
82
+ }
83
+
83
84
  var onClickTab = useCallback(function (key, event) {
84
85
  if (onTabClick) {
85
86
  onTabClick(key, event);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hi-ui/tabs",
3
- "version": "4.0.0-beta.11",
3
+ "version": "4.0.0-beta.12",
4
4
  "description": "A sub-package for @hi-ui/hiui.",
5
5
  "keywords": [],
6
6
  "author": "HIUI <mi-hiui@xiaomi.com>",
@@ -60,5 +60,5 @@
60
60
  "react": "^17.0.1",
61
61
  "react-dom": "^17.0.1"
62
62
  },
63
- "gitHead": "f77bb788e7a7f78f93a5d011bca9d2ad90819fa3"
63
+ "gitHead": "3a156d7336309ae1b4fb73588735727de583e161"
64
64
  }