@shoutem/ui 5.1.0 → 5.2.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.
Files changed (67) hide show
  1. package/components/ActionSheet/ActionSheet.js +15 -8
  2. package/components/ActionSheet/ActionSheetOption.js +7 -2
  3. package/components/Button.js +5 -9
  4. package/components/CategoryPicker/Category.js +45 -0
  5. package/components/CategoryPicker/CategoryPicker.js +62 -0
  6. package/components/CategoryPicker/index.js +1 -0
  7. package/components/CategoryPicker/shapes.js +7 -0
  8. package/components/DateTimePicker.js +4 -1
  9. package/components/DropDownMenu/DropDownMenu.js +20 -23
  10. package/components/DropDownMenu/DropDownModal.js +56 -54
  11. package/components/EmptyStateView.js +16 -12
  12. package/components/FormGroup.js +7 -1
  13. package/components/GridRow.js +1 -1
  14. package/components/HorizontalPager/HorizontalPager.js +61 -49
  15. package/components/HorizontalPager/Page.js +12 -7
  16. package/components/Icon/Icon.js +1 -1
  17. package/components/Image.js +4 -4
  18. package/components/ImageBackground.js +4 -4
  19. package/components/ImageGallery/ImageGallery.android.js +8 -0
  20. package/components/ImageGallery/ImageGallery.ios.js +8 -0
  21. package/components/ImageGallery/ImageGalleryBase.js +65 -48
  22. package/components/ImageGalleryOverlay.js +12 -7
  23. package/components/ImagePreview.js +19 -14
  24. package/components/InlineDropDownMenu/InlineDropDownMenu.js +27 -18
  25. package/components/InlineDropDownMenu/InlineDropDownMenuItem.js +17 -9
  26. package/components/InlineGallery.js +42 -35
  27. package/components/LinearGradient.js +15 -5
  28. package/components/ListView.js +1 -2
  29. package/components/LoadingContainer.js +1 -2
  30. package/components/NavigationBar/NavigationBar.js +18 -13
  31. package/components/NumberInput.js +32 -24
  32. package/components/PageIndicators.js +19 -17
  33. package/components/ScrollView/ScrollDriverProvider.js +20 -10
  34. package/components/ScrollView/ScrollView.js +15 -13
  35. package/components/SearchField.js +24 -18
  36. package/components/ShareButton.js +21 -11
  37. package/components/Spinner.js +1 -1
  38. package/components/Switch.js +19 -14
  39. package/components/TabMenu/TabMenu.js +12 -7
  40. package/components/TabMenu/TabMenuItem.js +13 -7
  41. package/components/TextInput.js +3 -1
  42. package/components/Touchable.js +19 -23
  43. package/components/TouchableNativeFeedback.js +15 -21
  44. package/components/TouchableOpacity.js +6 -12
  45. package/components/Video/Video.js +21 -25
  46. package/components/View.js +7 -9
  47. package/components/YearRangePicker/YearRangePicker.js +22 -17
  48. package/components/YearRangePicker/YearRangePickerButton.js +13 -7
  49. package/components/YearRangePicker/YearRangePickerModal.js +23 -16
  50. package/examples/components/NavigationBars.js +4 -0
  51. package/examples/components/Stage.js +6 -1
  52. package/html/Html.js +14 -8
  53. package/html/components/Gallery.js +9 -5
  54. package/html/components/Image.js +16 -16
  55. package/html/components/SimpleHtml.js +19 -10
  56. package/html/elements/A.js +11 -6
  57. package/html/elements/Inline.js +13 -14
  58. package/html/elements/Text.js +6 -0
  59. package/html/elements/Video.js +3 -1
  60. package/html/elements/list/Li.js +0 -2
  61. package/html/elements/list/Ol.js +4 -0
  62. package/html/elements/list/Ul.js +4 -0
  63. package/html/elements/list/prefix/Bullet.js +4 -0
  64. package/html/elements/list/prefix/Number.js +6 -1
  65. package/index.js +42 -54
  66. package/package.json +1 -1
  67. package/theme.js +51 -0
@@ -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: this.props.selectedIndex || 0,
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(mode) {
70
+ setMode(newMode) {
109
71
  const { onModeChanged } = this.props;
110
- if (this.state.mode === mode) {
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 { data, renderOverlay, renderPlaceholder, style } = this.props;
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={false}
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.isDescriptionCollapsed;
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 { Icon } from './Icon/Icon';
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
- state = {
33
- fullScreen: false,
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 (this.state.fullScreen) {
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 = 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: this.props.showNextPage || false,
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 { props } = this;
12
+ const { children, style } = this.props;
12
13
 
13
- const styleWithOmissions = _.omit(props.style, RNLinearGradientPropsKeys);
14
+ const styleWithOmissions = _.omit(style, RNLinearGradientPropsKeys);
14
15
  const linearGradientProps = {
15
- ...props,
16
- ..._.pick(props.style, RNLinearGradientPropsKeys),
16
+ ...this.props,
17
+ ..._.pick(style, RNLinearGradientPropsKeys),
17
18
  };
18
19
 
19
20
  return (
20
21
  <RNLinearGradient {...linearGradientProps} style={styleWithOmissions}>
21
- {props.children}
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,
@@ -346,6 +346,7 @@ class ListView extends PureComponent {
346
346
  }
347
347
 
348
348
  ListView.propTypes = {
349
+ style: PropTypes.object.isRequired,
349
350
  autoHideHeader: PropTypes.bool,
350
351
  contentContainerStyle: PropTypes.object,
351
352
  data: PropTypes.array,
@@ -363,7 +364,6 @@ ListView.propTypes = {
363
364
  renderSectionHeader: PropTypes.func,
364
365
  scrollDriver: PropTypes.object,
365
366
  sections: PropTypes.array,
366
- style: PropTypes.object,
367
367
  onLoadMore: PropTypes.func,
368
368
  onLoadMoreThreshold: PropTypes.number,
369
369
  onRefresh: PropTypes.func,
@@ -387,7 +387,6 @@ ListView.defaultProps = {
387
387
  renderSectionHeader: undefined,
388
388
  scrollDriver: undefined,
389
389
  sections: undefined,
390
- style: {},
391
390
  onLoadMore: undefined,
392
391
  onLoadMoreThreshold: 0.5,
393
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')(
@@ -20,19 +20,6 @@ function getBackgroundColor(style) {
20
20
 
21
21
  // eslint-disable-next-line react/prefer-stateless-function
22
22
  class NavigationBar extends PureComponent {
23
- static propTypes = {
24
- leftComponent: PropTypes.node,
25
- centerComponent: PropTypes.node,
26
- rightComponent: PropTypes.node,
27
- style: PropTypes.object,
28
- id: PropTypes.string,
29
- statusBarColor: PropTypes.string,
30
- };
31
-
32
- static defaultProps = {
33
- id: 'default',
34
- };
35
-
36
23
  setStatusBarStyle(backgroundColor) {
37
24
  function chooseBarStyle(bgColor) {
38
25
  return color(bgColor).isDark() ? 'light-content' : 'default';
@@ -100,6 +87,24 @@ class NavigationBar extends PureComponent {
100
87
  }
101
88
  }
102
89
 
90
+ NavigationBar.propTypes = {
91
+ style: PropTypes.object.isRequired,
92
+ centerComponent: PropTypes.node,
93
+ id: PropTypes.string,
94
+ leftComponent: PropTypes.node,
95
+ rightComponent: PropTypes.node,
96
+ // eslint-disable-next-line react/no-unused-prop-types
97
+ statusBarColor: PropTypes.string,
98
+ };
99
+
100
+ NavigationBar.defaultProps = {
101
+ id: 'default',
102
+ leftComponent: undefined,
103
+ centerComponent: undefined,
104
+ rightComponent: undefined,
105
+ statusBarColor: undefined,
106
+ };
107
+
103
108
  const AnimatedNavigationBar = connectAnimation(composeChildren(NavigationBar));
104
109
  const StyledNavigationBar = connectStyle('shoutem.ui.NavigationBar')(
105
110
  AnimatedNavigationBar,