Skip to content

Commit d01a899

Browse files
committed
Merge branch 'master' into release
2 parents df400bc + f1e5557 commit d01a899

File tree

11 files changed

+207
-190
lines changed

11 files changed

+207
-190
lines changed

src/commons/asBaseComponent.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import * as Modifiers from './modifiers';
44
import {Scheme, SchemeChangeListener, ThemeManager} from '../style';
55
import forwardRef from './forwardRef';
66
import UIComponent from './UIComponent';
7-
import type {ThemeComponent} from '../typings/common';
87

98
export interface BaseComponentInjectedProps {
109
/**
@@ -23,7 +22,7 @@ const EMPTY_MODIFIERS = {};
2322
const colorScheme = Scheme.getSchemeType();
2423

2524
function asBaseComponent<PROPS, STATICS = {}>(WrappedComponent: React.ComponentType<any>,
26-
options: AsBaseComponentOptions = {}): React.ComponentClass<PROPS & ThemeComponent> & STATICS {
25+
options: AsBaseComponentOptions = {}): React.ComponentClass<PROPS> & STATICS {
2726
class BaseComponent extends UIComponent {
2827
static displayName: string | undefined;
2928
static propTypes: any;

src/components/picker/PickerItemsList.tsx

+10-1
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,23 @@ const PickerItemsList = (props: PickerItemsListProps) => {
7373

7474
const renderList = () => {
7575
if (items) {
76-
return <FlatList data={items} renderItem={renderPropItems} keyExtractor={keyExtractor} {...listProps}/>;
76+
return (
77+
<FlatList
78+
testID={`${testID}.list`}
79+
data={items}
80+
renderItem={renderPropItems}
81+
keyExtractor={keyExtractor}
82+
{...listProps}
83+
/>
84+
);
7785
}
7886
return (
7987
<FlatList
8088
data={_.times(React.Children.count(children))}
8189
// @ts-expect-error
8290
renderItem={renderItem}
8391
keyExtractor={keyExtractor}
92+
testID={`${testID}.list`}
8493
{...listProps}
8594
/>
8695
);

src/components/picker/types.tsx

+137-139
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {ModalTopBarProps} from '../modal/TopBar';
55
// TODO: Replace with new TextField Props after migration to new TextField has completed
66
// import {TextFieldProps} from '../../../typings/components/Inputs';
77
import {TextFieldMethods, TextFieldProps as NewTextFieldProps} from '../../incubator/TextField';
8-
import type {ThemeComponent} from '../../typings/common';
98

109
// Note: enum values are uppercase due to legacy
1110
export enum PickerModes {
@@ -48,144 +47,143 @@ export interface PickerSearchStyle {
4847
selectionColor?: string;
4948
}
5049

51-
export type PickerBaseProps = Omit<NewTextFieldProps, 'value' | 'onChange'> &
52-
ThemeComponent & {
53-
/* ...TextField.propTypes, */
54-
/**
55-
* Temporary prop required for migration to Picker's new API
56-
*/
57-
migrate?: boolean;
58-
/**
59-
* Temporary prop required for inner text field migration
60-
*/
61-
migrateTextField?: boolean;
62-
/**
63-
* Pass for different field type UI (form, filter or settings)
64-
*/
65-
fieldType?: PickerFieldTypes;
66-
/**
67-
* Picker current value in the shape of {value: ..., label: ...}, for custom shape use 'getItemValue' prop
68-
*/
69-
value?: PickerValue;
70-
/**
71-
* Callback for when picker value change
72-
*/
73-
onChange?: (value: PickerValue) => void;
74-
/**
75-
* SINGLE mode or MULTI mode
76-
*/
77-
mode?: PickerModes;
78-
/**
79-
* Limit the number of selected items
80-
*/
81-
selectionLimit?: number;
82-
/**
83-
* Adds blur effect to picker modal (iOS only)
84-
*/
85-
enableModalBlur?: boolean;
86-
/**
87-
* Render custom picker - input will be value (see above)
88-
* Example:
89-
* renderPicker = (selectedItem) => {...}
90-
*/
91-
renderPicker?: RenderPicker;
92-
/**
93-
* Render custom picker item
94-
*/
95-
renderItem?: (
96-
value: PickerValue,
97-
itemProps: PickerItemProps & {isSelected: boolean; isItemDisabled: boolean},
98-
label?: string
99-
) => React.ReactElement;
100-
/**
101-
* Render custom picker modal (e.g ({visible, children, toggleModal}) => {...})
102-
*/
103-
renderCustomModal?: (modalProps: RenderCustomModalProps) => React.ReactElement;
104-
/**
105-
* Custom picker props (when using renderPicker, will apply on the button wrapper)
106-
*/
107-
customPickerProps?: ExpandableOverlayProps;
108-
/**
109-
* Add onPress callback for when pressing the picker
110-
*/
111-
onPress?: () => void;
112-
/**
113-
* @deprecated
114-
* A function that extract the unique value out of the value prop in case value has a custom structure (e.g. {myValue, myLabel})
115-
*/
116-
getItemValue?: (value: PickerValue) => any;
117-
/**
118-
* @deprecated
119-
* A function that extract the label out of the value prop in case value has a custom structure (e.g. {myValue, myLabel})
120-
*/
121-
getItemLabel?: (value: PickerValue) => string;
122-
/**
123-
* A function that returns the label to show for the selected Picker value
124-
*/
125-
getLabel?: (value: PickerValue) => string;
126-
/**
127-
* The picker modal top bar props
128-
*/
129-
topBarProps?: ModalTopBarProps;
130-
/**
131-
* Show search input to filter picker items by label
132-
*/
133-
showSearch?: boolean;
134-
/**
135-
* Style object for the search input (only when passing showSearch)
136-
*/
137-
searchStyle?: PickerSearchStyle;
138-
/**
139-
* Placeholder text for the search input (only when passing showSearch)
140-
*/
141-
searchPlaceholder?: string;
142-
/**
143-
* callback for picker modal search input text change (only when passing showSearch)
144-
*/
145-
onSearchChange?: (searchValue: string) => void;
146-
/**
147-
* Render custom search input (only when passing showSearch)
148-
*/
149-
renderCustomSearch?: (props: PickerItemsListProps) => React.ReactElement;
150-
// /**
151-
// * @deprecated pass useWheelPicker prop instead
152-
// * Allow to use the native picker solution (different style for iOS and Android)
153-
// */
154-
// useNativePicker?: boolean;
155-
/**
156-
* Use wheel picker instead of a list picker
157-
*/
158-
useWheelPicker?: boolean;
159-
/**
160-
* Pass props to the list component that wraps the picker options (allows to control FlatList behavior)
161-
*/
162-
listProps?: Partial<FlatListProps<any>>;
163-
/**
164-
* Pass props to the picker modal
165-
*/
166-
pickerModalProps?: object;
167-
/**
168-
* Custom container style
169-
*/
170-
containerStyle?: StyleProp<ViewStyle>;
171-
/**
172-
* Callback for modal onShow event
173-
*/
174-
onShow?: () => void;
175-
/**
176-
* Add safe area in the Picker modal view
177-
*/
178-
useSafeArea?: boolean;
179-
/**
180-
* Data source for Picker
181-
*/
182-
items?: Pick<PickerItemProps, 'label' | 'value' | 'disabled'>[];
183-
/**
184-
* Component test id
185-
*/
186-
testID?: string;
187-
children?: ReactNode | undefined;
188-
};
50+
export type PickerBaseProps = Omit<NewTextFieldProps, 'value' | 'onChange'> & {
51+
/* ...TextField.propTypes, */
52+
/**
53+
* Temporary prop required for migration to Picker's new API
54+
*/
55+
migrate?: boolean;
56+
/**
57+
* Temporary prop required for inner text field migration
58+
*/
59+
migrateTextField?: boolean;
60+
/**
61+
* Pass for different field type UI (form, filter or settings)
62+
*/
63+
fieldType?: PickerFieldTypes;
64+
/**
65+
* Picker current value in the shape of {value: ..., label: ...}, for custom shape use 'getItemValue' prop
66+
*/
67+
value?: PickerValue;
68+
/**
69+
* Callback for when picker value change
70+
*/
71+
onChange?: (value: PickerValue) => void;
72+
/**
73+
* SINGLE mode or MULTI mode
74+
*/
75+
mode?: PickerModes;
76+
/**
77+
* Limit the number of selected items
78+
*/
79+
selectionLimit?: number;
80+
/**
81+
* Adds blur effect to picker modal (iOS only)
82+
*/
83+
enableModalBlur?: boolean;
84+
/**
85+
* Render custom picker - input will be value (see above)
86+
* Example:
87+
* renderPicker = (selectedItem) => {...}
88+
*/
89+
renderPicker?: RenderPicker;
90+
/**
91+
* Render custom picker item
92+
*/
93+
renderItem?: (
94+
value: PickerValue,
95+
itemProps: PickerItemProps & {isSelected: boolean; isItemDisabled: boolean},
96+
label?: string
97+
) => React.ReactElement;
98+
/**
99+
* Render custom picker modal (e.g ({visible, children, toggleModal}) => {...})
100+
*/
101+
renderCustomModal?: (modalProps: RenderCustomModalProps) => React.ReactElement;
102+
/**
103+
* Custom picker props (when using renderPicker, will apply on the button wrapper)
104+
*/
105+
customPickerProps?: ExpandableOverlayProps;
106+
/**
107+
* Add onPress callback for when pressing the picker
108+
*/
109+
onPress?: () => void;
110+
/**
111+
* @deprecated
112+
* A function that extract the unique value out of the value prop in case value has a custom structure (e.g. {myValue, myLabel})
113+
*/
114+
getItemValue?: (value: PickerValue) => any;
115+
/**
116+
* @deprecated
117+
* A function that extract the label out of the value prop in case value has a custom structure (e.g. {myValue, myLabel})
118+
*/
119+
getItemLabel?: (value: PickerValue) => string;
120+
/**
121+
* A function that returns the label to show for the selected Picker value
122+
*/
123+
getLabel?: (value: PickerValue) => string;
124+
/**
125+
* The picker modal top bar props
126+
*/
127+
topBarProps?: ModalTopBarProps;
128+
/**
129+
* Show search input to filter picker items by label
130+
*/
131+
showSearch?: boolean;
132+
/**
133+
* Style object for the search input (only when passing showSearch)
134+
*/
135+
searchStyle?: PickerSearchStyle;
136+
/**
137+
* Placeholder text for the search input (only when passing showSearch)
138+
*/
139+
searchPlaceholder?: string;
140+
/**
141+
* callback for picker modal search input text change (only when passing showSearch)
142+
*/
143+
onSearchChange?: (searchValue: string) => void;
144+
/**
145+
* Render custom search input (only when passing showSearch)
146+
*/
147+
renderCustomSearch?: (props: PickerItemsListProps) => React.ReactElement;
148+
// /**
149+
// * @deprecated pass useWheelPicker prop instead
150+
// * Allow to use the native picker solution (different style for iOS and Android)
151+
// */
152+
// useNativePicker?: boolean;
153+
/**
154+
* Use wheel picker instead of a list picker
155+
*/
156+
useWheelPicker?: boolean;
157+
/**
158+
* Pass props to the list component that wraps the picker options (allows to control FlatList behavior)
159+
*/
160+
listProps?: Partial<FlatListProps<any>>;
161+
/**
162+
* Pass props to the picker modal
163+
*/
164+
pickerModalProps?: object;
165+
/**
166+
* Custom container style
167+
*/
168+
containerStyle?: StyleProp<ViewStyle>;
169+
/**
170+
* Callback for modal onShow event
171+
*/
172+
onShow?: () => void;
173+
/**
174+
* Add safe area in the Picker modal view
175+
*/
176+
useSafeArea?: boolean;
177+
/**
178+
* Data source for Picker
179+
*/
180+
items?: Pick<PickerItemProps, 'label' | 'value' | 'disabled'>[];
181+
/**
182+
* Component test id
183+
*/
184+
testID?: string;
185+
children?: ReactNode | undefined;
186+
};
189187

190188
export type PickerPropsWithSingle = PickerBaseProps & {
191189
mode?: PickerModes.SINGLE;

0 commit comments

Comments
 (0)