@widergy/mobile-ui 1.12.6 → 1.12.7

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [1.12.7](https://github.com/widergy/mobile-ui/compare/v1.12.6...v1.12.7) (2024-07-08)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * utmenu passes selected item value to onclose func ([#307](https://github.com/widergy/mobile-ui/issues/307)) ([b82c033](https://github.com/widergy/mobile-ui/commit/b82c033a284dfa3d647930cd33b0c5b0dfd269ce))
7
+
1
8
  ## [1.12.6](https://github.com/widergy/mobile-ui/compare/v1.12.5...v1.12.6) (2024-07-03)
2
9
 
3
10
 
@@ -1,6 +1,7 @@
1
1
  import { arrayOf, bool, element, func, oneOf, shape, string } from 'prop-types';
2
2
  import React, { useEffect, useState } from 'react';
3
3
  import { View } from 'react-native';
4
+ import { ViewPropTypes } from 'deprecated-react-native-prop-types';
4
5
 
5
6
  import { WINDOW_HEIGHT } from '../../utils/scaleUtils';
6
7
  import UTMenu from '../UTMenu';
@@ -21,7 +22,8 @@ const UTAutocomplete = ({
21
22
  MenuOptionComponent,
22
23
  options,
23
24
  persistSelectedOption = false,
24
- variant
25
+ variant,
26
+ styles: propStyles
25
27
  }) => {
26
28
  const [selectedOption, setSelectedOption] = useState();
27
29
 
@@ -54,6 +56,7 @@ const UTAutocomplete = ({
54
56
  options={options}
55
57
  selectedOption={selectedOption?.id}
56
58
  withAutocomplete
59
+ styles={propStyles?.UTMenu}
57
60
  >
58
61
  <UTTextInput
59
62
  disabled={disabled}
@@ -94,7 +97,8 @@ UTAutocomplete.propTypes = {
94
97
  })
95
98
  ),
96
99
  persistSelectedOption: bool,
97
- variant: string
100
+ variant: string,
101
+ styles: ViewPropTypes.style
98
102
  };
99
103
 
100
104
  export default UTAutocomplete;
@@ -28,7 +28,7 @@ class ListView extends PureComponent {
28
28
 
29
29
  handleOnPress = item => {
30
30
  const { handleOptionPress, onPress } = this.props;
31
- return handleOptionPress(item.action || (() => onPress(item)));
31
+ return handleOptionPress(item.action || (() => onPress(item)), item?.value);
32
32
  };
33
33
 
34
34
  renderItem = ({ item }) => {
@@ -3,6 +3,7 @@ import { Dimensions, Keyboard, KeyboardAvoidingView, Modal, TouchableOpacity, Vi
3
3
 
4
4
  import useKeyboardHeight from '../../hooks/useKeyboardHeight';
5
5
  import UTTextInput from '../UTTextInput';
6
+ import Surface from '../Surface';
6
7
 
7
8
  import MenuOption from './components/MenuOption';
8
9
  import ListView from './components/ListView';
@@ -101,15 +102,15 @@ const UTMenu = ({
101
102
  setTimeout(() => setIsOpen(true), 20);
102
103
  if (onOpen) onOpen();
103
104
  };
104
- const closeMenu = () => {
105
+ const closeMenu = value => {
105
106
  setIsOpen(false);
106
107
  setQuery('');
107
- if (onClose) onClose();
108
+ if (onClose) onClose(value);
108
109
  };
109
110
 
110
- const handleOptionPress = action => {
111
+ const handleOptionPress = (action, value) => {
111
112
  action();
112
- if (!isMultiple) closeMenu();
113
+ if (!isMultiple) closeMenu(value);
113
114
  };
114
115
 
115
116
  const focusSearchInput = () => withAutocomplete && searchTextInputRef.current?.focus();
@@ -140,14 +141,14 @@ const UTMenu = ({
140
141
  <TouchableOpacity onPress={closeMenu} style={styles.overlayTouchable}>
141
142
  <View style={styles.overlay} />
142
143
  </TouchableOpacity>
143
- <View
144
+ <Surface
144
145
  style={[styles.menu, position, fullWidth && { width: anchorMeasure?.width }, propStyles?.menu]}
145
146
  ref={menuRef}
146
147
  onLayout={handleMenuLayout}
147
148
  >
148
149
  <KeyboardAvoidingView behavior="height">
149
150
  {withAutocomplete && (
150
- <View style={styles.searchContainer}>
151
+ <View style={[styles.searchContainer, propStyles?.searchContainer]}>
151
152
  <UTTextInput
152
153
  InputRef={searchTextInputRef}
153
154
  value={query}
@@ -177,7 +178,7 @@ const UTMenu = ({
177
178
  isMultiple={isMultiple}
178
179
  />
179
180
  </KeyboardAvoidingView>
180
- </View>
181
+ </Surface>
181
182
  </Modal>
182
183
  </Fragment>
183
184
  );
@@ -7,7 +7,6 @@ export default StyleSheet.create({
7
7
  left: 0,
8
8
  backgroundColor: 'white',
9
9
  borderRadius: 8,
10
- elevation: 5,
11
10
  paddingVertical: 4
12
11
  },
13
12
  overlay: {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@widergy/mobile-ui",
3
3
  "description": "Widergy Mobile Components",
4
4
  "author": "widergy",
5
- "version": "1.12.6",
5
+ "version": "1.12.7",
6
6
  "repository": "https://github.com/widergy/mobile-ui.git",
7
7
  "main": "lib/index.js",
8
8
  "files": [