react-native-ui-lib 7.40.1-snapshot.6861 → 7.40.1-snapshot.6867
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
CHANGED
|
@@ -18,6 +18,7 @@ const WheelPickerItem = props => {
|
|
|
18
18
|
fakeLabelProps,
|
|
19
19
|
itemHeight,
|
|
20
20
|
onSelect,
|
|
21
|
+
onPress,
|
|
21
22
|
offset,
|
|
22
23
|
activeColor = Colors.$textPrimary,
|
|
23
24
|
inactiveColor = Colors.$textNeutralHeavy,
|
|
@@ -52,8 +53,12 @@ const WheelPickerItem = props => {
|
|
|
52
53
|
const textStyle = useMemo(() => {
|
|
53
54
|
return [animatedColorStyle, style, fakeLabel ? textWithLabelPaddingStyle : styles.textPadding];
|
|
54
55
|
}, [style, fakeLabel, animatedColorStyle, textWithLabelPaddingStyle]);
|
|
56
|
+
const _onPress = useCallback(() => {
|
|
57
|
+
selectItem();
|
|
58
|
+
onPress?.();
|
|
59
|
+
}, [onPress, selectItem]);
|
|
55
60
|
const _fakeLabelStyle = useMemo(() => StyleSheet.flatten([fakeLabelStyle, styles.hidden]), [fakeLabelStyle]);
|
|
56
|
-
return <AnimatedTouchableOpacity activeOpacity={1} style={containerStyle} key={index} centerV centerH={align ? align === WheelPickerAlign.CENTER : centerH} right={align ? align === WheelPickerAlign.RIGHT : !centerH} left={align === WheelPickerAlign.LEFT} onPress={
|
|
61
|
+
return <AnimatedTouchableOpacity activeOpacity={1} style={containerStyle} key={index} centerV centerH={align ? align === WheelPickerAlign.CENTER : centerH} right={align ? align === WheelPickerAlign.RIGHT : !centerH} left={align === WheelPickerAlign.LEFT} onPress={_onPress}
|
|
57
62
|
// @ts-ignore reanimated2
|
|
58
63
|
index={index} testID={testID} row>
|
|
59
64
|
<AnimatedText text60R testID={`${testID}.text`} numberOfLines={1} style={textStyle} recorderTag={'unmask'}>
|
|
@@ -94,6 +94,9 @@ const PickerItemsList = props => {
|
|
|
94
94
|
</Text> : cancelButtonProps ? <Button key={'cancel-button'} link onPress={onCancel} {...cancelButtonProps} /> : undefined}
|
|
95
95
|
</>;
|
|
96
96
|
};
|
|
97
|
+
const onDonePress = useCallback(() => {
|
|
98
|
+
context.onPress(wheelPickerValue);
|
|
99
|
+
}, [context.onPress, wheelPickerValue]);
|
|
97
100
|
const renderPickerHeader = () => {
|
|
98
101
|
const {
|
|
99
102
|
cancelButtonProps,
|
|
@@ -114,7 +117,7 @@ const PickerItemsList = props => {
|
|
|
114
117
|
return <View row spread padding-page style={containerStyle}>
|
|
115
118
|
{(cancelButtonProps || cancelLabel) && renderCancel()}
|
|
116
119
|
<Text style={titleStyle}>{title}</Text>
|
|
117
|
-
<Text text70 $textPrimary accessibilityRole={'button'} onPress={
|
|
120
|
+
<Text text70 $textPrimary accessibilityElementsHidden={useWheelPicker} importantForAccessibility={useWheelPicker ? 'no' : 'yes'} accessibilityRole={'button'} onPress={onDonePress}>
|
|
118
121
|
{doneLabel ?? 'Select'}
|
|
119
122
|
</Text>
|
|
120
123
|
</View>;
|
|
@@ -117,6 +117,12 @@ const Picker = React.forwardRef((props, ref) => {
|
|
|
117
117
|
mode,
|
|
118
118
|
items
|
|
119
119
|
});
|
|
120
|
+
const accessibleFilteredItems = useMemo(() => {
|
|
121
|
+
return filteredItems.map(item => ({
|
|
122
|
+
...item,
|
|
123
|
+
onPress: useWheelPicker && Constants.accessibility.isScreenReaderEnabled ? () => onDoneSelecting(item.value) : undefined
|
|
124
|
+
}));
|
|
125
|
+
}, [useWheelPicker, filteredItems, onDoneSelecting]);
|
|
120
126
|
const {
|
|
121
127
|
label,
|
|
122
128
|
accessibilityInfo
|
|
@@ -205,14 +211,14 @@ const Picker = React.forwardRef((props, ref) => {
|
|
|
205
211
|
};
|
|
206
212
|
const expandableModalContent = useMemo(() => {
|
|
207
213
|
const useItems = useWheelPicker || propItems;
|
|
208
|
-
return <PickerItemsList testID={`${testID}.modal`} useWheelPicker={useWheelPicker} mode={mode} useDialog={useDialog} items={useItems ?
|
|
214
|
+
return <PickerItemsList testID={`${testID}.modal`} useWheelPicker={useWheelPicker} mode={mode} useDialog={useDialog} items={useItems ? accessibleFilteredItems : undefined} topBarProps={{
|
|
209
215
|
...topBarProps,
|
|
210
216
|
onCancel: cancelSelect,
|
|
211
217
|
onDone: mode === PickerModes.MULTI ? () => onDoneSelecting(multiDraftValue) : undefined
|
|
212
218
|
}} showSearch={showSearch} searchStyle={searchStyle} searchPlaceholder={searchPlaceholder} onSearchChange={_onSearchChange} renderCustomSearch={renderCustomSearch} renderHeader={renderHeader} listProps={listProps} useSafeArea={useSafeArea} showLoader={showLoader} customLoaderElement={customLoaderElement} renderCustomTopElement={renderCustomTopElement} selectionStatus={selectionStatus}>
|
|
213
|
-
{
|
|
219
|
+
{accessibleFilteredItems}
|
|
214
220
|
</PickerItemsList>;
|
|
215
|
-
}, [testID, mode, useDialog, selectedItemPosition, topBarProps, cancelSelect, onDoneSelecting, multiDraftValue, showSearch, searchStyle, searchPlaceholder, _onSearchChange, renderCustomSearch, renderHeader, listProps,
|
|
221
|
+
}, [testID, mode, useDialog, selectedItemPosition, topBarProps, cancelSelect, onDoneSelecting, multiDraftValue, showSearch, searchStyle, searchPlaceholder, _onSearchChange, renderCustomSearch, renderHeader, listProps, accessibleFilteredItems, useSafeArea, useWheelPicker, items, showLoader]);
|
|
216
222
|
return <PickerContext.Provider value={contextValue}>
|
|
217
223
|
{<ExpandableOverlay ref={pickerExpandable} useDialog={useDialog || useWheelPicker} dialogProps={DEFAULT_DIALOG_PROPS} migrateDialog expandableContent={expandableModalContent} renderCustomOverlay={renderOverlay ? _renderOverlay : undefined} onPress={onPress} testID={testID} {...customPickerProps} disabled={themeProps.editable === false}>
|
|
218
224
|
{renderTextField()}
|