Skip to content

Commit

Permalink
Merge branch 'release/0.15.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Željko Rumenjak committed Jun 2, 2017
2 parents 283211e + 2c35786 commit 11272fc
Show file tree
Hide file tree
Showing 29 changed files with 2,084 additions and 1,505 deletions.
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"space-after-keywords": 0,
"space-return-throw-case": 0,
"react-native/no-unused-styles": 2,
"react-native/split-platform-components": 2
"react-native/split-platform-components": 2,
"react/prefer-stateless-function": 0,
}
}
2 changes: 1 addition & 1 deletion components/Card.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { connectStyle } from '@shoutem/theme';
import { connectAnimation } from '@shoutem/animation';

const AnimatedCard = connectAnimation(View);
const Card = connectStyle('shoutem.ui.Card', {})(AnimatedCard);
const Card = connectStyle('shoutem.ui.Card')(AnimatedCard);

export {
Card,
Expand Down
6 changes: 3 additions & 3 deletions components/DropDownMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class DropDownMenu extends Component {
collapse() {
this.setState({ collapsed: true });
this.scrollDriver = new ScrollDriver();
this.timingDriver.runTimer(1);
this.timingDriver.toValue(1);
}

selectOption(option) {
Expand All @@ -113,7 +113,7 @@ class DropDownMenu extends Component {
}

close() {
this.timingDriver.runTimer(0, () => this.setState({ collapsed: false }));
this.timingDriver.toValue(0, () => this.setState({ collapsed: false }));
}

emitOnOptionSelectedEvent(option) {
Expand Down Expand Up @@ -224,7 +224,7 @@ class DropDownMenu extends Component {
}
}

const StyledDropDownMenu = connectStyle('shoutem.ui.DropDownMenu', {})(DropDownMenu);
const StyledDropDownMenu = connectStyle('shoutem.ui.DropDownMenu')(DropDownMenu);

export {
StyledDropDownMenu as DropDownMenu,
Expand Down
2,810 changes: 1,618 additions & 1,192 deletions components/Icon/config.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions components/Icon/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ const icons = {

function Icon(props) {
const DefaultIcon = icons.Default || icons.Fallback;
return <DefaultIcon {...props} />
return (<DefaultIcon {...props} />);
}

Icon.setIconFont = function (fontFamily) {
Icon.setIconFont = fontFamily => {
icons.Default = createIcon(fontFamily);
};

export {
Icon,
createIcon,
}
};
2 changes: 1 addition & 1 deletion components/ImagePreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class ImagePreview extends Component {

ImagePreview.propTypes = propTypes;

const StyledImagePreview = connectStyle('shoutem.ui.ImagePreview', {})(ImagePreview);
const StyledImagePreview = connectStyle('shoutem.ui.ImagePreview')(ImagePreview);

export {
StyledImagePreview as ImagePreview,
Expand Down
2 changes: 1 addition & 1 deletion components/NavigationBar/NavigationBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class NavigationBar extends Component {
}

const AnimatedNavigationBar = connectAnimation(composeChildren(NavigationBar));
const StyledNavigationBar = connectStyle('shoutem.ui.NavigationBar', {})(AnimatedNavigationBar);
const StyledNavigationBar = connectStyle('shoutem.ui.NavigationBar')(AnimatedNavigationBar);

export {
StyledNavigationBar as NavigationBar,
Expand Down
4 changes: 3 additions & 1 deletion components/PageIndicators.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ class PageIndicators extends Component {
indicatorStyle = 'selected';
}

pageIndicators.push(this.renderPageIndicator(i, maxIndicatorsCount, activeIndex, indicatorStyle));
pageIndicators.push(
this.renderPageIndicator(i, maxIndicatorsCount, activeIndex, indicatorStyle)
);
}

return (
Expand Down
12 changes: 5 additions & 7 deletions components/RichMedia.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ import React from 'react';
import { Html } from '../html';

export default function RichMedia({ body }) {
console.warn('RichMedia is deprecated and will be removed in next verions.');

if (!body) {
console.log('Missing body in RichMedia component.')
return null;
}

console.warn('RichMedia is deprecated and will be removed in next versions.');
return <Html body={body} />;
}

RichMedia.propTypes = {
body: React.PropTypes.string.isRequired,
};
2 changes: 1 addition & 1 deletion components/ShareButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class ShareButton extends Component {
}
}

const StyledShareButton = connectStyle('shoutem.ui.ShareButton', {}, () => {},
const StyledShareButton = connectStyle('shoutem.ui.ShareButton', undefined, undefined,
{ virtual: true })(ShareButton);

export {
Expand Down
27 changes: 15 additions & 12 deletions components/Spinner.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,22 @@ import {

import { connectStyle } from '@shoutem/theme';

function Spinner({ style }) {
const indicatorStyle = { ...style };
delete indicatorStyle.size;
delete indicatorStyle.color;
class Spinner extends React.Component {
render() {
const { style } = this.props;
const indicatorStyle = { ...style };
delete indicatorStyle.size;
delete indicatorStyle.color;

return (
<ActivityIndicator
animating
color={style.color}
size={style.size}
style={indicatorStyle}
/>
);
return (
<ActivityIndicator
animating
color={style.color}
size={style.size}
style={indicatorStyle}
/>
);
}
}

Spinner.propTypes = {
Expand Down
2 changes: 1 addition & 1 deletion components/Switch.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class Switch extends Component {
}

setValue(value) {
this.timingDriver.runTimer(value ? 1 : 0);
this.timingDriver.toValue(value ? 1 : 0);
}

render() {
Expand Down
2 changes: 2 additions & 0 deletions components/TextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ class TextInput extends Component {
};
delete style.placeholderTextColor;
delete style.selectionColor;
delete style.underlineColorAndroid;

return (
<RNTextInput
{...props}
style={style}
placeholderTextColor={props.style.placeholderTextColor}
selectionColor={props.style.selectionColor}
underlineColorAndroid={props.style.underlineColorAndroid}
/>
);
}
Expand Down
69 changes: 36 additions & 33 deletions components/Touchable.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,47 +16,50 @@ import {
* iOS, and a TouchableNativeFeedback on
* Android.
*/
function Touchable(props) {
const style = { ...props.style };
delete style.touchableOpacity;
delete style.touchableNativeFeedback;
class Touchable extends React.Component {
static propTypes = {
...TouchableOpacity.propTypes,
...TouchableNativeFeedback.propTypes,
style: PropTypes.object,
};

render() {
const props = this.props;
const style = { ...props.style };
delete style.touchableOpacity;
delete style.touchableNativeFeedback;

if (Platform.OS === 'android') {
return (
<TouchableNativeFeedback
{...props}
style={props.style.touchableNativeFeedback}
>
<View
virtual
style={style}
styleName={props.styleName}
>
{props.children}
</View>
</TouchableNativeFeedback>
);
}

if (Platform.OS === 'android') {
return (
<TouchableNativeFeedback
<TouchableOpacity
{...props}
style={props.style.touchableNativeFeedback}
style={{
...style,
...props.style.touchableOpacity,
}}
>
<View
virtual
style={style}
styleName={props.styleName}
>
{props.children}
</View>
</TouchableNativeFeedback>
{props.children}
</TouchableOpacity>
);
}

return (
<TouchableOpacity
{...props}
style={{
...style,
...props.style.touchableOpacity,
}}
>
{props.children}
</TouchableOpacity>
);
}

Touchable.propTypes = {
...TouchableOpacity.propTypes,
...TouchableNativeFeedback.propTypes,
style: PropTypes.object,
};

const StyledTouchable = connectStyle('shoutem.ui.Touchable', {
touchableNativeFeedback: {},
touchableOpacity: {},
Expand Down
53 changes: 28 additions & 25 deletions components/TouchableNativeFeedback.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,37 @@ import { TouchableNativeFeedback as RNTouchableNativeFeedback } from 'react-nati

import { connectStyle } from '@shoutem/theme';

function TouchableNativeFeedback(props) {
// Remove the props that are not valid
// style keys.
const style = {
...props.style,
class TouchableNativeFeedback extends React.Component {
static propTypes = {
...RNTouchableNativeFeedback.propTypes,
style: PropTypes.shape({
background: PropTypes.object,
useForeground: PropTypes.bool,
}),
};
delete style.background;
delete style.useForeground;

return (
<RNTouchableNativeFeedback
{...props}
style={style}
background={props.style.background}
useForeground={props.style.useForeground}
>
{props.children}
</RNTouchableNativeFeedback>
);
}
render() {
const props = this.props;
// Remove the props that are not valid
// style keys.
const style = {
...props.style,
};
delete style.background;
delete style.useForeground;

TouchableNativeFeedback.propTypes = {
...RNTouchableNativeFeedback.propTypes,
style: PropTypes.shape({
background: PropTypes.object,
useForeground: PropTypes.bool,
}),
};
return (
<RNTouchableNativeFeedback
{...props}
style={style}
background={props.style.background}
useForeground={props.style.useForeground}
>
{props.children}
</RNTouchableNativeFeedback>
);
}
}

const StyledTouchableNativeFeedback =
connectStyle('shoutem.ui.TouchableNativeFeedback')(TouchableNativeFeedback);
Expand Down
2 changes: 1 addition & 1 deletion components/TouchableOpacity.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ TouchableOpacity.propTypes = {
...RNTouchableOpacity.propTypes,
};

const StyledTouchableOpacity = connectStyle('shoutem.ui.TouchableOpacity', {})(TouchableOpacity);
const StyledTouchableOpacity = connectStyle('shoutem.ui.TouchableOpacity')(TouchableOpacity);

export {
StyledTouchableOpacity as TouchableOpacity,
Expand Down
Loading

0 comments on commit 11272fc

Please sign in to comment.