@shoutem/ui 7.2.1 → 7.2.2-rc.1
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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'><svg enable-background="new 0 0 26 26" id="Слой_1" version="1.1" viewBox="0 0 26 26" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g><path d="M1.75,7.75h6.6803589c0.3355713,1.2952271,1.5039063,2.2587891,2.9026489,2.2587891 S13.9000854,9.0452271,14.2356567,7.75H24.25C24.6640625,7.75,25,7.4140625,25,7s-0.3359375-0.75-0.75-0.75H14.2356567 c-0.3355713-1.2952271-1.5039063-2.2587891-2.9026489-2.2587891S8.7659302,4.9547729,8.4303589,6.25H1.75 C1.3359375,6.25,1,6.5859375,1,7S1.3359375,7.75,1.75,7.75z M11.3330078,5.4912109 c0.8320313,0,1.5087891,0.6767578,1.5087891,1.5087891s-0.6767578,1.5087891-1.5087891,1.5087891S9.8242188,7.8320313,9.8242188,7 S10.5009766,5.4912109,11.3330078,5.4912109z" /><path d="M24.25,12.25h-1.6061401c-0.3355713-1.2952271-1.5039063-2.2587891-2.9026489-2.2587891 S17.1741333,10.9547729,16.838562,12.25H1.75C1.3359375,12.25,1,12.5859375,1,13s0.3359375,0.75,0.75,0.75h15.088562 c0.3355713,1.2952271,1.5039063,2.2587891,2.9026489,2.2587891s2.5670776-0.963562,2.9026489-2.2587891H24.25 c0.4140625,0,0.75-0.3359375,0.75-0.75S24.6640625,12.25,24.25,12.25z M19.7412109,14.5087891 c-0.8320313,0-1.5087891-0.6767578-1.5087891-1.5087891s0.6767578-1.5087891,1.5087891-1.5087891S21.25,12.1679688,21.25,13 S20.5732422,14.5087891,19.7412109,14.5087891z" /><path d="M24.25,18.25H9.7181396c-0.3355103-1.2952271-1.5037842-2.2587891-2.9017334-2.2587891 c-1.3987427,0-2.5670776,0.963562-2.9026489,2.2587891H1.75C1.3359375,18.25,1,18.5859375,1,19s0.3359375,0.75,0.75,0.75h2.1637573 c0.3355713,1.2952271,1.5039063,2.2587891,2.9026489,2.2587891c1.3979492,0,2.5662231-0.963562,2.9017334-2.2587891H24.25 c0.4140625,0,0.75-0.3359375,0.75-0.75S24.6640625,18.25,24.25,18.25z M6.8164063,20.5087891 c-0.8320313,0-1.5087891-0.6767578-1.5087891-1.5087891s0.6767578-1.5087891,1.5087891-1.5087891 c0.8310547,0,1.5078125,0.6767578,1.5078125,1.5087891S7.6474609,20.5087891,6.8164063,20.5087891z" /></g></svg>
|
|
@@ -41,6 +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 filters from './filters.svg';
|
|
44
45
|
import folder from './folder.svg';
|
|
45
46
|
import forward from './forward.svg';
|
|
46
47
|
import forward5 from './forward-5.svg';
|
|
@@ -172,6 +173,7 @@ export const defaultConfig = [
|
|
|
172
173
|
{ name: 'eye-crossed', icon: eyeCrossed },
|
|
173
174
|
{ name: 'facebook', icon: facebook },
|
|
174
175
|
{ name: 'facebook-logo', icon: facebookLogo },
|
|
176
|
+
{ name: 'filters', icon: filters },
|
|
175
177
|
{ name: 'folder', icon: folder },
|
|
176
178
|
{ name: 'forward-5', icon: forward5 },
|
|
177
179
|
{ name: 'forward-10', icon: forward10 },
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable react/no-multi-comp */
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
2
3
|
import PropTypes from 'prop-types';
|
|
3
4
|
import { connectAnimation } from '@shoutem/animation';
|
|
4
5
|
import { connectStyle } from '@shoutem/theme';
|
|
@@ -23,59 +24,50 @@ ClearButton.propTypes = {
|
|
|
23
24
|
* It has a search icon, placeholder and a button that clears the current query.
|
|
24
25
|
*
|
|
25
26
|
*/
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
} = this.props;
|
|
27
|
+
const SearchField = ({
|
|
28
|
+
onChangeText,
|
|
29
|
+
placeholder,
|
|
30
|
+
style,
|
|
31
|
+
defaultValue,
|
|
32
|
+
...otherProps
|
|
33
|
+
}) => {
|
|
34
|
+
const [text, setText] = useState(defaultValue);
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
{
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
onChangeText(text);
|
|
38
|
+
}, [onChangeText, text]);
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<View
|
|
42
|
+
style={style.container}
|
|
43
|
+
styleName="horizontal sm-gutter-horizontal v-center"
|
|
44
|
+
>
|
|
45
|
+
<Icon name="search" style={style.searchIcon} />
|
|
46
|
+
<TextInput
|
|
47
|
+
{...otherProps}
|
|
48
|
+
autoCapitalize="none"
|
|
49
|
+
autoCorrect={false}
|
|
50
|
+
onChangeText={setText}
|
|
51
|
+
placeholder={placeholder}
|
|
52
|
+
style={style.input}
|
|
53
|
+
value={text}
|
|
54
|
+
/>
|
|
55
|
+
{!!text && <ClearButton onPress={() => setText('')} style={style} />}
|
|
56
|
+
</View>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
58
59
|
|
|
59
60
|
SearchField.propTypes = {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
clearIcon: PropTypes.object,
|
|
63
|
-
container: PropTypes.object,
|
|
64
|
-
input: PropTypes.object,
|
|
65
|
-
searchIcon: PropTypes.object,
|
|
66
|
-
}).isRequired,
|
|
67
|
-
// A placeholder for input when no value is entered
|
|
61
|
+
style: PropTypes.object.isRequired,
|
|
62
|
+
defaultValue: PropTypes.string,
|
|
68
63
|
placeholder: PropTypes.string,
|
|
69
|
-
// Value to render as text in search input
|
|
70
|
-
value: PropTypes.string,
|
|
71
|
-
// Called with the new value on text change
|
|
72
64
|
onChangeText: PropTypes.func,
|
|
73
65
|
};
|
|
74
66
|
|
|
75
67
|
SearchField.defaultProps = {
|
|
76
68
|
placeholder: undefined,
|
|
77
|
-
value: undefined,
|
|
78
69
|
onChangeText: undefined,
|
|
70
|
+
defaultValue: '',
|
|
79
71
|
};
|
|
80
72
|
|
|
81
73
|
const AnimatedSearchField = connectAnimation(SearchField);
|