@shoutem/ui 7.2.2-rc.0 → 7.2.2-rc.2
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/components/Icon/assets/index.js +2 -2
- package/components/SearchField.js +14 -16
- package/components/TextInput.js +1 -1
- package/package.json +1 -1
- package/theme.js +0 -1
|
@@ -41,7 +41,7 @@ import eye from './eye.svg';
|
|
|
41
41
|
import eyeCrossed from './eye-crossed.svg';
|
|
42
42
|
import facebook from './facebook.svg';
|
|
43
43
|
import facebookLogo from './facebook-logo.svg';
|
|
44
|
-
import
|
|
44
|
+
import filters from './filters.svg';
|
|
45
45
|
import folder from './folder.svg';
|
|
46
46
|
import forward from './forward.svg';
|
|
47
47
|
import forward5 from './forward-5.svg';
|
|
@@ -173,7 +173,7 @@ export const defaultConfig = [
|
|
|
173
173
|
{ name: 'eye-crossed', icon: eyeCrossed },
|
|
174
174
|
{ name: 'facebook', icon: facebook },
|
|
175
175
|
{ name: 'facebook-logo', icon: facebookLogo },
|
|
176
|
-
{ name: '
|
|
176
|
+
{ name: 'filters', icon: filters },
|
|
177
177
|
{ name: 'folder', icon: folder },
|
|
178
178
|
{ name: 'forward-5', icon: forward5 },
|
|
179
179
|
{ name: 'forward-10', icon: forward10 },
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* eslint-disable react/no-multi-comp */
|
|
2
2
|
import React, { useEffect, useState } from 'react';
|
|
3
|
+
import { ActivityIndicator } from 'react-native';
|
|
3
4
|
import PropTypes from 'prop-types';
|
|
4
5
|
import { connectAnimation } from '@shoutem/animation';
|
|
5
6
|
import { connectStyle } from '@shoutem/theme';
|
|
@@ -24,18 +25,13 @@ ClearButton.propTypes = {
|
|
|
24
25
|
* It has a search icon, placeholder and a button that clears the current query.
|
|
25
26
|
*
|
|
26
27
|
*/
|
|
27
|
-
const SearchField = ({
|
|
28
|
-
|
|
29
|
-
placeholder,
|
|
30
|
-
style,
|
|
31
|
-
defaultValue,
|
|
32
|
-
...otherProps
|
|
33
|
-
}) => {
|
|
34
|
-
const [text, setText] = useState(defaultValue);
|
|
28
|
+
const SearchField = ({ onChangeText, loading, style, ...otherProps }) => {
|
|
29
|
+
const [text, setText] = useState(otherProps.defaultValue);
|
|
35
30
|
|
|
36
31
|
useEffect(() => {
|
|
37
32
|
onChangeText(text);
|
|
38
|
-
|
|
33
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
34
|
+
}, [text]);
|
|
39
35
|
|
|
40
36
|
return (
|
|
41
37
|
<View
|
|
@@ -44,15 +40,17 @@ const SearchField = ({
|
|
|
44
40
|
>
|
|
45
41
|
<Icon name="search" style={style.searchIcon} />
|
|
46
42
|
<TextInput
|
|
47
|
-
{...otherProps}
|
|
48
43
|
autoCapitalize="none"
|
|
49
44
|
autoCorrect={false}
|
|
50
|
-
onChangeText={setText}
|
|
51
|
-
placeholder={placeholder}
|
|
52
|
-
style={style.input}
|
|
53
45
|
value={text}
|
|
46
|
+
style={style.input}
|
|
47
|
+
{...otherProps}
|
|
48
|
+
onChangeText={setText}
|
|
54
49
|
/>
|
|
55
|
-
{!!text &&
|
|
50
|
+
{!!text && !loading && (
|
|
51
|
+
<ClearButton onPress={() => setText('')} style={style} />
|
|
52
|
+
)}
|
|
53
|
+
{loading && <ActivityIndicator style={style.clearButton} />}
|
|
56
54
|
</View>
|
|
57
55
|
);
|
|
58
56
|
};
|
|
@@ -60,12 +58,12 @@ const SearchField = ({
|
|
|
60
58
|
SearchField.propTypes = {
|
|
61
59
|
style: PropTypes.object.isRequired,
|
|
62
60
|
defaultValue: PropTypes.string,
|
|
63
|
-
|
|
61
|
+
loading: PropTypes.bool,
|
|
64
62
|
onChangeText: PropTypes.func,
|
|
65
63
|
};
|
|
66
64
|
|
|
67
65
|
SearchField.defaultProps = {
|
|
68
|
-
|
|
66
|
+
loading: false,
|
|
69
67
|
onChangeText: undefined,
|
|
70
68
|
defaultValue: '',
|
|
71
69
|
};
|
package/components/TextInput.js
CHANGED
|
@@ -80,8 +80,8 @@ class TextInput extends PureComponent {
|
|
|
80
80
|
underlineColorAndroid={underlineColorAndroid}
|
|
81
81
|
style={{
|
|
82
82
|
...(hasBorder ? withBorder : withoutBorder),
|
|
83
|
-
...(errorMessage ? errorBorderColor : {}),
|
|
84
83
|
...otherStyle,
|
|
84
|
+
...(errorMessage ? errorBorderColor : {}),
|
|
85
85
|
height,
|
|
86
86
|
}}
|
|
87
87
|
ref={forwardedRef}
|
package/package.json
CHANGED