Skip to content

Commit

Permalink
Merge pull request #678 from shoutem/release/4.8.0
Browse files Browse the repository at this point in the history
Release/4.8.0 - master
  • Loading branch information
tomislav-arambasic authored Feb 10, 2022
2 parents c4c3f4c + 8f0c70c commit 683d15e
Show file tree
Hide file tree
Showing 79 changed files with 623 additions and 331 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ To see other components, just import them from `@shoutem/ui` and render them.

You can also use standard React Native components in your layouts anywhere you want, but they will not inherit either the theme or the parent styles, so you will need to style them manually.


### Restaurants app

Clone the [Shoutem UI](https://github.com/shoutem/ui) repository:
Expand Down Expand Up @@ -107,7 +106,7 @@ It consists of three libraries:

- [@shoutem/ui](https://github.com/shoutem/ui): beautiful and customizable UI components
- [@shoutem/theme](https://github.com/shoutem/theme): “CSS-way” of styling entire app
- [@shoutem/animation](https://github.com/shoutem/animation): declarative way of applying ready-made animations
- [@shoutem/animation](https://github.com/shoutem/animation): declarative way of applying ready-made animations

## License

Expand Down
12 changes: 6 additions & 6 deletions components/ActionSheet/ActionSheet.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { Animated, Dimensions, TouchableOpacity } from 'react-native';
import autoBindReact from 'auto-bind/react';
import { Animated, TouchableOpacity, Dimensions } from 'react-native';
import _ from 'lodash';
import PropTypes from 'prop-types';
import { connectStyle } from '@shoutem/theme';
import { IPHONE_X_HOME_INDICATOR_PADDING } from '../../const';
import { Device } from '../../helpers';
Expand Down Expand Up @@ -84,11 +84,11 @@ class ActionSheet extends PureComponent {
Animated.parallel([
Animated.spring(yPos, {
toValue,
useNativeDriver: true
useNativeDriver: true,
}),
Animated.timing(opacity, {
toValue,
useNativeDriver: false
useNativeDriver: false,
}),
]).start();
}
Expand All @@ -101,13 +101,13 @@ class ActionSheet extends PureComponent {
Animated.parallel([
Animated.spring(yPos, {
toValue,
useNativeDriver: true
useNativeDriver: true,
}),
Animated.timing(opacity, {
toValue,
delay: 100,
duration: 150,
useNativeDriver: false
useNativeDriver: false,
}),
]).start(this.hideComponent);
}
Expand Down
4 changes: 2 additions & 2 deletions components/DateTimePicker.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { PureComponent } from 'react';
import { Platform } from 'react-native';
import Modal from 'react-native-modal';
import RNCDateTimePicker from '@react-native-community/datetimepicker';
import autoBindReact from 'auto-bind/react';
import PropTypes from 'prop-types';
import { Platform } from 'react-native';
import Modal from 'react-native-modal';
import { connectStyle } from '@shoutem/theme';
import { Button } from './Button';
import { Icon } from './Icon';
Expand Down
2 changes: 1 addition & 1 deletion components/DropDownMenu/DropDownMenu.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { PureComponent } from 'react';
import autoBindReact from 'auto-bind/react';
import PropTypes from 'prop-types';
import _ from 'lodash';
import PropTypes from 'prop-types';
import { connectStyle } from '@shoutem/theme';
import { Button } from '../Button';
import { Icon } from '../Icon';
Expand Down
4 changes: 2 additions & 2 deletions components/DropDownMenu/DropDownModal.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { PureComponent } from 'react';
import { Dimensions, Modal } from 'react-native';
import autoBindReact from 'auto-bind/react';
import _ from 'lodash';
import PropTypes from 'prop-types';
import { Modal, Dimensions } from 'react-native';
import { connectStyle, changeColorAlpha } from '@shoutem/theme';
import { changeColorAlpha, connectStyle } from '@shoutem/theme';
import { Button } from '../Button';
import { Icon } from '../Icon';
import { LinearGradient } from '../LinearGradient';
Expand Down
14 changes: 9 additions & 5 deletions components/EmptyListImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ import { Text, Title, View } from '@shoutem/ui';
import EmptyList from '../assets/images/emptyList.svg';

class EmptyListImage extends PureComponent {
static defaultProps = {
title: "It's empty in here",
message: "We couldn't find anything to show...",
};

constructor(props) {
super(props);

Expand Down Expand Up @@ -66,6 +61,15 @@ EmptyListImage.propTypes = {
titleStyle: PropTypes.object,
};

EmptyListImage.defaultProps = {
image: undefined,
imageStyle: undefined,
message: "We couldn't find anything to show...",
messageStyle: undefined,
title: "It's empty in here",
titleStyle: undefined,
};

const StyledView = connectStyle('shoutem.ui.EmptyListImage')(EmptyListImage);

export { StyledView as EmptyListImage };
1 change: 0 additions & 1 deletion components/FormGroup.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { PureComponent } from 'react';
import { connectAnimation } from '@shoutem/animation';
import { connectStyle } from '@shoutem/theme';

import { View } from './View';

class FormGroup extends PureComponent {
Expand Down
4 changes: 2 additions & 2 deletions components/GridRow.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { PureComponent, Children } from 'react';
import React, { Children, PureComponent } from 'react';
import { View as RNView, ViewPropTypes } from 'react-native';
import _ from 'lodash';
import PropTypes from 'prop-types';
import { View as RNView, ViewPropTypes } from 'react-native';
import { connectAnimation } from '@shoutem/animation';
import { connectStyle } from '@shoutem/theme';
import { View } from './View';
Expand Down
4 changes: 2 additions & 2 deletions components/HorizontalPager/HorizontalPager.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { PureComponent } from 'react';
import { InteractionManager, LayoutAnimation, ScrollView } from 'react-native';
import autoBindReact from 'auto-bind/react';
import _ from 'lodash';
import PropTypes from 'prop-types';
import { InteractionManager, LayoutAnimation, ScrollView } from 'react-native';
import { connectStyle } from '@shoutem/theme';
import { View } from '../View';
import { Page } from './Page';
Expand Down Expand Up @@ -118,7 +118,7 @@ class HorizontalPager extends PureComponent {
const { selectedIndex } = this.state;
const { onIndexSelected } = this.props;

const contentOffset = event.nativeEvent.contentOffset;
const { contentOffset } = event.nativeEvent;
const newSelectedIndex = this.calculateIndex(contentOffset);

if (selectedIndex === newSelectedIndex) {
Expand Down
2 changes: 0 additions & 2 deletions components/Icon/services/icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ export function registerIcons(config) {
} else {
addNewIcon(config);
}

return;
}

registerIcons(defaultConfig);
Expand Down
2 changes: 1 addition & 1 deletion components/Icon/services/index.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { registerIcons, getIcon } from './icons';
export { getIcon, registerIcons } from './icons';
2 changes: 1 addition & 1 deletion components/Image.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { PureComponent } from 'react';
import { Image as RNImage, Platform } from 'react-native';
import autoBindReact from 'auto-bind/react';
import _ from 'lodash';
import { Image as RNImage, Platform } from 'react-native';
import { connectAnimation } from '@shoutem/animation';
import { connectStyle } from '@shoutem/theme';

Expand Down
2 changes: 1 addition & 1 deletion components/ImageBackground.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { PureComponent } from 'react';
import { ImageBackground as RNImageBackground, Platform } from 'react-native';
import autoBindReact from 'auto-bind/react';
import _ from 'lodash';
import { ImageBackground as RNImageBackground, Platform } from 'react-native';
import { connectAnimation } from '@shoutem/animation';
import { connectStyle } from '@shoutem/theme';

Expand Down
1 change: 1 addition & 0 deletions components/ImageGallery/ImageGallery.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ImageGalleryBase } from './ImageGalleryBase';

class ImageGallery extends ImageGalleryBase {
static IMAGE_PREVIEW_MODE = ImageGalleryBase.IMAGE_PREVIEW_MODE;

static IMAGE_GALLERY_MODE = ImageGalleryBase.IMAGE_GALLERY_MODE;

renderImage(imageProps, imageData, imageIndex) {
Expand Down
3 changes: 2 additions & 1 deletion components/ImageGallery/ImageGallery.ios.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React from 'react';
import autoBindReact from 'auto-bind/react';
import { InteractionManager } from 'react-native';
import TransformableImage from 'react-native-transformable-image';
import autoBindReact from 'auto-bind/react';
import { connectStyle } from '@shoutem/theme';
import { ImageGalleryBase } from './ImageGalleryBase';

class ImageGallery extends ImageGalleryBase {
static IMAGE_PREVIEW_MODE = ImageGalleryBase.IMAGE_PREVIEW_MODE;

static IMAGE_GALLERY_MODE = ImageGalleryBase.IMAGE_GALLERY_MODE;

constructor(props) {
Expand Down
2 changes: 1 addition & 1 deletion components/ImageGalleryOverlay.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { PureComponent } from 'react';
import { ScrollView } from 'react-native';
import autoBindReact from 'auto-bind/react';
import PropTypes from 'prop-types';
import { ScrollView } from 'react-native';
import { connectAnimation } from '@shoutem/animation';
import { connectStyle } from '@shoutem/theme';
import { Icon } from './Icon';
Expand Down
4 changes: 2 additions & 2 deletions components/ImagePreview.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { PureComponent } from 'react';
import { Image, Modal, TouchableOpacity, View } from 'react-native';
import Icon from 'react-native-vector-icons/MaterialIcons';
import autoBindReact from 'auto-bind/react';
import PropTypes from 'prop-types';
import { View, Modal, Image, TouchableOpacity } from 'react-native';
import Icon from 'react-native-vector-icons/MaterialIcons';
import { makeZoomable } from '@shoutem/animation';
import { connectStyle } from '@shoutem/theme';

Expand Down
51 changes: 24 additions & 27 deletions components/InlineDropDownMenu/InlineDropDownMenu.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React, { PureComponent } from 'react';
import { Animated, FlatList } from 'react-native';
import autoBindReact from 'auto-bind/react';
import { FlatList, Animated } from 'react-native';
import _ from 'lodash';
import PropTypes from 'prop-types';
import { connectStyle } from '@shoutem/theme';
import { Icon } from '../Icon';
import { Caption, Text } from '../Text';
import { TouchableOpacity } from '../TouchableOpacity';
import { View } from '../View';
import { Caption, Text } from '../Text';
import { Icon } from '../Icon';
import { InlineDropDownMenuItem } from './InlineDropDownMenuItem';

const AnimatedIcon = Animated.createAnimatedComponent(Icon);
Expand Down Expand Up @@ -43,16 +43,13 @@ class InlineDropDownMenu extends PureComponent {

const toValue = collapsed ? 0 : 1;

this.setState(
{ collapsed: !collapsed },
() => Animated.timing(
this.dropDownIconValue,
{
toValue,
useNativeDriver: true,
duration: 300,
}
).start());
this.setState({ collapsed: !collapsed }, () =>
Animated.timing(this.dropDownIconValue, {
toValue,
useNativeDriver: true,
duration: 300,
}).start(),
);
}

handleOptionPress(option) {
Expand All @@ -78,21 +75,19 @@ class InlineDropDownMenu extends PureComponent {
selectedDescriptor={selectedDescriptor}
onItemPressed={this.handleOptionPress}
/>
)
);
}

render() {
const {
style,
heading,
selectedOption,
options,
} = this.props;
const { style, heading, selectedOption, options } = this.props;
const { collapsed } = this.state;

return (
<View>
<TouchableOpacity style={style.container} onPress={this.handleToggleMenuPress}>
<TouchableOpacity
style={style.container}
onPress={this.handleToggleMenuPress}
>
<Caption styleName="muted md-gutter-bottom">{heading}</Caption>
<View styleName="space-between horizontal v-center">
<Text>{selectedOption?.title}</Text>
Expand All @@ -101,12 +96,14 @@ class InlineDropDownMenu extends PureComponent {
styleName="md-gutter-left"
style={{
...style.icon,
transform: [{
rotate: this.dropDownIconValue.interpolate({
inputRange: [0, 1],
outputRange: ['0deg', '180deg']
})
}]
transform: [
{
rotate: this.dropDownIconValue.interpolate({
inputRange: [0, 1],
outputRange: ['0deg', '180deg'],
}),
},
],
}}
/>
</View>
Expand Down
27 changes: 13 additions & 14 deletions components/InlineDropDownMenu/InlineDropDownMenuItem.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { PureComponent } from 'react';
import autoBindReact from 'auto-bind/react';
import { Animated, Dimensions } from 'react-native';
import autoBindReact from 'auto-bind/react';
import _ from 'lodash';
import PropTypes from 'prop-types';
import { connectStyle } from '@shoutem/theme';
import { TouchableOpacity } from '../TouchableOpacity';
import { Text } from '../Text';
import { TouchableOpacity } from '../TouchableOpacity';

const window = Dimensions.get('window');
const AnimatedTouchable = Animated.createAnimatedComponent(TouchableOpacity);
Expand All @@ -30,14 +30,11 @@ class InlineDropDownMenuItem extends PureComponent {
componentDidMount() {
const { index } = this.props;

Animated.timing(
this.animatedValue,
{
toValue: 1,
useNativeDriver: true,
duration: 300 + index * 15,
}
).start();
Animated.timing(this.animatedValue, {
toValue: 1,
useNativeDriver: true,
duration: 300 + index * 15,
}).start();
}

handlePress() {
Expand All @@ -51,7 +48,9 @@ class InlineDropDownMenuItem extends PureComponent {
render() {
const { isSelected, selectedDescriptor, item, style } = this.props;

const resolvedText = isSelected ? `${item.title} (${selectedDescriptor})` : item.title;
const resolvedText = isSelected
? `${item.title} (${selectedDescriptor})`
: item.title;
const textStyle = isSelected ? 'muted' : '';

return (
Expand All @@ -64,10 +63,10 @@ class InlineDropDownMenuItem extends PureComponent {
translateX: this.animatedValue.interpolate({
inputRange: [0, 1],
outputRange: [window.width, 0],
})
}
}),
},
],
}
},
]}
disabled={isSelected}
onPress={this.handlePress}
Expand Down
Loading

0 comments on commit 683d15e

Please sign in to comment.