react-native-ui-lib 7.37.2-snapshot.6187 → 7.37.2-snapshot.6208
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/avatar/index.js +2 -1
- package/src/components/picker/helpers/usePickerMigrationWarnings.d.ts +1 -3
- package/src/components/picker/helpers/usePickerSelection.d.ts +1 -2
- package/src/components/picker/index.d.ts +2 -6
- package/src/components/picker/types.d.ts +6 -2
- package/src/components/switch/index.js +15 -1
package/package.json
CHANGED
|
@@ -58,6 +58,7 @@ const Avatar = forwardRef((props, ref) => {
|
|
|
58
58
|
onPress,
|
|
59
59
|
children
|
|
60
60
|
} = themeProps;
|
|
61
|
+
const hitTargetPadding = Math.max(0, (48 - size) / 2);
|
|
61
62
|
const {
|
|
62
63
|
size: _badgeSize,
|
|
63
64
|
borderWidth: badgeBorderWidth = 0
|
|
@@ -174,7 +175,7 @@ const Avatar = forwardRef((props, ref) => {
|
|
|
174
175
|
}
|
|
175
176
|
};
|
|
176
177
|
const Container = onPress ? TouchableOpacity : View;
|
|
177
|
-
return <Container style={_containerStyle} ref={ref} testID={testID} onPress={onPress} accessible={!_isUndefined(onPress)} accessibilityLabel={'Avatar'} accessibilityRole={onPress ? 'button' : 'image'} {...accessibilityProps}>
|
|
178
|
+
return <Container style={_containerStyle} ref={ref} testID={testID} onPress={onPress} accessible={!_isUndefined(onPress)} accessibilityLabel={'Avatar'} accessibilityRole={onPress ? 'button' : 'image'} hitSlop={onPress ? hitTargetPadding : undefined} {...accessibilityProps}>
|
|
178
179
|
<View testID={`${testID}.container`} style={textContainerStyle}>
|
|
179
180
|
{!_isUndefined(text) && <Text numberOfLines={1} style={textStyle} testID={`${testID}.label`}>
|
|
180
181
|
{text}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { PickerProps } from '../types';
|
|
2
|
-
type UsePickerMigrationWarnings = Pick<PickerProps, 'children' | 'getItemLabel' | 'getItemValue' | 'onShow'
|
|
3
|
-
migrate?: boolean;
|
|
4
|
-
};
|
|
2
|
+
type UsePickerMigrationWarnings = Pick<PickerProps, 'children' | 'migrate' | 'getItemLabel' | 'getItemValue' | 'onShow'>;
|
|
5
3
|
declare const usePickerMigrationWarnings: (props: UsePickerMigrationWarnings) => void;
|
|
6
4
|
export default usePickerMigrationWarnings;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
2
|
import { PickerProps, PickerValue, PickerSingleValue, PickerMultiValue } from '../types';
|
|
3
|
-
interface UsePickerSelectionProps extends Pick<PickerProps, 'value' | 'onChange' | 'getItemValue' | 'topBarProps' | 'mode'> {
|
|
3
|
+
interface UsePickerSelectionProps extends Pick<PickerProps, 'migrate' | 'value' | 'onChange' | 'getItemValue' | 'topBarProps' | 'mode'> {
|
|
4
4
|
pickerExpandableRef: RefObject<any>;
|
|
5
5
|
setSearchValue: (searchValue: string) => void;
|
|
6
|
-
migrate?: boolean;
|
|
7
6
|
}
|
|
8
7
|
declare const usePickerSelection: (props: UsePickerSelectionProps) => {
|
|
9
8
|
multiDraftValue: PickerMultiValue;
|
|
@@ -8,12 +8,8 @@ type PickerStatics = {
|
|
|
8
8
|
fieldTypes: typeof PickerFieldTypes;
|
|
9
9
|
extractPickerItems: typeof extractPickerItems;
|
|
10
10
|
};
|
|
11
|
-
declare const Picker: React.ForwardRefExoticComponent<
|
|
12
|
-
migrate?: boolean | undefined;
|
|
13
|
-
}) & React.RefAttributes<unknown>>;
|
|
11
|
+
declare const Picker: React.ForwardRefExoticComponent<PickerProps & React.RefAttributes<unknown>>;
|
|
14
12
|
export { PickerProps, PickerItemProps, PickerValue, PickerModes, PickerFieldTypes, PickerSearchStyle, RenderCustomModalProps, PickerItemsListProps, PickerMethods };
|
|
15
13
|
export { Picker };
|
|
16
|
-
declare const _default: React.ForwardRefExoticComponent<
|
|
17
|
-
migrate?: boolean | undefined;
|
|
18
|
-
}) & React.RefAttributes<unknown>> & PickerStatics;
|
|
14
|
+
declare const _default: React.ForwardRefExoticComponent<PickerProps & React.RefAttributes<unknown>> & PickerStatics;
|
|
19
15
|
export default _default;
|
|
@@ -34,6 +34,11 @@ export interface PickerSearchStyle {
|
|
|
34
34
|
selectionColor?: string;
|
|
35
35
|
}
|
|
36
36
|
type PickerPropsDeprecation = {
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated
|
|
39
|
+
* Temporary prop required for migration to Picker's new API
|
|
40
|
+
*/
|
|
41
|
+
migrate?: boolean;
|
|
37
42
|
/**
|
|
38
43
|
* @deprecated
|
|
39
44
|
* A function that extract the unique value out of the value prop in case value has a custom structure (e.g. {myValue, myLabel})
|
|
@@ -276,12 +281,11 @@ export interface PickerItemProps extends Pick<TouchableOpacityProps, 'customValu
|
|
|
276
281
|
*/
|
|
277
282
|
testID?: string;
|
|
278
283
|
}
|
|
279
|
-
export interface PickerContextProps extends Pick<PickerProps, 'value' | 'getItemValue' | 'getItemLabel' | 'renderItem' | 'selectionLimit'> {
|
|
284
|
+
export interface PickerContextProps extends Pick<PickerProps, 'migrate' | 'value' | 'getItemValue' | 'getItemLabel' | 'renderItem' | 'selectionLimit'> {
|
|
280
285
|
onPress: (value: PickerSingleValue) => void;
|
|
281
286
|
isMultiMode: boolean;
|
|
282
287
|
onSelectedLayout: (event: any) => any;
|
|
283
288
|
selectionLimit: PickerProps['selectionLimit'];
|
|
284
|
-
migrate?: boolean;
|
|
285
289
|
}
|
|
286
290
|
export type PickerItemsListProps = Pick<PropsWithChildren<PickerProps>, 'topBarProps' | 'listProps' | 'renderHeader' | 'useSafeArea' | 'showLoader' | 'customLoaderElement' | 'renderCustomTopElement' | 'showSearch' | 'searchStyle' | 'searchPlaceholder' | 'onSearchChange' | 'renderCustomSearch' | 'children' | 'useWheelPicker' | 'useDialog' | 'mode' | 'testID'> & {
|
|
287
291
|
items?: {
|
|
@@ -111,13 +111,27 @@ class Switch extends Component {
|
|
|
111
111
|
};
|
|
112
112
|
return <Animated.View style={[this.styles.thumb, thumbPositionStyle, thumbStyle]} />;
|
|
113
113
|
}
|
|
114
|
+
getAccessibleHitSlop() {
|
|
115
|
+
const {
|
|
116
|
+
width = DEFAULT_WIDTH,
|
|
117
|
+
height = DEFAULT_HEIGHT
|
|
118
|
+
} = this.props;
|
|
119
|
+
const verticalPadding = Math.max(0, (48 - height) / 2);
|
|
120
|
+
const horizontalPadding = Math.max(0, (48 - width) / 2);
|
|
121
|
+
return {
|
|
122
|
+
top: verticalPadding,
|
|
123
|
+
bottom: verticalPadding,
|
|
124
|
+
left: horizontalPadding,
|
|
125
|
+
right: horizontalPadding
|
|
126
|
+
};
|
|
127
|
+
}
|
|
114
128
|
render() {
|
|
115
129
|
const {
|
|
116
130
|
...others
|
|
117
131
|
} = this.props;
|
|
118
132
|
return (
|
|
119
133
|
// @ts-ignore
|
|
120
|
-
<TouchableOpacity {...this.getAccessibilityProps()} activeOpacity={1} {...others} style={this.getSwitchStyle()} onPress={this.onPress}>
|
|
134
|
+
<TouchableOpacity {...this.getAccessibilityProps()} activeOpacity={1} hitSlop={this.getAccessibleHitSlop()} {...others} style={this.getSwitchStyle()} onPress={this.onPress}>
|
|
121
135
|
{this.renderThumb()}
|
|
122
136
|
</TouchableOpacity>
|
|
123
137
|
);
|