@shoutem/ui 4.8.0 → 4.9.0
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { PureComponent } from 'react';
|
|
2
|
-
import { Animated, FlatList } from 'react-native';
|
|
3
2
|
import autoBindReact from 'auto-bind/react';
|
|
3
|
+
import { Animated, ScrollView } from 'react-native';
|
|
4
4
|
import _ from 'lodash';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { connectStyle } from '@shoutem/theme';
|
|
@@ -14,7 +14,7 @@ const AnimatedIcon = Animated.createAnimatedComponent(Icon);
|
|
|
14
14
|
|
|
15
15
|
const optionShape = PropTypes.shape({
|
|
16
16
|
title: PropTypes.string.isRequired,
|
|
17
|
-
key: PropTypes.string.isRequired,
|
|
17
|
+
key: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
class InlineDropDownMenu extends PureComponent {
|
|
@@ -24,6 +24,10 @@ class InlineDropDownMenu extends PureComponent {
|
|
|
24
24
|
options: PropTypes.arrayOf(optionShape).isRequired,
|
|
25
25
|
onOptionSelected: PropTypes.func,
|
|
26
26
|
selectedOption: optionShape,
|
|
27
|
+
headingStyle: PropTypes.object,
|
|
28
|
+
containerStyle: PropTypes.object,
|
|
29
|
+
selectedOptionContainerStyle: PropTypes.object,
|
|
30
|
+
selectedOptionTextStyle: PropTypes.object,
|
|
27
31
|
};
|
|
28
32
|
|
|
29
33
|
constructor(props) {
|
|
@@ -69,6 +73,7 @@ class InlineDropDownMenu extends PureComponent {
|
|
|
69
73
|
|
|
70
74
|
return (
|
|
71
75
|
<InlineDropDownMenuItem
|
|
76
|
+
key={item.key}
|
|
72
77
|
item={item}
|
|
73
78
|
isSelected={isSelected}
|
|
74
79
|
index={index}
|
|
@@ -79,18 +84,32 @@ class InlineDropDownMenu extends PureComponent {
|
|
|
79
84
|
}
|
|
80
85
|
|
|
81
86
|
render() {
|
|
82
|
-
const {
|
|
87
|
+
const {
|
|
88
|
+
style,
|
|
89
|
+
heading,
|
|
90
|
+
selectedOption,
|
|
91
|
+
options,
|
|
92
|
+
headingStyle,
|
|
93
|
+
containerStyle,
|
|
94
|
+
selectedOptionContainerStyle,
|
|
95
|
+
selectedOptionTextStyle,
|
|
96
|
+
} = this.props;
|
|
83
97
|
const { collapsed } = this.state;
|
|
84
98
|
|
|
85
99
|
return (
|
|
86
100
|
<View>
|
|
87
101
|
<TouchableOpacity
|
|
88
|
-
style={style.container}
|
|
102
|
+
style={[style.container, containerStyle]}
|
|
89
103
|
onPress={this.handleToggleMenuPress}
|
|
90
104
|
>
|
|
91
|
-
<Caption styleName="muted md-gutter-bottom"
|
|
92
|
-
|
|
93
|
-
|
|
105
|
+
<Caption styleName="muted md-gutter-bottom" style={headingStyle}>
|
|
106
|
+
{heading}
|
|
107
|
+
</Caption>
|
|
108
|
+
<View
|
|
109
|
+
styleName="space-between horizontal v-center"
|
|
110
|
+
style={selectedOptionContainerStyle}
|
|
111
|
+
>
|
|
112
|
+
<Text style={selectedOptionTextStyle}>{selectedOption?.title}</Text>
|
|
94
113
|
<AnimatedIcon
|
|
95
114
|
name="drop-down"
|
|
96
115
|
styleName="md-gutter-left"
|
|
@@ -109,11 +128,14 @@ class InlineDropDownMenu extends PureComponent {
|
|
|
109
128
|
</View>
|
|
110
129
|
</TouchableOpacity>
|
|
111
130
|
{collapsed && (
|
|
112
|
-
<
|
|
131
|
+
<ScrollView
|
|
113
132
|
data={options}
|
|
114
|
-
renderItem={this.renderOption}
|
|
115
133
|
contentContainerStyle={style.list}
|
|
116
|
-
|
|
134
|
+
>
|
|
135
|
+
{_.map(options, (item, index) =>
|
|
136
|
+
this.renderOption({ item, index }),
|
|
137
|
+
)}
|
|
138
|
+
</ScrollView>
|
|
117
139
|
)}
|
|
118
140
|
</View>
|
|
119
141
|
);
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import React, { PureComponent } from 'react';
|
|
2
|
-
import { Animated, Dimensions } from 'react-native';
|
|
2
|
+
import { Animated, Dimensions, Pressable } from 'react-native';
|
|
3
3
|
import autoBindReact from 'auto-bind/react';
|
|
4
4
|
import _ from 'lodash';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { connectStyle } from '@shoutem/theme';
|
|
7
7
|
import { Text } from '../Text';
|
|
8
|
-
import { TouchableOpacity } from '../TouchableOpacity';
|
|
9
8
|
|
|
10
9
|
const window = Dimensions.get('window');
|
|
11
|
-
const
|
|
10
|
+
const AnimatedPressable = Animated.createAnimatedComponent(Pressable);
|
|
12
11
|
|
|
13
12
|
class InlineDropDownMenuItem extends PureComponent {
|
|
14
13
|
static propTypes = {
|
|
@@ -54,7 +53,7 @@ class InlineDropDownMenuItem extends PureComponent {
|
|
|
54
53
|
const textStyle = isSelected ? 'muted' : '';
|
|
55
54
|
|
|
56
55
|
return (
|
|
57
|
-
<
|
|
56
|
+
<AnimatedPressable
|
|
58
57
|
style={[
|
|
59
58
|
style.container,
|
|
60
59
|
{
|
|
@@ -72,7 +71,7 @@ class InlineDropDownMenuItem extends PureComponent {
|
|
|
72
71
|
onPress={this.handlePress}
|
|
73
72
|
>
|
|
74
73
|
<Text styleName={textStyle}>{resolvedText}</Text>
|
|
75
|
-
</
|
|
74
|
+
</AnimatedPressable>
|
|
76
75
|
);
|
|
77
76
|
}
|
|
78
77
|
}
|
package/components/TextInput.js
CHANGED
|
@@ -61,9 +61,9 @@ class TextInput extends PureComponent {
|
|
|
61
61
|
selectionColor={selectionColor}
|
|
62
62
|
underlineColorAndroid={underlineColorAndroid}
|
|
63
63
|
style={{
|
|
64
|
-
...otherStyle,
|
|
65
64
|
...(hasBorder ? withBorder : withoutBorder),
|
|
66
65
|
...(errorMessage ? errorBorderColor : {}),
|
|
66
|
+
...otherStyle,
|
|
67
67
|
}}
|
|
68
68
|
/>
|
|
69
69
|
</Wiggle>
|