@widergy/mobile-ui 2.4.0 → 2.5.1
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/CHANGELOG.md +14 -0
- package/lib/components/UTTabs/index.js +12 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [2.5.1](https://github.com/widergy/mobile-ui/compare/v2.5.0...v2.5.1) (2026-01-27)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* change selected index ([#474](https://github.com/widergy/mobile-ui/issues/474)) ([351d864](https://github.com/widergy/mobile-ui/commit/351d864768a2adac1616a5ed826fdf98d6f83fe7))
|
|
7
|
+
|
|
8
|
+
# [2.5.0](https://github.com/widergy/mobile-ui/compare/v2.4.0...v2.5.0) (2026-01-22)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* index prop ([#473](https://github.com/widergy/mobile-ui/issues/473)) ([f229d77](https://github.com/widergy/mobile-ui/commit/f229d771a38e9b9cb9573bc27d7d78e7e257e7d1))
|
|
14
|
+
|
|
1
15
|
# [2.4.0](https://github.com/widergy/mobile-ui/compare/v2.3.5...v2.4.0) (2026-01-19)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable react-hooks/exhaustive-deps */
|
|
2
2
|
import { Animated, View, Pressable, PanResponder, ScrollView } from 'react-native';
|
|
3
|
-
import { array, bool, func, object, string } from 'prop-types';
|
|
3
|
+
import { array, bool, func, object, string, number } from 'prop-types';
|
|
4
4
|
import React, { useEffect, useRef, useState } from 'react';
|
|
5
5
|
|
|
6
6
|
import { withTheme } from '../../theming';
|
|
@@ -20,10 +20,11 @@ const UTTabs = ({
|
|
|
20
20
|
tabs,
|
|
21
21
|
theme,
|
|
22
22
|
withTabSliding = true,
|
|
23
|
-
scrollableTabs = false
|
|
23
|
+
scrollableTabs = false,
|
|
24
|
+
selectedIndex = 0
|
|
24
25
|
}) => {
|
|
25
26
|
const styles = styleSheet(theme);
|
|
26
|
-
const [selectedTab, setSelectedTab] = useState(
|
|
27
|
+
const [selectedTab, setSelectedTab] = useState(selectedIndex);
|
|
27
28
|
const [scrollOffset, setScrollOffset] = useState(0);
|
|
28
29
|
const position = useRef(new Animated.Value(0)).current;
|
|
29
30
|
const indicatorPos = useRef(new Animated.Value(0)).current;
|
|
@@ -43,6 +44,12 @@ const UTTabs = ({
|
|
|
43
44
|
}
|
|
44
45
|
}, [tabs, scrollableTabs]);
|
|
45
46
|
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
if (selectedIndex !== selectedTab) {
|
|
49
|
+
setSelectedTab(selectedIndex);
|
|
50
|
+
}
|
|
51
|
+
}, [selectedIndex]);
|
|
52
|
+
|
|
46
53
|
useEffect(() => {
|
|
47
54
|
Animated.timing(position, {
|
|
48
55
|
toValue: selectedTab,
|
|
@@ -207,7 +214,8 @@ UTTabs.propTypes = {
|
|
|
207
214
|
tabs: array,
|
|
208
215
|
theme: object,
|
|
209
216
|
withTabSliding: bool,
|
|
210
|
-
scrollableTabs: bool
|
|
217
|
+
scrollableTabs: bool,
|
|
218
|
+
selectedIndex: number
|
|
211
219
|
};
|
|
212
220
|
|
|
213
221
|
export default withTheme(UTTabs);
|
package/package.json
CHANGED