react-native-ui-lib 7.37.2-snapshot.6132 → 7.37.2-snapshot.6134
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/package.json +1 -1
- package/src/components/tabController/TabBar.js +1 -1
- package/src/components/tabController/TabBarContext.d.ts +0 -1
- package/src/components/tabController/TabBarItem.js +2 -5
- package/src/components/tabController/index.js +1 -4
- package/src/incubator/expandableOverlay/index.js +12 -3
- package/src/incubator/toast/index.js +1 -3
package/package.json
CHANGED
|
@@ -149,7 +149,7 @@ const TabBar = props => {
|
|
|
149
149
|
}, [labelColor, selectedLabelColor]);
|
|
150
150
|
return <View style={_containerStyle} key={key} bg-$backgroundElevated>
|
|
151
151
|
<FadedScrollView ref={tabBar} horizontal showsHorizontalScrollIndicator={false} showStartFader startFaderProps={faderProps} showEndFader endFaderProps={faderProps} contentContainerStyle={scrollViewContainerStyle} testID={testID} onContentSizeChange={onContentSizeChange} onLayout={onLayout}>
|
|
152
|
-
<View style={tabBarContainerStyle}
|
|
152
|
+
<View style={tabBarContainerStyle}>{tabBarItems}</View>
|
|
153
153
|
{itemsCount > 1 && <Reanimated.View style={[styles.selectedIndicator, indicatorStyle, _indicatorTransitionStyle]} />}
|
|
154
154
|
</FadedScrollView>
|
|
155
155
|
</View>;
|
|
@@ -13,7 +13,6 @@ interface TabControllerContext {
|
|
|
13
13
|
/** transition page index (can be a fraction when transitioning between pages) */
|
|
14
14
|
targetPage: Reanimated.SharedValue<number>;
|
|
15
15
|
setCurrentIndex: (index: number) => void;
|
|
16
|
-
selectedIndex: number;
|
|
17
16
|
}
|
|
18
17
|
declare const TabBarContext: React.Context<TabControllerContext>;
|
|
19
18
|
export default TabBarContext;
|
|
@@ -44,8 +44,7 @@ export default function TabBarItem({
|
|
|
44
44
|
}) {
|
|
45
45
|
const {
|
|
46
46
|
currentPage,
|
|
47
|
-
setCurrentIndex
|
|
48
|
-
selectedIndex
|
|
47
|
+
setCurrentIndex
|
|
49
48
|
} = useContext(TabBarContext);
|
|
50
49
|
const itemRef = useRef();
|
|
51
50
|
const itemWidth = useRef(props.width);
|
|
@@ -134,9 +133,7 @@ export default function TabBarItem({
|
|
|
134
133
|
return <GestureDetector gesture={gesture}>
|
|
135
134
|
<View reanimated
|
|
136
135
|
// @ts-expect-error
|
|
137
|
-
ref={itemRef} style={_style} onLayout={onLayout} testID={testID}
|
|
138
|
-
selected: selectedIndex === index
|
|
139
|
-
}}>
|
|
136
|
+
ref={itemRef} style={_style} onLayout={onLayout} testID={testID}>
|
|
140
137
|
{leadingAccessory}
|
|
141
138
|
{icon && <Reanimated.Image source={icon} style={[!_isUndefined(label) && styles.tabItemIconWithLabel, animatedIconStyle]} />}
|
|
142
139
|
{!_isEmpty(label) && <Reanimated.Text {...labelProps} fsTagName={'unmask'} style={[styles.tabItemLabel, labelStyle, animatedLabelStyle, animatedLabelColorStyle]}>
|
|
@@ -38,7 +38,6 @@ const TabController = React.forwardRef((props, ref) => {
|
|
|
38
38
|
children
|
|
39
39
|
} = themeProps;
|
|
40
40
|
const [screenWidth, setScreenWidth] = useState(getScreenWidth(useSafeArea));
|
|
41
|
-
const [selectedIndex, setSelectedIndex] = useState(initialIndex);
|
|
42
41
|
if (items?.length < 2) {
|
|
43
42
|
console.warn('TabController component expect a minimum of 2 items');
|
|
44
43
|
}
|
|
@@ -62,7 +61,6 @@ const TabController = React.forwardRef((props, ref) => {
|
|
|
62
61
|
'worklet';
|
|
63
62
|
|
|
64
63
|
currentPage.value = index;
|
|
65
|
-
runOnJS(setSelectedIndex)(index);
|
|
66
64
|
}, []);
|
|
67
65
|
useEffect(() => {
|
|
68
66
|
setCurrentIndex(initialIndex);
|
|
@@ -90,13 +88,12 @@ const TabController = React.forwardRef((props, ref) => {
|
|
|
90
88
|
/* Animated Values */
|
|
91
89
|
targetPage,
|
|
92
90
|
currentPage,
|
|
93
|
-
selectedIndex,
|
|
94
91
|
containerWidth: screenWidth,
|
|
95
92
|
/* Callbacks */
|
|
96
93
|
onChangeIndex,
|
|
97
94
|
setCurrentIndex
|
|
98
95
|
};
|
|
99
|
-
}, [initialIndex, asCarousel, items, onChangeIndex, screenWidth, nestedInScrollView
|
|
96
|
+
}, [initialIndex, asCarousel, items, onChangeIndex, screenWidth, nestedInScrollView]);
|
|
100
97
|
return <TabBarContext.Provider value={context}>{children}</TabBarContext.Provider>;
|
|
101
98
|
});
|
|
102
99
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import React, { useCallback, useState, forwardRef, useImperativeHandle } from 'react';
|
|
1
|
+
import React, { useCallback, useState, forwardRef, useImperativeHandle, useRef } from 'react';
|
|
2
|
+
import { AccessibilityInfo, findNodeHandle } from 'react-native';
|
|
2
3
|
import TouchableOpacity from "../../components/touchableOpacity";
|
|
3
4
|
import View from "../../components/view";
|
|
4
5
|
import Modal from "../../components/modal";
|
|
@@ -23,14 +24,22 @@ const ExpandableOverlay = (props, ref) => {
|
|
|
23
24
|
...others
|
|
24
25
|
} = props;
|
|
25
26
|
const [visible, setExpandableVisible] = useState(false);
|
|
27
|
+
const containerRef = useRef(null);
|
|
28
|
+
const focusAccessibility = useCallback(() => {
|
|
29
|
+
const reactTag = findNodeHandle(containerRef.current);
|
|
30
|
+
if (reactTag) {
|
|
31
|
+
AccessibilityInfo.setAccessibilityFocus(reactTag);
|
|
32
|
+
}
|
|
33
|
+
}, []);
|
|
26
34
|
const openExpandable = useCallback(() => {
|
|
27
35
|
setExpandableVisible(true);
|
|
28
36
|
onPress?.(props);
|
|
29
37
|
}, [onPress, customValue]);
|
|
30
38
|
const closeExpandable = useCallback(() => {
|
|
31
39
|
setExpandableVisible(false);
|
|
40
|
+
focusAccessibility();
|
|
32
41
|
useDialog ? dialogProps?.onDismiss?.() : modalProps?.onDismiss?.();
|
|
33
|
-
}, [useDialog, dialogProps?.onDismiss, modalProps?.onDismiss]);
|
|
42
|
+
}, [useDialog, dialogProps?.onDismiss, modalProps?.onDismiss, focusAccessibility]);
|
|
34
43
|
const toggleExpandable = useCallback(() => visible ? closeExpandable() : openExpandable(), [visible, openExpandable, closeExpandable]);
|
|
35
44
|
useImperativeHandle(ref, () => ({
|
|
36
45
|
openExpandable,
|
|
@@ -61,7 +70,7 @@ const ExpandableOverlay = (props, ref) => {
|
|
|
61
70
|
return useDialog ? renderDialog() : renderModal();
|
|
62
71
|
}
|
|
63
72
|
};
|
|
64
|
-
return <TouchableOpacity {...others} onPress={openExpandable} disabled={disabled} testID={testID}>
|
|
73
|
+
return <TouchableOpacity ref={containerRef} {...others} onPress={openExpandable} disabled={disabled} testID={testID}>
|
|
65
74
|
<View pointerEvents="none">{children}</View>
|
|
66
75
|
{renderOverlay()}
|
|
67
76
|
</TouchableOpacity>;
|
|
@@ -57,11 +57,9 @@ const Toast = props => {
|
|
|
57
57
|
});
|
|
58
58
|
const playAccessibilityFeatures = () => {
|
|
59
59
|
if (visible) {
|
|
60
|
-
if (viewRef.current && action) {
|
|
60
|
+
if (viewRef.current && (action || message)) {
|
|
61
61
|
const reactTag = findNodeHandle(viewRef.current);
|
|
62
62
|
AccessibilityInfo.setAccessibilityFocus(reactTag);
|
|
63
|
-
} else if (message) {
|
|
64
|
-
AccessibilityInfo.announceForAccessibility?.(toastPreset.accessibilityMessage);
|
|
65
63
|
}
|
|
66
64
|
}
|
|
67
65
|
};
|