@shoutem/ui 5.0.1-rc.0 → 5.2.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.
- package/components/ActionSheet/ActionSheet.js +15 -8
- package/components/ActionSheet/ActionSheetOption.js +7 -2
- package/components/Button.js +5 -9
- package/components/CategoryPicker/Category.js +45 -0
- package/components/CategoryPicker/CategoryPicker.js +62 -0
- package/components/CategoryPicker/index.js +1 -0
- package/components/CategoryPicker/shapes.js +7 -0
- package/components/DateTimePicker.js +4 -1
- package/components/DropDownMenu/DropDownMenu.js +20 -23
- package/components/DropDownMenu/DropDownModal.js +56 -54
- package/components/EmptyStateView.js +16 -12
- package/components/FormGroup.js +7 -1
- package/components/GridRow.js +1 -1
- package/components/HorizontalPager/HorizontalPager.js +61 -52
- package/components/HorizontalPager/Page.js +12 -7
- package/components/Icon/Icon.js +1 -1
- package/components/Image.js +4 -4
- package/components/ImageBackground.js +4 -4
- package/components/ImageGallery/ImageGallery.android.js +8 -0
- package/components/ImageGallery/ImageGallery.ios.js +8 -0
- package/components/ImageGallery/ImageGalleryBase.js +65 -48
- package/components/ImageGalleryOverlay.js +12 -7
- package/components/ImagePreview.js +19 -14
- package/components/InlineDropDownMenu/InlineDropDownMenu.js +27 -18
- package/components/InlineDropDownMenu/InlineDropDownMenuItem.js +17 -9
- package/components/InlineGallery.js +42 -35
- package/components/LinearGradient.js +15 -5
- package/components/ListView.js +1 -7
- package/components/LoadingContainer.js +1 -2
- package/components/NavigationBar/NavigationBar.js +18 -13
- package/components/NumberInput.js +32 -24
- package/components/PageIndicators.js +19 -17
- package/components/ScrollView/ScrollDriverProvider.js +20 -10
- package/components/ScrollView/ScrollView.js +15 -13
- package/components/SearchField.js +24 -18
- package/components/ShareButton.js +21 -11
- package/components/Spinner.js +1 -1
- package/components/Switch.js +19 -14
- package/components/TabMenu/TabMenu.js +12 -7
- package/components/TabMenu/TabMenuItem.js +13 -7
- package/components/TextInput.js +3 -1
- package/components/Touchable.js +19 -23
- package/components/TouchableNativeFeedback.js +15 -21
- package/components/TouchableOpacity.js +6 -12
- package/components/Video/Video.js +21 -25
- package/components/View.js +7 -9
- package/components/YearRangePicker/YearRangePicker.js +22 -17
- package/components/YearRangePicker/YearRangePickerButton.js +13 -7
- package/components/YearRangePicker/YearRangePickerModal.js +23 -16
- package/examples/components/NavigationBars.js +4 -0
- package/examples/components/Stage.js +6 -1
- package/html/Html.js +14 -8
- package/html/components/Gallery.js +9 -5
- package/html/components/Image.js +16 -16
- package/html/components/SimpleHtml.js +19 -10
- package/html/elements/A.js +11 -6
- package/html/elements/Inline.js +13 -14
- package/html/elements/Text.js +6 -0
- package/html/elements/Video.js +3 -1
- package/html/elements/list/Li.js +0 -2
- package/html/elements/list/Ol.js +4 -0
- package/html/elements/list/Ul.js +4 -0
- package/html/elements/list/prefix/Bullet.js +4 -0
- package/html/elements/list/prefix/Number.js +6 -1
- package/index.js +47 -52
- package/init.js +7 -1
- package/package.json +1 -1
- package/services/index.js +6 -0
- package/services/variableResolver.js +73 -0
- package/theme.js +2295 -2181
package/components/Icon/Icon.js
CHANGED
package/components/Image.js
CHANGED
|
@@ -18,10 +18,6 @@ const isValidSource = source =>
|
|
|
18
18
|
let externalPropsTransformer = null;
|
|
19
19
|
|
|
20
20
|
class Image extends PureComponent {
|
|
21
|
-
static propTypes = {
|
|
22
|
-
...RNImage.propTypes,
|
|
23
|
-
};
|
|
24
|
-
|
|
25
21
|
/**
|
|
26
22
|
* Set a shared props transformer. The transformer will
|
|
27
23
|
* be called on each props change, and it should return
|
|
@@ -85,6 +81,10 @@ class Image extends PureComponent {
|
|
|
85
81
|
}
|
|
86
82
|
}
|
|
87
83
|
|
|
84
|
+
Image.propTypes = {
|
|
85
|
+
...RNImage.propTypes,
|
|
86
|
+
};
|
|
87
|
+
|
|
88
88
|
const AnimatedImage = connectAnimation(Image);
|
|
89
89
|
const StyledImage = connectStyle('shoutem.ui.Image')(AnimatedImage);
|
|
90
90
|
export { StyledImage as Image };
|
|
@@ -18,10 +18,6 @@ const isValidSource = source =>
|
|
|
18
18
|
let externalPropsTransformer = null;
|
|
19
19
|
|
|
20
20
|
class ImageBackground extends PureComponent {
|
|
21
|
-
static propTypes = {
|
|
22
|
-
...RNImageBackground.propTypes,
|
|
23
|
-
};
|
|
24
|
-
|
|
25
21
|
/**
|
|
26
22
|
* Set a shared props transformer. The transformer will
|
|
27
23
|
* be called on each props change, and it should return
|
|
@@ -85,6 +81,10 @@ class ImageBackground extends PureComponent {
|
|
|
85
81
|
}
|
|
86
82
|
}
|
|
87
83
|
|
|
84
|
+
ImageBackground.propTypes = {
|
|
85
|
+
...RNImageBackground.propTypes,
|
|
86
|
+
};
|
|
87
|
+
|
|
88
88
|
const AnimatedImage = connectAnimation(ImageBackground);
|
|
89
89
|
const StyledImage = connectStyle('shoutem.ui.ImageBackground')(AnimatedImage);
|
|
90
90
|
export { StyledImage as ImageBackground };
|
|
@@ -27,6 +27,14 @@ class ImageGallery extends ImageGalleryBase {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
ImageGallery.propTypes = {
|
|
31
|
+
...ImageGalleryBase.propTypes,
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
ImageGallery.defaultProps = {
|
|
35
|
+
...ImageGalleryBase.defaultProps,
|
|
36
|
+
};
|
|
37
|
+
|
|
30
38
|
const StyledImageGallery = connectStyle('shoutem.ui.ImageGallery')(
|
|
31
39
|
ImageGallery,
|
|
32
40
|
);
|
|
@@ -105,6 +105,14 @@ class ImageGallery extends ImageGalleryBase {
|
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
+
ImageGallery.propTypes = {
|
|
109
|
+
...ImageGalleryBase.propTypes,
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
ImageGallery.defaultProps = {
|
|
113
|
+
...ImageGalleryBase.defaultProps,
|
|
114
|
+
};
|
|
115
|
+
|
|
108
116
|
const StyledImageGallery = connectStyle('shoutem.ui.ImageGallery')(
|
|
109
117
|
ImageGallery,
|
|
110
118
|
);
|
|
@@ -24,58 +24,20 @@ export class ImageGalleryBase extends PureComponent {
|
|
|
24
24
|
*/
|
|
25
25
|
static IMAGE_GALLERY_MODE = IMAGE_GALLERY_MODE;
|
|
26
26
|
|
|
27
|
-
static propTypes = {
|
|
28
|
-
// Array containing objects with gallery data (shape defined below)
|
|
29
|
-
data: PropTypes.arrayOf(
|
|
30
|
-
PropTypes.shape({
|
|
31
|
-
source: PropTypes.shape({
|
|
32
|
-
uri: PropTypes.string,
|
|
33
|
-
}),
|
|
34
|
-
description: PropTypes.string,
|
|
35
|
-
title: PropTypes.string,
|
|
36
|
-
}),
|
|
37
|
-
).isRequired,
|
|
38
|
-
// Callback function called when user swipes between pages (images)
|
|
39
|
-
// Index of new (selected) page is passed to this callback
|
|
40
|
-
onIndexSelected: PropTypes.func,
|
|
41
|
-
// Initially selected page in gallery
|
|
42
|
-
selectedIndex: PropTypes.number,
|
|
43
|
-
// onModeChanged(mode), callback function triggered when user taps on single photo
|
|
44
|
-
// Or when user transforms (zooms etc.) image
|
|
45
|
-
// Useful for hiding external controls (i.e. navigation bar)
|
|
46
|
-
// Mode can be `gallery` or `imagePreview`
|
|
47
|
-
onModeChanged: PropTypes.func,
|
|
48
|
-
// Style prop used to override default (theme) styling
|
|
49
|
-
style: PropTypes.object,
|
|
50
|
-
// Renders an overlay over all images
|
|
51
|
-
// For example page indicators using the `PageIndicators` component
|
|
52
|
-
// renderOverlay(imageData, imageIndex)
|
|
53
|
-
renderOverlay: PropTypes.func,
|
|
54
|
-
// Renders an overlay over a single image
|
|
55
|
-
// For example image gallery overlay using the `ImageGalleryOverlay` component
|
|
56
|
-
// renderOverlay(imageData, imageIndex)
|
|
57
|
-
renderImageOverlay: PropTypes.func,
|
|
58
|
-
// Callback function that can be used to define placeholder
|
|
59
|
-
// that appears when content is loading
|
|
60
|
-
renderPlaceholder: PropTypes.func,
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
static defaultProps = {
|
|
64
|
-
selectedIndex: 0,
|
|
65
|
-
showNextPage: false,
|
|
66
|
-
renderPlaceholder: () => <LoadingIndicator />,
|
|
67
|
-
};
|
|
68
|
-
|
|
69
27
|
constructor(props) {
|
|
70
28
|
super(props);
|
|
71
29
|
|
|
72
30
|
autoBindReact(this);
|
|
73
31
|
|
|
32
|
+
const { selectedIndex } = props;
|
|
33
|
+
|
|
74
34
|
this.state = {
|
|
75
|
-
selectedIndex
|
|
35
|
+
selectedIndex,
|
|
76
36
|
imageSwitchingEnabled: true,
|
|
77
|
-
collapsed: true,
|
|
78
37
|
mode: IMAGE_GALLERY_MODE,
|
|
38
|
+
// Disabling rule as this flag is used via inheritance in other classes.
|
|
39
|
+
// eslint-disable-next-line react/no-unused-state
|
|
40
|
+
collapsed: true,
|
|
79
41
|
};
|
|
80
42
|
}
|
|
81
43
|
|
|
@@ -105,9 +67,11 @@ export class ImageGalleryBase extends PureComponent {
|
|
|
105
67
|
);
|
|
106
68
|
}
|
|
107
69
|
|
|
108
|
-
setMode(
|
|
70
|
+
setMode(newMode) {
|
|
109
71
|
const { onModeChanged } = this.props;
|
|
110
|
-
|
|
72
|
+
const { mode } = this.state;
|
|
73
|
+
|
|
74
|
+
if (mode === newMode) {
|
|
111
75
|
return;
|
|
112
76
|
}
|
|
113
77
|
|
|
@@ -159,7 +123,13 @@ export class ImageGalleryBase extends PureComponent {
|
|
|
159
123
|
}
|
|
160
124
|
|
|
161
125
|
render() {
|
|
162
|
-
const {
|
|
126
|
+
const {
|
|
127
|
+
data,
|
|
128
|
+
renderOverlay,
|
|
129
|
+
renderPlaceholder,
|
|
130
|
+
showNextPage,
|
|
131
|
+
style,
|
|
132
|
+
} = this.props;
|
|
163
133
|
const { selectedIndex, imageSwitchingEnabled } = this.state;
|
|
164
134
|
|
|
165
135
|
return (
|
|
@@ -171,7 +141,7 @@ export class ImageGalleryBase extends PureComponent {
|
|
|
171
141
|
renderPage={this.renderPage}
|
|
172
142
|
bounces
|
|
173
143
|
pageMargin={style.pageMargin}
|
|
174
|
-
showNextPage={
|
|
144
|
+
showNextPage={showNextPage}
|
|
175
145
|
renderOverlay={renderOverlay}
|
|
176
146
|
renderPlaceholder={renderPlaceholder}
|
|
177
147
|
scrollEnabled={imageSwitchingEnabled}
|
|
@@ -180,3 +150,50 @@ export class ImageGalleryBase extends PureComponent {
|
|
|
180
150
|
);
|
|
181
151
|
}
|
|
182
152
|
}
|
|
153
|
+
|
|
154
|
+
ImageGalleryBase.propTypes = {
|
|
155
|
+
// Array containing objects with gallery data (shape defined below)
|
|
156
|
+
data: PropTypes.arrayOf(
|
|
157
|
+
PropTypes.shape({
|
|
158
|
+
description: PropTypes.string,
|
|
159
|
+
source: PropTypes.shape({
|
|
160
|
+
uri: PropTypes.string,
|
|
161
|
+
}),
|
|
162
|
+
title: PropTypes.string,
|
|
163
|
+
}),
|
|
164
|
+
).isRequired,
|
|
165
|
+
// Style prop used to override default (theme) styling
|
|
166
|
+
style: PropTypes.object.isRequired,
|
|
167
|
+
// Renders an overlay over a single image
|
|
168
|
+
// For example image gallery overlay using the `ImageGalleryOverlay` component
|
|
169
|
+
// renderOverlay(imageData, imageIndex)
|
|
170
|
+
renderImageOverlay: PropTypes.func,
|
|
171
|
+
// Renders an overlay over all images
|
|
172
|
+
// For example page indicators using the `PageIndicators` component
|
|
173
|
+
// renderOverlay(imageData, imageIndex)
|
|
174
|
+
renderOverlay: PropTypes.func,
|
|
175
|
+
// Callback function that can be used to define placeholder
|
|
176
|
+
// that appears when content is loading
|
|
177
|
+
renderPlaceholder: PropTypes.func,
|
|
178
|
+
// Initially selected page in gallery
|
|
179
|
+
selectedIndex: PropTypes.number,
|
|
180
|
+
showNextPage: PropTypes.bool,
|
|
181
|
+
// Callback function called when user swipes between pages (images)
|
|
182
|
+
// Index of new (selected) page is passed to this callback
|
|
183
|
+
onIndexSelected: PropTypes.func,
|
|
184
|
+
// onModeChanged(mode), callback function triggered when user taps on single photo
|
|
185
|
+
// Or when user transforms (zooms etc.) image
|
|
186
|
+
// Useful for hiding external controls (i.e. navigation bar)
|
|
187
|
+
// Mode can be `gallery` or `imagePreview`
|
|
188
|
+
onModeChanged: PropTypes.func,
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
ImageGalleryBase.defaultProps = {
|
|
192
|
+
selectedIndex: 0,
|
|
193
|
+
showNextPage: false,
|
|
194
|
+
renderPlaceholder: () => <LoadingIndicator />,
|
|
195
|
+
renderImageOverlay: undefined,
|
|
196
|
+
renderOverlay: undefined,
|
|
197
|
+
onIndexSelected: undefined,
|
|
198
|
+
onModeChanged: undefined,
|
|
199
|
+
};
|
|
@@ -17,12 +17,6 @@ const DESCRIPTION_LENGTH_TRIM_LIMIT = 90;
|
|
|
17
17
|
* a description of an image.
|
|
18
18
|
*/
|
|
19
19
|
class ImageGalleryOverlay extends PureComponent {
|
|
20
|
-
static propTypes = {
|
|
21
|
-
title: PropTypes.string,
|
|
22
|
-
description: PropTypes.string,
|
|
23
|
-
style: PropTypes.object,
|
|
24
|
-
};
|
|
25
|
-
|
|
26
20
|
constructor(props) {
|
|
27
21
|
super(props);
|
|
28
22
|
|
|
@@ -72,7 +66,7 @@ class ImageGalleryOverlay extends PureComponent {
|
|
|
72
66
|
|
|
73
67
|
renderDescription(description) {
|
|
74
68
|
const { style } = this.props;
|
|
75
|
-
const collapsed = this.state
|
|
69
|
+
const { isDescriptionCollapsed: collapsed } = this.state;
|
|
76
70
|
|
|
77
71
|
if (!description) {
|
|
78
72
|
return null;
|
|
@@ -138,6 +132,17 @@ class ImageGalleryOverlay extends PureComponent {
|
|
|
138
132
|
}
|
|
139
133
|
}
|
|
140
134
|
|
|
135
|
+
ImageGalleryOverlay.propTypes = {
|
|
136
|
+
style: PropTypes.object.isRequired,
|
|
137
|
+
description: PropTypes.string,
|
|
138
|
+
title: PropTypes.string,
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
ImageGalleryOverlay.defaultProps = {
|
|
142
|
+
description: undefined,
|
|
143
|
+
title: undefined,
|
|
144
|
+
};
|
|
145
|
+
|
|
141
146
|
const AnimatedOverlay = connectAnimation(ImageGalleryOverlay);
|
|
142
147
|
const StyledOverlay = connectStyle('shoutem.ui.ImageGalleryOverlay', {
|
|
143
148
|
container: {},
|
|
@@ -4,17 +4,10 @@ import autoBindReact from 'auto-bind/react';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { makeZoomable } from '@shoutem/animation';
|
|
6
6
|
import { connectStyle } from '@shoutem/theme';
|
|
7
|
-
import
|
|
7
|
+
import Icon from './Icon/Icon';
|
|
8
8
|
|
|
9
9
|
const ZoomableImage = makeZoomable(Image);
|
|
10
10
|
|
|
11
|
-
const propTypes = {
|
|
12
|
-
width: PropTypes.number,
|
|
13
|
-
height: PropTypes.number,
|
|
14
|
-
source: Image.propTypes.source,
|
|
15
|
-
style: PropTypes.object,
|
|
16
|
-
};
|
|
17
|
-
|
|
18
11
|
const CLOSE_ICON_NAME = 'clear';
|
|
19
12
|
const CLOSE_ICON_SIZE = 25;
|
|
20
13
|
|
|
@@ -27,11 +20,11 @@ class ImagePreview extends PureComponent {
|
|
|
27
20
|
super(props);
|
|
28
21
|
|
|
29
22
|
autoBindReact(this);
|
|
30
|
-
}
|
|
31
23
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
24
|
+
this.state = {
|
|
25
|
+
fullScreen: false,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
35
28
|
|
|
36
29
|
onPressCloseButton() {
|
|
37
30
|
this.setState({
|
|
@@ -47,8 +40,9 @@ class ImagePreview extends PureComponent {
|
|
|
47
40
|
|
|
48
41
|
render() {
|
|
49
42
|
const { source, style, width, height } = this.props;
|
|
43
|
+
const { fullScreen } = this.state;
|
|
50
44
|
|
|
51
|
-
if (
|
|
45
|
+
if (fullScreen) {
|
|
52
46
|
const closeButton = (
|
|
53
47
|
<View style={style.header}>
|
|
54
48
|
<TouchableOpacity
|
|
@@ -90,7 +84,18 @@ class ImagePreview extends PureComponent {
|
|
|
90
84
|
}
|
|
91
85
|
}
|
|
92
86
|
|
|
93
|
-
ImagePreview.propTypes =
|
|
87
|
+
ImagePreview.propTypes = {
|
|
88
|
+
style: PropTypes.object.isRequired,
|
|
89
|
+
height: PropTypes.number,
|
|
90
|
+
source: Image.propTypes.source,
|
|
91
|
+
width: PropTypes.number,
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
ImagePreview.defaultProps = {
|
|
95
|
+
height: undefined,
|
|
96
|
+
source: undefined,
|
|
97
|
+
width: undefined,
|
|
98
|
+
};
|
|
94
99
|
|
|
95
100
|
const StyledImagePreview = connectStyle('shoutem.ui.ImagePreview')(
|
|
96
101
|
ImagePreview,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { PureComponent } from 'react';
|
|
2
|
-
import autoBindReact from 'auto-bind/react';
|
|
3
2
|
import { Animated, ScrollView } from 'react-native';
|
|
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';
|
|
@@ -13,23 +13,11 @@ import { InlineDropDownMenuItem } from './InlineDropDownMenuItem';
|
|
|
13
13
|
const AnimatedIcon = Animated.createAnimatedComponent(Icon);
|
|
14
14
|
|
|
15
15
|
const optionShape = PropTypes.shape({
|
|
16
|
-
title: PropTypes.string.isRequired,
|
|
17
16
|
key: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
|
17
|
+
title: PropTypes.string.isRequired,
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
class InlineDropDownMenu extends PureComponent {
|
|
21
|
-
static propTypes = {
|
|
22
|
-
heading: PropTypes.string,
|
|
23
|
-
selectedDescriptor: PropTypes.string,
|
|
24
|
-
options: PropTypes.arrayOf(optionShape).isRequired,
|
|
25
|
-
onOptionSelected: PropTypes.func,
|
|
26
|
-
selectedOption: optionShape,
|
|
27
|
-
headingStyle: PropTypes.object,
|
|
28
|
-
containerStyle: PropTypes.object,
|
|
29
|
-
selectedOptionContainerStyle: PropTypes.object,
|
|
30
|
-
selectedOptionTextStyle: PropTypes.object,
|
|
31
|
-
};
|
|
32
|
-
|
|
33
21
|
constructor(props) {
|
|
34
22
|
super(props);
|
|
35
23
|
|
|
@@ -128,10 +116,7 @@ class InlineDropDownMenu extends PureComponent {
|
|
|
128
116
|
</View>
|
|
129
117
|
</TouchableOpacity>
|
|
130
118
|
{collapsed && (
|
|
131
|
-
<ScrollView
|
|
132
|
-
data={options}
|
|
133
|
-
contentContainerStyle={style.list}
|
|
134
|
-
>
|
|
119
|
+
<ScrollView data={options} contentContainerStyle={style.list}>
|
|
135
120
|
{_.map(options, (item, index) =>
|
|
136
121
|
this.renderOption({ item, index }),
|
|
137
122
|
)}
|
|
@@ -142,6 +127,30 @@ class InlineDropDownMenu extends PureComponent {
|
|
|
142
127
|
}
|
|
143
128
|
}
|
|
144
129
|
|
|
130
|
+
InlineDropDownMenu.propTypes = {
|
|
131
|
+
options: PropTypes.arrayOf(optionShape).isRequired,
|
|
132
|
+
style: PropTypes.object.isRequired,
|
|
133
|
+
containerStyle: PropTypes.object,
|
|
134
|
+
heading: PropTypes.string,
|
|
135
|
+
headingStyle: PropTypes.object,
|
|
136
|
+
selectedDescriptor: PropTypes.string,
|
|
137
|
+
selectedOption: optionShape,
|
|
138
|
+
selectedOptionContainerStyle: PropTypes.object,
|
|
139
|
+
selectedOptionTextStyle: PropTypes.object,
|
|
140
|
+
onOptionSelected: PropTypes.func,
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
InlineDropDownMenu.defaultProps = {
|
|
144
|
+
heading: undefined,
|
|
145
|
+
headingStyle: undefined,
|
|
146
|
+
containerStyle: undefined,
|
|
147
|
+
selectedDescriptor: undefined,
|
|
148
|
+
selectedOption: undefined,
|
|
149
|
+
selectedOptionContainerStyle: undefined,
|
|
150
|
+
selectedOptionTextStyle: undefined,
|
|
151
|
+
onOptionSelected: undefined,
|
|
152
|
+
};
|
|
153
|
+
|
|
145
154
|
const StyledComponent = connectStyle('shoutem.ui.InlineDropDownMenu')(
|
|
146
155
|
InlineDropDownMenu,
|
|
147
156
|
);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { PureComponent } from 'react';
|
|
2
2
|
import { Animated, Dimensions, Pressable } from 'react-native';
|
|
3
3
|
import autoBindReact from 'auto-bind/react';
|
|
4
|
-
import _ from 'lodash';
|
|
5
4
|
import PropTypes from 'prop-types';
|
|
6
5
|
import { connectStyle } from '@shoutem/theme';
|
|
7
6
|
import { Text } from '../Text';
|
|
@@ -10,14 +9,6 @@ const window = Dimensions.get('window');
|
|
|
10
9
|
const AnimatedPressable = Animated.createAnimatedComponent(Pressable);
|
|
11
10
|
|
|
12
11
|
class InlineDropDownMenuItem extends PureComponent {
|
|
13
|
-
static propTypes = {
|
|
14
|
-
item: PropTypes.object,
|
|
15
|
-
index: PropTypes.number,
|
|
16
|
-
selectedDescriptor: PropTypes.string,
|
|
17
|
-
onItemPressed: PropTypes.func,
|
|
18
|
-
isSelected: PropTypes.bool,
|
|
19
|
-
};
|
|
20
|
-
|
|
21
12
|
constructor(props) {
|
|
22
13
|
super(props);
|
|
23
14
|
|
|
@@ -76,6 +67,23 @@ class InlineDropDownMenuItem extends PureComponent {
|
|
|
76
67
|
}
|
|
77
68
|
}
|
|
78
69
|
|
|
70
|
+
InlineDropDownMenuItem.propTypes = {
|
|
71
|
+
style: PropTypes.isRequired,
|
|
72
|
+
index: PropTypes.number,
|
|
73
|
+
isSelected: PropTypes.bool,
|
|
74
|
+
item: PropTypes.object,
|
|
75
|
+
selectedDescriptor: PropTypes.string,
|
|
76
|
+
onItemPressed: PropTypes.func,
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
InlineDropDownMenuItem.defaultProps = {
|
|
80
|
+
index: undefined,
|
|
81
|
+
isSelected: false,
|
|
82
|
+
item: undefined,
|
|
83
|
+
selectedDescriptor: undefined,
|
|
84
|
+
onItemPressed: undefined,
|
|
85
|
+
};
|
|
86
|
+
|
|
79
87
|
const StyledComponent = connectStyle('shoutem.ui.InlineDropDownMenuItem')(
|
|
80
88
|
InlineDropDownMenuItem,
|
|
81
89
|
);
|
|
@@ -10,48 +10,16 @@ import { TouchableOpacity } from './TouchableOpacity';
|
|
|
10
10
|
import { View } from './View';
|
|
11
11
|
|
|
12
12
|
class InlineGallery extends PureComponent {
|
|
13
|
-
static propTypes = {
|
|
14
|
-
// Array containing objects with image data (shape defined below)
|
|
15
|
-
data: PropTypes.arrayOf(
|
|
16
|
-
PropTypes.shape({
|
|
17
|
-
source: PropTypes.shape({
|
|
18
|
-
uri: PropTypes.string,
|
|
19
|
-
}),
|
|
20
|
-
}),
|
|
21
|
-
).isRequired,
|
|
22
|
-
// Callback function called when user taps on single item (image) in gallery
|
|
23
|
-
onPress: PropTypes.func,
|
|
24
|
-
// Callback function called when user swipes between pages (images)
|
|
25
|
-
// Index of new (selected) page is passed to this callback
|
|
26
|
-
onIndexSelected: PropTypes.func,
|
|
27
|
-
// Initially selected page in gallery
|
|
28
|
-
selectedIndex: PropTypes.number,
|
|
29
|
-
// Style, applied to Image component
|
|
30
|
-
style: PropTypes.object,
|
|
31
|
-
// Prop that reduces page size by pageMargin, allowing 'sneak peak' of next page
|
|
32
|
-
// Defaults to false
|
|
33
|
-
showNextPage: PropTypes.bool,
|
|
34
|
-
// Callback function that can be used to render overlay over pages
|
|
35
|
-
// For example page indicators using `PageIndicators` component
|
|
36
|
-
// renderOverlay(imageData, imageIndex)
|
|
37
|
-
renderOverlay: PropTypes.func,
|
|
38
|
-
// Callback function that can be used to define placeholder
|
|
39
|
-
// that appears when content is loading
|
|
40
|
-
renderPlaceholder: PropTypes.func,
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
static defaultProps = {
|
|
44
|
-
renderPlaceholder: () => <LoadingIndicator />,
|
|
45
|
-
};
|
|
46
|
-
|
|
47
13
|
constructor(props) {
|
|
48
14
|
super(props);
|
|
49
15
|
|
|
50
16
|
autoBindReact(this);
|
|
51
17
|
|
|
18
|
+
const { showNextPage } = props;
|
|
19
|
+
|
|
52
20
|
this.state = {
|
|
53
21
|
selectedIndex: 0,
|
|
54
|
-
showNextPage
|
|
22
|
+
showNextPage,
|
|
55
23
|
};
|
|
56
24
|
}
|
|
57
25
|
|
|
@@ -125,6 +93,45 @@ class InlineGallery extends PureComponent {
|
|
|
125
93
|
}
|
|
126
94
|
}
|
|
127
95
|
|
|
96
|
+
InlineGallery.propTypes = {
|
|
97
|
+
// Array containing objects with image data (shape defined below)
|
|
98
|
+
data: PropTypes.arrayOf(
|
|
99
|
+
PropTypes.shape({
|
|
100
|
+
source: PropTypes.shape({
|
|
101
|
+
uri: PropTypes.string,
|
|
102
|
+
}),
|
|
103
|
+
}),
|
|
104
|
+
).isRequired,
|
|
105
|
+
// Style, applied to Image component
|
|
106
|
+
style: PropTypes.object.isRequired,
|
|
107
|
+
// Callback function that can be used to render overlay over pages
|
|
108
|
+
// For example page indicators using `PageIndicators` component
|
|
109
|
+
// renderOverlay(imageData, imageIndex)
|
|
110
|
+
renderOverlay: PropTypes.func,
|
|
111
|
+
// Callback function that can be used to define placeholder
|
|
112
|
+
// that appears when content is loading
|
|
113
|
+
renderPlaceholder: PropTypes.func,
|
|
114
|
+
// Initially selected page in gallery
|
|
115
|
+
selectedIndex: PropTypes.number,
|
|
116
|
+
// Prop that reduces page size by pageMargin, allowing 'sneak peak' of next page
|
|
117
|
+
// Defaults to false
|
|
118
|
+
showNextPage: PropTypes.bool,
|
|
119
|
+
// Callback function called when user swipes between pages (images)
|
|
120
|
+
// Index of new (selected) page is passed to this callback
|
|
121
|
+
onIndexSelected: PropTypes.func,
|
|
122
|
+
// Callback function called when user taps on single item (image) in gallery
|
|
123
|
+
onPress: PropTypes.func,
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
InlineGallery.defaultProps = {
|
|
127
|
+
renderPlaceholder: () => <LoadingIndicator />,
|
|
128
|
+
renderOverlay: undefined,
|
|
129
|
+
selectedIndex: undefined,
|
|
130
|
+
showNextPage: false,
|
|
131
|
+
onIndexSelected: undefined,
|
|
132
|
+
onPress: undefined,
|
|
133
|
+
};
|
|
134
|
+
|
|
128
135
|
const StyledInlineGallery = connectStyle('shoutem.ui.InlineGallery')(
|
|
129
136
|
InlineGallery,
|
|
130
137
|
);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { PureComponent } from 'react';
|
|
2
2
|
import RNLinearGradient from 'react-native-linear-gradient';
|
|
3
3
|
import _ from 'lodash';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
4
5
|
import { connectAnimation } from '@shoutem/animation';
|
|
5
6
|
import { connectStyle } from '@shoutem/theme';
|
|
6
7
|
|
|
@@ -8,22 +9,31 @@ const RNLinearGradientPropsKeys = ['start', 'end', 'colors', 'locations'];
|
|
|
8
9
|
|
|
9
10
|
class LinearGradient extends PureComponent {
|
|
10
11
|
render() {
|
|
11
|
-
const {
|
|
12
|
+
const { children, style } = this.props;
|
|
12
13
|
|
|
13
|
-
const styleWithOmissions = _.omit(
|
|
14
|
+
const styleWithOmissions = _.omit(style, RNLinearGradientPropsKeys);
|
|
14
15
|
const linearGradientProps = {
|
|
15
|
-
...props,
|
|
16
|
-
..._.pick(
|
|
16
|
+
...this.props,
|
|
17
|
+
..._.pick(style, RNLinearGradientPropsKeys),
|
|
17
18
|
};
|
|
18
19
|
|
|
19
20
|
return (
|
|
20
21
|
<RNLinearGradient {...linearGradientProps} style={styleWithOmissions}>
|
|
21
|
-
{
|
|
22
|
+
{children}
|
|
22
23
|
</RNLinearGradient>
|
|
23
24
|
);
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
27
|
|
|
28
|
+
LinearGradient.propTypes = {
|
|
29
|
+
style: PropTypes.object.isRequired,
|
|
30
|
+
children: PropTypes.node,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
LinearGradient.defaultProps = {
|
|
34
|
+
children: undefined,
|
|
35
|
+
};
|
|
36
|
+
|
|
27
37
|
const AnimatedLinearGradient = connectAnimation(LinearGradient);
|
|
28
38
|
const StyledLinearGradient = connectStyle('shoutem.ui.LinearGradient')(
|
|
29
39
|
AnimatedLinearGradient,
|
package/components/ListView.js
CHANGED
|
@@ -152,11 +152,6 @@ class ListView extends PureComponent {
|
|
|
152
152
|
// data to display
|
|
153
153
|
mappedProps.data = data;
|
|
154
154
|
|
|
155
|
-
// key extractor
|
|
156
|
-
if (!keyExtractor) {
|
|
157
|
-
mappedProps.keyExtractor = (item, index) => index.toString();
|
|
158
|
-
}
|
|
159
|
-
|
|
160
155
|
// sections for SectionList
|
|
161
156
|
if (sections) {
|
|
162
157
|
mappedProps.sections = sections;
|
|
@@ -351,6 +346,7 @@ class ListView extends PureComponent {
|
|
|
351
346
|
}
|
|
352
347
|
|
|
353
348
|
ListView.propTypes = {
|
|
349
|
+
style: PropTypes.object.isRequired,
|
|
354
350
|
autoHideHeader: PropTypes.bool,
|
|
355
351
|
contentContainerStyle: PropTypes.object,
|
|
356
352
|
data: PropTypes.array,
|
|
@@ -368,7 +364,6 @@ ListView.propTypes = {
|
|
|
368
364
|
renderSectionHeader: PropTypes.func,
|
|
369
365
|
scrollDriver: PropTypes.object,
|
|
370
366
|
sections: PropTypes.array,
|
|
371
|
-
style: PropTypes.object,
|
|
372
367
|
onLoadMore: PropTypes.func,
|
|
373
368
|
onLoadMoreThreshold: PropTypes.number,
|
|
374
369
|
onRefresh: PropTypes.func,
|
|
@@ -392,7 +387,6 @@ ListView.defaultProps = {
|
|
|
392
387
|
renderSectionHeader: undefined,
|
|
393
388
|
scrollDriver: undefined,
|
|
394
389
|
sections: undefined,
|
|
395
|
-
style: {},
|
|
396
390
|
onLoadMore: undefined,
|
|
397
391
|
onLoadMoreThreshold: 0.5,
|
|
398
392
|
onRefresh: undefined,
|
|
@@ -55,6 +55,7 @@ function LoadingContainer({
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
LoadingContainer.propTypes = {
|
|
58
|
+
style: PropTypes.object.isRequired,
|
|
58
59
|
animation: PropTypes.object,
|
|
59
60
|
animationScale: PropTypes.number,
|
|
60
61
|
children: PropTypes.oneOfType([
|
|
@@ -63,7 +64,6 @@ LoadingContainer.propTypes = {
|
|
|
63
64
|
PropTypes.node,
|
|
64
65
|
]),
|
|
65
66
|
loading: PropTypes.bool,
|
|
66
|
-
style: PropTypes.object,
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
LoadingContainer.defaultProps = {
|
|
@@ -71,7 +71,6 @@ LoadingContainer.defaultProps = {
|
|
|
71
71
|
children: undefined,
|
|
72
72
|
animation: animations.loadingDots,
|
|
73
73
|
loading: false,
|
|
74
|
-
style: {},
|
|
75
74
|
};
|
|
76
75
|
|
|
77
76
|
const StyledLoadingContainer = connectStyle('shoutem.ui.LoadingContainer')(
|