Skip to content

Commit 1770fb2

Browse files
authored
Merge pull request #685 from shoutem/release/4.9.0
Release 5.9.0 - master
2 parents 683d15e + 140a43a commit 1770fb2

File tree

4 files changed

+38
-17
lines changed

4 files changed

+38
-17
lines changed

components/InlineDropDownMenu/InlineDropDownMenu.js

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { PureComponent } from 'react';
2-
import { Animated, FlatList } from 'react-native';
32
import autoBindReact from 'auto-bind/react';
3+
import { Animated, ScrollView } from 'react-native';
44
import _ from 'lodash';
55
import PropTypes from 'prop-types';
66
import { connectStyle } from '@shoutem/theme';
@@ -14,7 +14,7 @@ const AnimatedIcon = Animated.createAnimatedComponent(Icon);
1414

1515
const optionShape = PropTypes.shape({
1616
title: PropTypes.string.isRequired,
17-
key: PropTypes.string.isRequired,
17+
key: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
1818
});
1919

2020
class InlineDropDownMenu extends PureComponent {
@@ -24,6 +24,10 @@ class InlineDropDownMenu extends PureComponent {
2424
options: PropTypes.arrayOf(optionShape).isRequired,
2525
onOptionSelected: PropTypes.func,
2626
selectedOption: optionShape,
27+
headingStyle: PropTypes.object,
28+
containerStyle: PropTypes.object,
29+
selectedOptionContainerStyle: PropTypes.object,
30+
selectedOptionTextStyle: PropTypes.object,
2731
};
2832

2933
constructor(props) {
@@ -69,6 +73,7 @@ class InlineDropDownMenu extends PureComponent {
6973

7074
return (
7175
<InlineDropDownMenuItem
76+
key={item.key}
7277
item={item}
7378
isSelected={isSelected}
7479
index={index}
@@ -79,18 +84,32 @@ class InlineDropDownMenu extends PureComponent {
7984
}
8085

8186
render() {
82-
const { style, heading, selectedOption, options } = this.props;
87+
const {
88+
style,
89+
heading,
90+
selectedOption,
91+
options,
92+
headingStyle,
93+
containerStyle,
94+
selectedOptionContainerStyle,
95+
selectedOptionTextStyle,
96+
} = this.props;
8397
const { collapsed } = this.state;
8498

8599
return (
86100
<View>
87101
<TouchableOpacity
88-
style={style.container}
102+
style={[style.container, containerStyle]}
89103
onPress={this.handleToggleMenuPress}
90104
>
91-
<Caption styleName="muted md-gutter-bottom">{heading}</Caption>
92-
<View styleName="space-between horizontal v-center">
93-
<Text>{selectedOption?.title}</Text>
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>
94113
<AnimatedIcon
95114
name="drop-down"
96115
styleName="md-gutter-left"
@@ -109,11 +128,14 @@ class InlineDropDownMenu extends PureComponent {
109128
</View>
110129
</TouchableOpacity>
111130
{collapsed && (
112-
<FlatList
131+
<ScrollView
113132
data={options}
114-
renderItem={this.renderOption}
115133
contentContainerStyle={style.list}
116-
/>
134+
>
135+
{_.map(options, (item, index) =>
136+
this.renderOption({ item, index }),
137+
)}
138+
</ScrollView>
117139
)}
118140
</View>
119141
);

components/InlineDropDownMenu/InlineDropDownMenuItem.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import React, { PureComponent } from 'react';
2-
import { Animated, Dimensions } from 'react-native';
2+
import { Animated, Dimensions, Pressable } from 'react-native';
33
import autoBindReact from 'auto-bind/react';
44
import _ from 'lodash';
55
import PropTypes from 'prop-types';
66
import { connectStyle } from '@shoutem/theme';
77
import { Text } from '../Text';
8-
import { TouchableOpacity } from '../TouchableOpacity';
98

109
const window = Dimensions.get('window');
11-
const AnimatedTouchable = Animated.createAnimatedComponent(TouchableOpacity);
10+
const AnimatedPressable = Animated.createAnimatedComponent(Pressable);
1211

1312
class InlineDropDownMenuItem extends PureComponent {
1413
static propTypes = {
@@ -54,7 +53,7 @@ class InlineDropDownMenuItem extends PureComponent {
5453
const textStyle = isSelected ? 'muted' : '';
5554

5655
return (
57-
<AnimatedTouchable
56+
<AnimatedPressable
5857
style={[
5958
style.container,
6059
{
@@ -72,7 +71,7 @@ class InlineDropDownMenuItem extends PureComponent {
7271
onPress={this.handlePress}
7372
>
7473
<Text styleName={textStyle}>{resolvedText}</Text>
75-
</AnimatedTouchable>
74+
</AnimatedPressable>
7675
);
7776
}
7877
}

components/TextInput.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ class TextInput extends PureComponent {
6161
selectionColor={selectionColor}
6262
underlineColorAndroid={underlineColorAndroid}
6363
style={{
64-
...otherStyle,
6564
...(hasBorder ? withBorder : withoutBorder),
6665
...(errorMessage ? errorBorderColor : {}),
66+
...otherStyle,
6767
}}
6868
/>
6969
</Wiggle>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@shoutem/ui",
3-
"version": "4.8.0",
3+
"version": "4.9.0",
44
"description": "Styleable set of components for React Native applications",
55
"scripts": {
66
"lint": "eslint .",

0 commit comments

Comments
 (0)