@uiw/react-native
Version:
UIW for React Native
31 lines (27 loc) • 663 B
JavaScript
import React, { Component } from 'react';
import { View } from 'react-native';
export default class Spacing extends Component {
static defaultProps = {
size: 'default',
type: 'vertical'
};
render() {
const {
size,
style,
type,
...otherProps
} = this.props;
const sty = {};
const keyName = type === 'vertical' ? 'height' : 'width';
sty[keyName] = 10;
if (size === 'small') {
sty[keyName] = 5;
} else if (size === 'large') {
sty[keyName] = 15;
} else if (typeof size === 'number') {
sty[keyName] = size;
}
return <View style={[sty, style]} {...otherProps} />;
}
}