react-native-ui-lib 7.40.1-snapshot.6861 → 7.40.1-snapshot.6870
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()}
|
|
@@ -81,17 +81,13 @@
|
|
|
81
81
|
"snippet": [
|
|
82
82
|
"function Example(props) {",
|
|
83
83
|
" const [value, setValue] = useState(false$1);",
|
|
84
|
-
" return
|
|
85
|
-
" <div>",
|
|
86
|
-
" <Switch value={value$2} onValueChange={setValue$3}/>",
|
|
87
|
-
" </div>",
|
|
88
|
-
" );",
|
|
84
|
+
" return <Switch margin-20 value={value$2} onValueChange={setValue$3}/>;",
|
|
89
85
|
"}"
|
|
90
86
|
],
|
|
91
87
|
"docs": {
|
|
92
88
|
"hero": {
|
|
93
89
|
"title": "Switch",
|
|
94
|
-
"description": "Use switches to toggle a single option on or off, activate or deactivate, and switch between two different states.
|
|
90
|
+
"description": "Use switches to toggle a single option on or off, activate or deactivate, and switch between two different states. \n\nConsider using switch instead of checkbox, when appropriate. \nConsider using switch instead of radio buttons if there’s only two options to choose from. ",
|
|
95
91
|
"type": "hero",
|
|
96
92
|
"layout": "horizontal",
|
|
97
93
|
"content": [
|
|
@@ -125,7 +121,8 @@
|
|
|
125
121
|
"description": "",
|
|
126
122
|
"content": [
|
|
127
123
|
{
|
|
128
|
-
"
|
|
124
|
+
"background": "#A6ACB1",
|
|
125
|
+
"value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Switch/SwitchLight.png"
|
|
129
126
|
}
|
|
130
127
|
]
|
|
131
128
|
}
|
|
@@ -149,7 +146,8 @@
|
|
|
149
146
|
"value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components Docs/Switch/switch_overview_state_default_on.png"
|
|
150
147
|
},
|
|
151
148
|
{
|
|
152
|
-
"
|
|
149
|
+
"background": "#A6ACB1",
|
|
150
|
+
"value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Switch/SwitchLight.png"
|
|
153
151
|
}
|
|
154
152
|
]
|
|
155
153
|
},
|
|
@@ -161,7 +159,8 @@
|
|
|
161
159
|
"value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components Docs/Switch/switch_overview_state_default_off.png"
|
|
162
160
|
},
|
|
163
161
|
{
|
|
164
|
-
"
|
|
162
|
+
"background": "#A6ACB1",
|
|
163
|
+
"value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Switch/SwitchLightOff.png"
|
|
165
164
|
}
|
|
166
165
|
]
|
|
167
166
|
},
|
|
@@ -173,7 +172,8 @@
|
|
|
173
172
|
"value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components Docs/Switch/switch_overview_state_default_disabledOn.png"
|
|
174
173
|
},
|
|
175
174
|
{
|
|
176
|
-
"
|
|
175
|
+
"background": "#A6ACB1",
|
|
176
|
+
"value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Switch/SwitchLightDisabled.png"
|
|
177
177
|
}
|
|
178
178
|
]
|
|
179
179
|
},
|
|
@@ -185,7 +185,8 @@
|
|
|
185
185
|
"value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components Docs/Switch/switch_overview_state_default_disabledOff.png"
|
|
186
186
|
},
|
|
187
187
|
{
|
|
188
|
-
"
|
|
188
|
+
"background": "#A6ACB1",
|
|
189
|
+
"value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Switch/SwitchLightDisabledOff.png"
|
|
189
190
|
}
|
|
190
191
|
]
|
|
191
192
|
}
|
|
@@ -197,17 +198,21 @@
|
|
|
197
198
|
"type": "list",
|
|
198
199
|
"items": [
|
|
199
200
|
{
|
|
200
|
-
"title": "",
|
|
201
|
-
"description": "
|
|
201
|
+
"title": "Size",
|
|
202
|
+
"description": "Currently, only one size available for the ToggleSwitch.",
|
|
202
203
|
"content": [
|
|
203
204
|
{
|
|
204
|
-
"value": "https://
|
|
205
|
+
"value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Switch/switch_overview_spec_size.png"
|
|
205
206
|
}
|
|
206
207
|
]
|
|
207
208
|
},
|
|
208
209
|
{
|
|
209
|
-
"title": "",
|
|
210
|
-
"description": "markdown:
|
|
210
|
+
"title": "Colors",
|
|
211
|
+
"description": "markdown:<b>ON</b><br>Background color: $backgroundPrimaryHeavy<br>Knob color: $iconDefaultLight<br><b>OFF</b><br>Background color: $backgroundNeutralHeavy<br>Knob color: $iconDefaultLight<br><b>Disabled</b><br>Background color: $backgroundDisabled<br>Knob color: $iconDefaultLight"
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"title": "Haptic ",
|
|
215
|
+
"description": "Haptic is played on tap. Haptic preset: [impactMedium]",
|
|
211
216
|
"content": [
|
|
212
217
|
{
|
|
213
218
|
"value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components Docs/Switch/switch_overview_spec_haptic.png"
|