@shoutem/ui 4.6.6-rc.1 → 4.8.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.
Files changed (73) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -2
  3. package/components/ActionSheet/ActionSheet.js +6 -6
  4. package/components/DateTimePicker.js +2 -2
  5. package/components/DropDownMenu/DropDownMenu.js +1 -1
  6. package/components/DropDownMenu/DropDownModal.js +2 -2
  7. package/components/EmptyListImage.js +9 -5
  8. package/components/FormGroup.js +0 -1
  9. package/components/GridRow.js +2 -2
  10. package/components/HorizontalPager/HorizontalPager.js +2 -2
  11. package/components/Icon/services/icons.js +0 -2
  12. package/components/Icon/services/index.js +1 -1
  13. package/components/Image.js +1 -1
  14. package/components/ImageBackground.js +1 -1
  15. package/components/ImageGallery/ImageGallery.android.js +1 -0
  16. package/components/ImageGallery/ImageGallery.ios.js +2 -1
  17. package/components/ImageGalleryOverlay.js +1 -1
  18. package/components/ImagePreview.js +2 -2
  19. package/components/InlineDropDownMenu/InlineDropDownMenu.js +24 -27
  20. package/components/InlineDropDownMenu/InlineDropDownMenuItem.js +13 -14
  21. package/components/ListView.js +71 -32
  22. package/components/LoadingIndicator.js +1 -1
  23. package/components/NavigationBar/NavigationBar.js +3 -7
  24. package/components/NavigationBar/NavigationBarAnimations.js +1 -1
  25. package/components/ScrollView/ScrollDriverProvider.js +23 -3
  26. package/components/ScrollView/ScrollView.js +10 -8
  27. package/components/ShareButton.js +1 -1
  28. package/components/Spinner.js +1 -1
  29. package/components/Switch.js +2 -2
  30. package/components/TabMenu/TabMenu.js +2 -2
  31. package/components/TabMenu/TabMenuItem.js +7 -4
  32. package/components/Text.js +2 -2
  33. package/components/TextInput.js +2 -2
  34. package/components/Tile.js +1 -1
  35. package/components/Touchable.js +2 -2
  36. package/components/TouchableNativeFeedback.js +2 -2
  37. package/components/TouchableOpacity.js +1 -1
  38. package/components/Video/Video.js +1 -1
  39. package/components/Video/VideoSourceReader.js +2 -1
  40. package/components/View.js +1 -1
  41. package/components/YearRangePicker/YearRangePicker.js +10 -4
  42. package/components/YearRangePicker/YearRangePickerButton.js +27 -39
  43. package/components/YearRangePicker/YearRangePickerModal.js +68 -38
  44. package/examples/components/Cards.js +1 -1
  45. package/examples/components/DropDownMenus.js +8 -8
  46. package/examples/components/Examples.js +1 -1
  47. package/examples/components/FormComponents.js +1 -1
  48. package/examples/components/Headers.js +1 -1
  49. package/examples/components/NavigationBars.js +4 -4
  50. package/examples/components/Rows.js +1 -1
  51. package/examples/components/Stage.js +1 -1
  52. package/examples/components/Tiles.js +1 -1
  53. package/examples/components/Typography.js +1 -1
  54. package/examples/components/Videos.js +3 -3
  55. package/helpers/device-selector.js +11 -3
  56. package/helpers/keyboard.js +2 -3
  57. package/html/Html.js +3 -3
  58. package/html/components/Image.js +1 -1
  59. package/html/components/SimpleHtml.js +9 -9
  60. package/html/elements/A.js +3 -3
  61. package/html/elements/Block.js +2 -2
  62. package/html/elements/Img.js +1 -1
  63. package/html/elements/Inline.js +5 -5
  64. package/html/elements/Text.js +2 -2
  65. package/html/elements/list/Ol.js +1 -1
  66. package/html/elements/list/Ul.js +1 -1
  67. package/html/elements/list/index.js +4 -4
  68. package/html/index.js +33 -33
  69. package/html/services/ElementRegistry.js +1 -1
  70. package/html/services/HtmlParser.js +2 -1
  71. package/package.json +40 -30
  72. package/scripts/add-native-deps.js +0 -1
  73. package/theme.js +10 -12
@@ -1,12 +1,12 @@
1
1
  import React, { PureComponent } from 'react';
2
+ import { Animated } from 'react-native';
2
3
  import autoBindReact from 'auto-bind/react';
3
4
  import _ from 'lodash';
4
5
  import PropTypes from 'prop-types';
5
- import { Animated } from 'react-native';
6
- import { ScrollDriver, DriverShape } from '@shoutem/animation';
6
+ import { DriverShape, ScrollDriver } from '@shoutem/animation';
7
7
  import { connectStyle } from '@shoutem/theme';
8
- import { ScrollDriverProvider } from './ScrollDriverProvider.js';
9
8
  import { Device } from '../../helpers';
9
+ import { ScrollDriverProvider } from './ScrollDriverProvider.js';
10
10
 
11
11
  const isTabBarOnScreen = true;
12
12
  const IPHONE_X_HOME_INDICATOR_PADDING = isTabBarOnScreen ? 0 : 34;
@@ -14,6 +14,7 @@ const IPHONE_X_HOME_INDICATOR_PADDING = isTabBarOnScreen ? 0 : 34;
14
14
  class ScrollView extends PureComponent {
15
15
  static propTypes = {
16
16
  ...Animated.ScrollView.propTypes,
17
+ primary: PropTypes.bool,
17
18
  };
18
19
 
19
20
  static contextTypes = {
@@ -33,7 +34,11 @@ class ScrollView extends PureComponent {
33
34
  autoBindReact(this);
34
35
 
35
36
  this.animationDriver =
36
- props.driver || new ScrollDriver({ useNativeDriver: true });
37
+ props.driver ||
38
+ new ScrollDriver(
39
+ { useNativeDriver: true, nativeScrollEventThrottle: 20 },
40
+ props.onScroll,
41
+ );
37
42
  }
38
43
 
39
44
  getChildContext() {
@@ -53,12 +58,9 @@ class ScrollView extends PureComponent {
53
58
 
54
59
  componentDidUpdate() {
55
60
  const { driver } = this.props;
56
- const { animationDriver } = this.context;
57
61
 
58
62
  if (driver && this.animationDriver !== driver) {
59
63
  this.animationDriver = driver;
60
- } else if (animationDriver && this.animationDriver !== animationDriver) {
61
- this.animationDriver = animationDriver;
62
64
  }
63
65
  }
64
66
 
@@ -92,7 +94,7 @@ class ScrollView extends PureComponent {
92
94
  ref={this.setWrappedInstance}
93
95
  contentContainerStyle={this.addIphoneXPadding(contentContainerStyle)}
94
96
  {...animationDriver.scrollViewProps}
95
- {...props}
97
+ {..._.omit(props, 'onScroll')}
96
98
  />
97
99
  );
98
100
  }
@@ -1,7 +1,7 @@
1
1
  import React, { PureComponent } from 'react';
2
+ import { Platform, Share } from 'react-native';
2
3
  import autoBindReact from 'auto-bind/react';
3
4
  import PropTypes from 'prop-types';
4
- import { Share, Platform } from 'react-native';
5
5
  import { connectStyle } from '@shoutem/theme';
6
6
  import { Button } from './Button';
7
7
  import { Icon } from './Icon';
@@ -1,6 +1,6 @@
1
1
  import React, { PureComponent } from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import { ActivityIndicator } from 'react-native';
3
+ import PropTypes from 'prop-types';
4
4
  import { connectStyle } from '@shoutem/theme';
5
5
 
6
6
  class Spinner extends PureComponent {
@@ -1,7 +1,7 @@
1
- import PropTypes from 'prop-types';
2
- import autoBindReact from 'auto-bind/react';
3
1
  import React, { PureComponent } from 'react';
4
2
  import { TouchableWithoutFeedback } from 'react-native';
3
+ import autoBindReact from 'auto-bind/react';
4
+ import PropTypes from 'prop-types';
5
5
  import { connectAnimation, TimingDriver } from '@shoutem/animation';
6
6
  import { connectStyle } from '@shoutem/theme';
7
7
  import { View } from './View';
@@ -1,8 +1,8 @@
1
1
  import React, { PureComponent } from 'react';
2
- import PropTypes from 'prop-types';
2
+ import { LayoutAnimation, ScrollView } from 'react-native';
3
3
  import autoBindReact from 'auto-bind/react';
4
4
  import _ from 'lodash';
5
- import { ScrollView, LayoutAnimation } from 'react-native';
5
+ import PropTypes from 'prop-types';
6
6
  import { connectStyle } from '@shoutem/theme';
7
7
  import { optionShape } from './const';
8
8
  import { TabMenuItem } from './TabMenuItem';
@@ -1,12 +1,12 @@
1
1
  import React, { PureComponent } from 'react';
2
2
  import { LayoutAnimation } from 'react-native';
3
- import PropTypes from 'prop-types';
4
3
  import autoBindReact from 'auto-bind/react';
5
4
  import _ from 'lodash';
5
+ import PropTypes from 'prop-types';
6
6
  import { connectStyle } from '@shoutem/theme';
7
7
  import { Text } from '../Text';
8
- import { View } from '../View';
9
8
  import { TouchableOpacity } from '../TouchableOpacity';
9
+ import { View } from '../View';
10
10
  import { optionShape } from './const';
11
11
 
12
12
  class TabMenuItem extends PureComponent {
@@ -33,8 +33,11 @@ class TabMenuItem extends PureComponent {
33
33
  onItemPressed(item);
34
34
  }
35
35
 
36
- handleLayout({ nativeEvent: { layout: { width } } }) {
37
-
36
+ handleLayout({
37
+ nativeEvent: {
38
+ layout: { width },
39
+ },
40
+ }) {
38
41
  LayoutAnimation.easeInEaseOut();
39
42
  this.setState({ baseWidth: width });
40
43
  }
@@ -1,7 +1,7 @@
1
1
  import React, { PureComponent } from 'react';
2
2
  import { Text as RNText } from 'react-native';
3
- import { connectStyle } from '@shoutem/theme';
4
3
  import { connectAnimation } from '@shoutem/animation';
4
+ import { connectStyle } from '@shoutem/theme';
5
5
 
6
6
  class Text extends PureComponent {
7
7
  render() {
@@ -20,4 +20,4 @@ const Title = connectStyle('shoutem.ui.Title')(AnimatedText);
20
20
  const Subtitle = connectStyle('shoutem.ui.Subtitle')(AnimatedText);
21
21
  const Caption = connectStyle('shoutem.ui.Caption')(AnimatedText);
22
22
 
23
- export { StyledText as Text, Heading, Title, Subtitle, Caption };
23
+ export { Caption, Heading, Subtitle, StyledText as Text, Title };
@@ -1,7 +1,7 @@
1
1
  import React, { PureComponent } from 'react';
2
+ import { TextInput as RNTextInput } from 'react-native';
2
3
  import autoBindReact from 'auto-bind/react';
3
4
  import PropTypes from 'prop-types';
4
- import { TextInput as RNTextInput } from 'react-native';
5
5
  import { connectAnimation, Wiggle } from '@shoutem/animation';
6
6
  import { connectStyle } from '@shoutem/theme';
7
7
  import { Caption } from './Text';
@@ -63,7 +63,7 @@ class TextInput extends PureComponent {
63
63
  style={{
64
64
  ...otherStyle,
65
65
  ...(hasBorder ? withBorder : withoutBorder),
66
- ...(!!errorMessage ? errorBorderColor : {}),
66
+ ...(errorMessage ? errorBorderColor : {}),
67
67
  }}
68
68
  />
69
69
  </Wiggle>
@@ -1,6 +1,6 @@
1
1
  import { View } from 'react-native';
2
- import { connectStyle } from '@shoutem/theme';
3
2
  import { connectAnimation } from '@shoutem/animation';
3
+ import { connectStyle } from '@shoutem/theme';
4
4
 
5
5
  const AnimatedTile = connectAnimation(View);
6
6
  const Tile = connectStyle('shoutem.ui.Tile')(AnimatedTile);
@@ -1,6 +1,6 @@
1
1
  import React, { PureComponent } from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import { Platform } from 'react-native';
3
+ import PropTypes from 'prop-types';
4
4
  import { connectStyle } from '@shoutem/theme';
5
5
  import { TouchableNativeFeedback } from './TouchableNativeFeedback';
6
6
  import { TouchableOpacity } from './TouchableOpacity';
@@ -21,7 +21,7 @@ class Touchable extends PureComponent {
21
21
  };
22
22
 
23
23
  render() {
24
- const props = this.props;
24
+ const { props } = this;
25
25
  const style = { ...props.style };
26
26
  delete style.touchableOpacity;
27
27
  delete style.touchableNativeFeedback;
@@ -1,6 +1,6 @@
1
1
  import React, { PureComponent } from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import { TouchableNativeFeedback as RNTouchableNativeFeedback } from 'react-native';
3
+ import PropTypes from 'prop-types';
4
4
  import { connectStyle } from '@shoutem/theme';
5
5
 
6
6
  class TouchableNativeFeedback extends PureComponent {
@@ -13,7 +13,7 @@ class TouchableNativeFeedback extends PureComponent {
13
13
  };
14
14
 
15
15
  render() {
16
- const props = this.props;
16
+ const { props } = this;
17
17
  // Remove the props that are not valid
18
18
  // style keys.
19
19
  const style = {
@@ -4,7 +4,7 @@ import { connectStyle } from '@shoutem/theme';
4
4
 
5
5
  class TouchableOpacity extends PureComponent {
6
6
  render() {
7
- const props = this.props;
7
+ const { props } = this;
8
8
 
9
9
  // The activeOpacity is not a valid RN style
10
10
  // property, so we have to unset it here.
@@ -1,7 +1,7 @@
1
1
  import React, { PureComponent } from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import { View } from 'react-native';
4
3
  import { WebView } from 'react-native-webview';
4
+ import PropTypes from 'prop-types';
5
5
  import { connectAnimation } from '@shoutem/animation';
6
6
  import { connectStyle } from '@shoutem/theme';
7
7
  import VideoSourceReader from './VideoSourceReader';
@@ -58,7 +58,8 @@ export default class VideoSourceReader {
58
58
  getYouTubeVideoId(this.source),
59
59
  this.playerParams,
60
60
  );
61
- } else if (this.isVimeo) {
61
+ }
62
+ if (this.isVimeo) {
62
63
  return getVimeoEmbedUrl(getVimeoVideoId(this.source));
63
64
  }
64
65
 
@@ -1,6 +1,6 @@
1
1
  import React, { PureComponent } from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import { View as RNView, ViewPropTypes } from 'react-native';
3
+ import PropTypes from 'prop-types';
4
4
  import { connectAnimation } from '@shoutem/animation';
5
5
  import { connectStyle } from '@shoutem/theme';
6
6
  import { LinearGradient } from './LinearGradient';
@@ -1,7 +1,7 @@
1
1
  import React, { PureComponent } from 'react';
2
- import PropTypes from 'prop-types';
3
- import _ from 'lodash';
4
2
  import autoBindReact from 'auto-bind/react';
3
+ import _ from 'lodash';
4
+ import PropTypes from 'prop-types';
5
5
  import { connectStyle } from '@shoutem/theme';
6
6
  import { View } from '../View';
7
7
  import YearPickerButton from './YearRangePickerButton';
@@ -79,14 +79,20 @@ class YearRangePicker extends PureComponent {
79
79
  }
80
80
 
81
81
  render() {
82
- const { rangeEnd, rangeStart, resetButtonTitle, confirmButtonTitle } = this.props;
82
+ const {
83
+ rangeEnd,
84
+ rangeStart,
85
+ resetButtonTitle,
86
+ confirmButtonTitle,
87
+ } = this.props;
83
88
  const { buttonTooltip, collapsed } = this.state;
84
89
 
85
90
  return (
86
- <View onLayout={this.handleLayout}>
91
+ <View>
87
92
  <YearPickerButton
88
93
  tooltip={buttonTooltip}
89
94
  onPress={this.handleButtonPressed}
95
+ collapsed={collapsed}
90
96
  />
91
97
  <YearPickerModal
92
98
  visible={collapsed}
@@ -1,12 +1,11 @@
1
1
  import React, { PureComponent } from 'react';
2
2
  import { Animated } from 'react-native';
3
- import PropTypes from 'prop-types';
4
- import _ from 'lodash';
5
3
  import autoBindReact from 'auto-bind/react';
4
+ import PropTypes from 'prop-types';
6
5
  import { connectStyle } from '@shoutem/theme';
7
- import { TouchableOpacity } from '../TouchableOpacity';
8
6
  import { Icon } from '../Icon';
9
7
  import { Text } from '../Text';
8
+ import { TouchableOpacity } from '../TouchableOpacity';
10
9
 
11
10
  const AnimatedIcon = Animated.createAnimatedComponent(Icon);
12
11
 
@@ -14,6 +13,7 @@ class YearRangePickerButton extends PureComponent {
14
13
  static propTypes = {
15
14
  onPress: PropTypes.func,
16
15
  tooltip: PropTypes.string,
16
+ collapsed: PropTypes.bool,
17
17
  style: PropTypes.any,
18
18
  };
19
19
 
@@ -23,55 +23,41 @@ class YearRangePickerButton extends PureComponent {
23
23
  autoBindReact(this);
24
24
 
25
25
  this.dropDownIconValue = new Animated.Value(0);
26
-
27
- this.state = {
28
- collapsed: false,
29
- };
30
26
  }
31
27
 
32
- handlePress() {
33
- const { collapsed } = this.state;
34
- const { onPress } = this.props;
35
-
36
- const toValue = collapsed ? 0 : 1;
28
+ componentDidUpdate(prevProps) {
29
+ const { collapsed } = this.props;
30
+ const { collapsed: prevCollapsed } = prevProps;
37
31
 
38
- this.setState(
39
- { collapsed: !collapsed },
40
- () => Animated.timing(
41
- this.dropDownIconValue,
42
- {
43
- toValue,
44
- useNativeDriver: true,
45
- duration: 300,
46
- }
47
- ).start());
32
+ if (collapsed !== prevCollapsed) {
33
+ const toValue = collapsed ? 1 : 0;
48
34
 
49
- if (onPress) {
50
- onPress();
35
+ Animated.timing(this.dropDownIconValue, {
36
+ toValue,
37
+ useNativeDriver: true,
38
+ duration: 300,
39
+ }).start();
51
40
  }
52
41
  }
53
42
 
54
43
  render() {
55
- const { style, tooltip } = this.props;
44
+ const { style, tooltip, onPress } = this.props;
56
45
 
57
46
  return (
58
- <TouchableOpacity
59
- onPress={this.handlePress}
60
- style={style.container}
61
- >
62
- <Text>
63
- {tooltip}
64
- </Text>
47
+ <TouchableOpacity onPress={onPress} style={style.container}>
48
+ <Text>{tooltip}</Text>
65
49
  <AnimatedIcon
66
50
  name="drop-down"
67
51
  style={{
68
52
  ...style.icon,
69
- transform: [{
70
- rotate: this.dropDownIconValue.interpolate({
71
- inputRange: [0, 1],
72
- outputRange: ['0deg', '180deg'],
73
- }),
74
- }],
53
+ transform: [
54
+ {
55
+ rotate: this.dropDownIconValue.interpolate({
56
+ inputRange: [0, 1],
57
+ outputRange: ['0deg', '180deg'],
58
+ }),
59
+ },
60
+ ],
75
61
  }}
76
62
  />
77
63
  </TouchableOpacity>
@@ -79,4 +65,6 @@ class YearRangePickerButton extends PureComponent {
79
65
  }
80
66
  }
81
67
 
82
- export default connectStyle('shoutem.ui.YearRangePickerButton')(YearRangePickerButton);
68
+ export default connectStyle('shoutem.ui.YearRangePickerButton')(
69
+ YearRangePickerButton,
70
+ );
@@ -1,15 +1,15 @@
1
1
  import React, { PureComponent } from 'react';
2
2
  import { LayoutAnimation, Platform } from 'react-native';
3
- import PropTypes from 'prop-types';
4
- import _ from 'lodash';
5
3
  import Modal from 'react-native-modal';
6
4
  import autoBindReact from 'auto-bind/react';
5
+ import _ from 'lodash';
6
+ import PropTypes from 'prop-types';
7
7
  import { connectStyle } from '@shoutem/theme';
8
- import { View } from '../View';
9
- import { Text } from '../Text';
10
- import { Icon } from '../Icon';
11
8
  import { Button } from '../Button';
9
+ import { Icon } from '../Icon';
10
+ import { Text } from '../Text';
12
11
  import { TouchableOpacity } from '../TouchableOpacity';
12
+ import { View } from '../View';
13
13
 
14
14
  const NUMBER_OF_ROWS = 4;
15
15
  const YEARS_IN_ROW = 5;
@@ -20,10 +20,7 @@ function resolveVisibleYears(props) {
20
20
  const yearsPerPage = NUMBER_OF_ROWS * YEARS_IN_ROW;
21
21
 
22
22
  if (_.isEmpty(selectedYears)) {
23
- const fullRange = _.times(
24
- yearsPerPage,
25
- index => rangeStart + index,
26
- );
23
+ const fullRange = _.times(yearsPerPage, index => rangeStart + index);
27
24
 
28
25
  return _.filter(fullRange, year => year <= rangeEnd);
29
26
  }
@@ -31,11 +28,8 @@ function resolveVisibleYears(props) {
31
28
  const firstSelectedYear = _.head(selectedYears);
32
29
  const prevPagesNumber = Math.trunc(firstSelectedYear / yearsPerPage);
33
30
 
34
- const fullRangeStart = (prevPagesNumber * yearsPerPage) + 1;
35
- const fullRange = _.times(
36
- yearsPerPage,
37
- index => fullRangeStart + index,
38
- );
31
+ const fullRangeStart = prevPagesNumber * yearsPerPage + 1;
32
+ const fullRange = _.times(yearsPerPage, index => fullRangeStart + index);
39
33
 
40
34
  return _.filter(fullRange, year => year <= rangeEnd);
41
35
  }
@@ -83,7 +77,6 @@ class YearRangePickerModal extends PureComponent {
83
77
  const { onRangeConfirmed } = this.props;
84
78
 
85
79
  if (onRangeConfirmed) {
86
- LayoutAnimation.easeInEaseOut();
87
80
  onRangeConfirmed(selectedYears);
88
81
  }
89
82
  }
@@ -91,7 +84,6 @@ class YearRangePickerModal extends PureComponent {
91
84
  handleResetPress() {
92
85
  const { onRangeConfirmed } = this.props;
93
86
 
94
- LayoutAnimation.easeInEaseOut();
95
87
  this.setState({ selectedYears: [] });
96
88
 
97
89
  if (onRangeConfirmed) {
@@ -104,9 +96,15 @@ class YearRangePickerModal extends PureComponent {
104
96
  const { visibleYears } = this.state;
105
97
 
106
98
  const nextYearStart = _.last(visibleYears) + 1;
107
- const nextYearEnd = Math.min(rangeEnd, nextYearStart + this.YEARS_PER_PAGE - 1);
99
+ const nextYearEnd = Math.min(
100
+ rangeEnd,
101
+ nextYearStart + this.YEARS_PER_PAGE - 1,
102
+ );
108
103
 
109
- const nextVisibleYears = _.times(nextYearEnd + 1 - nextYearStart, index => nextYearStart + index);
104
+ const nextVisibleYears = _.times(
105
+ nextYearEnd + 1 - nextYearStart,
106
+ index => nextYearStart + index,
107
+ );
110
108
 
111
109
  LayoutAnimation.easeInEaseOut();
112
110
  this.setState({ visibleYears: nextVisibleYears });
@@ -118,7 +116,12 @@ class YearRangePickerModal extends PureComponent {
118
116
  const prevYearStart = _.head(visibleYears) - this.YEARS_PER_PAGE;
119
117
 
120
118
  LayoutAnimation.easeInEaseOut();
121
- this.setState({ visibleYears: _.times(this.YEARS_PER_PAGE, index => prevYearStart + index) });
119
+ this.setState({
120
+ visibleYears: _.times(
121
+ this.YEARS_PER_PAGE,
122
+ index => prevYearStart + index,
123
+ ),
124
+ });
122
125
  }
123
126
 
124
127
  handleYearPress(year) {
@@ -137,7 +140,9 @@ class YearRangePickerModal extends PureComponent {
137
140
  }
138
141
 
139
142
  const cutFromEnd = size / 2 <= index;
140
- const newYears = _.filter(selectedYears, value => cutFromEnd ? value <= year : value >= year);
143
+ const newYears = _.filter(selectedYears, value =>
144
+ cutFromEnd ? value <= year : value >= year,
145
+ );
141
146
 
142
147
  this.setState({ selectedYears: newYears });
143
148
  return;
@@ -149,15 +154,23 @@ class YearRangePickerModal extends PureComponent {
149
154
  }
150
155
 
151
156
  const addToEnd = _.last(selectedYears) < year;
152
- const yearsToAdd = addToEnd ? year - _.last(selectedYears) : _.head(selectedYears) - year;
157
+ const yearsToAdd = addToEnd
158
+ ? year - _.last(selectedYears)
159
+ : _.head(selectedYears) - year;
153
160
 
154
161
  const newYears = addToEnd
155
- ? [...selectedYears, ..._.times(yearsToAdd, index => _.last(selectedYears) + index + 1)]
156
- : [...selectedYears, ..._.times(yearsToAdd, index => _.head(selectedYears) - index + -1)]
162
+ ? [
163
+ ...selectedYears,
164
+ ..._.times(yearsToAdd, index => _.last(selectedYears) + index + 1),
165
+ ]
166
+ : [
167
+ ...selectedYears,
168
+ ..._.times(yearsToAdd, index => _.head(selectedYears) - index + -1),
169
+ ];
157
170
  const sortedYears = _.sortBy(newYears, item => item);
158
171
 
159
172
  this.setState({ selectedYears: sortedYears });
160
- }
173
+ };
161
174
  }
162
175
 
163
176
  renderYear(year) {
@@ -174,12 +187,14 @@ class YearRangePickerModal extends PureComponent {
174
187
  style={style.yearContainer}
175
188
  key={year.toString()}
176
189
  >
177
- <View style={[
178
- style.year,
179
- isSelected && style.yearSelected,
180
- isFirst && style.yearFirst,
181
- isLast && style.yearLast,
182
- ]}>
190
+ <View
191
+ style={[
192
+ style.year,
193
+ isSelected && style.yearSelected,
194
+ isFirst && style.yearFirst,
195
+ isLast && style.yearLast,
196
+ ]}
197
+ >
183
198
  <Text>{year.toString()}</Text>
184
199
  </View>
185
200
  </TouchableOpacity>
@@ -191,7 +206,7 @@ class YearRangePickerModal extends PureComponent {
191
206
  <View styleName="horizontal flexible" key={index.toString()}>
192
207
  {_.map(row, this.renderYear)}
193
208
  </View>
194
- )
209
+ );
195
210
  }
196
211
 
197
212
  render() {
@@ -221,6 +236,7 @@ class YearRangePickerModal extends PureComponent {
221
236
  onBackdropPress={onDismiss}
222
237
  useNativeDriver
223
238
  backdropOpacity={Platform.OS === 'ios' ? 0.7 : 0}
239
+ animationIn="slideInUp"
224
240
  >
225
241
  <View style={style.container}>
226
242
  <View style={style.tooltipContainer}>
@@ -229,7 +245,10 @@ class YearRangePickerModal extends PureComponent {
229
245
  onPress={this.handleYearsBackPress}
230
246
  disabled={prevDisabled}
231
247
  >
232
- <Icon name="left-arrow" style={[style.icon, prevDisabled && style.iconDisabled]} />
248
+ <Icon
249
+ name="left-arrow"
250
+ style={[style.icon, prevDisabled && style.iconDisabled]}
251
+ />
233
252
  </Button>
234
253
  <Text>{buttonTooltip}</Text>
235
254
  <Button
@@ -237,22 +256,33 @@ class YearRangePickerModal extends PureComponent {
237
256
  onPress={this.handleYearsForwardPress}
238
257
  disabled={nextDisabled}
239
258
  >
240
- <Icon name="right-arrow" style={[style.icon, nextDisabled && style.iconDisabled]} />
259
+ <Icon
260
+ name="right-arrow"
261
+ style={[style.icon, nextDisabled && style.iconDisabled]}
262
+ />
241
263
  </Button>
242
264
  </View>
243
- {_.times(NUMBER_OF_ROWS, (row) => this.renderYearRow(data[row], row))}
265
+ {_.times(NUMBER_OF_ROWS, row => this.renderYearRow(data[row], row))}
244
266
  <View style={style.buttonContainer}>
245
- <Button styleName="secondary flexible" onPress={this.handleResetPress}>
267
+ <Button
268
+ styleName="secondary flexible"
269
+ onPress={this.handleResetPress}
270
+ >
246
271
  <Text>{resetButtonTitle}</Text>
247
272
  </Button>
248
- <Button styleName="primary flexible md-gutter-left" onPress={this.handleConfirmPress}>
273
+ <Button
274
+ styleName="primary flexible md-gutter-left"
275
+ onPress={this.handleConfirmPress}
276
+ >
249
277
  <Text>{confirmButtonTitle}</Text>
250
278
  </Button>
251
279
  </View>
252
- </ View>
280
+ </View>
253
281
  </Modal>
254
282
  );
255
283
  }
256
284
  }
257
285
 
258
- export default connectStyle('shoutem.ui.YearRangePickerModal')(YearRangePickerModal);
286
+ export default connectStyle('shoutem.ui.YearRangePickerModal')(
287
+ YearRangePickerModal,
288
+ );
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { Card } from '../../components/Card';
3
2
  import { Button } from '../../components/Button';
3
+ import { Card } from '../../components/Card';
4
4
  import { Icon } from '../../components/Icon';
5
5
  import { Image } from '../../components/Image';
6
6
  import { Caption, Subtitle } from '../../components/Text';
@@ -44,8 +44,8 @@ export class DropDownMenus extends PureComponent {
44
44
  onOptionSelected={option =>
45
45
  this.setState({ selectedOption: option })
46
46
  }
47
- titleProperty={'name'}
48
- valueProperty={'id'}
47
+ titleProperty="name"
48
+ valueProperty="id"
49
49
  />
50
50
  </Stage>
51
51
  <Stage title="Dropdown (horizontal)">
@@ -56,8 +56,8 @@ export class DropDownMenus extends PureComponent {
56
56
  onOptionSelected={option =>
57
57
  this.setState({ selectedOption: option })
58
58
  }
59
- titleProperty={'name'}
60
- valueProperty={'id'}
59
+ titleProperty="name"
60
+ valueProperty="id"
61
61
  />
62
62
  </Stage>
63
63
  <Stage title="Dropdown (large)">
@@ -68,8 +68,8 @@ export class DropDownMenus extends PureComponent {
68
68
  onOptionSelected={option =>
69
69
  this.setState({ selectedOption: option })
70
70
  }
71
- titleProperty={'name'}
72
- valueProperty={'id'}
71
+ titleProperty="name"
72
+ valueProperty="id"
73
73
  />
74
74
  </Stage>
75
75
  <Stage title="Dropdown (inside a form group)">
@@ -82,8 +82,8 @@ export class DropDownMenus extends PureComponent {
82
82
  onOptionSelected={option =>
83
83
  this.setState({ selectedOptionForFormGroupDropdown: option })
84
84
  }
85
- titleProperty={'name'}
86
- valueProperty={'id'}
85
+ titleProperty="name"
86
+ valueProperty="id"
87
87
  />
88
88
  </FormGroup>
89
89
  </Stage>
@@ -1,6 +1,6 @@
1
1
  import React, { PureComponent } from 'react';
2
- import { DropDownMenu } from '../../components/DropDownMenu';
3
2
  import { Divider } from '../../components/Divider';
3
+ import { DropDownMenu } from '../../components/DropDownMenu';
4
4
  import { Screen } from '../../components/Screen';
5
5
  import { ScrollView } from '../../components/ScrollView';
6
6
  import { Buttons } from './Buttons';