mirror of
https://github.com/zhigang1992/react-native-web.git
synced 2026-05-17 17:37:39 +08:00
33 lines
672 B
JavaScript
33 lines
672 B
JavaScript
import React, { PropTypes } from 'react';
|
|
import restyle from './modules/restyle';
|
|
import StylePropTypes from './modules/StylePropTypes';
|
|
|
|
class WebStyleComponent extends React.Component {
|
|
static propTypes = {
|
|
className: PropTypes.string,
|
|
component: PropTypes.oneOfType([
|
|
PropTypes.func,
|
|
PropTypes.string
|
|
]),
|
|
style: PropTypes.object
|
|
}
|
|
|
|
static defaultProps = {
|
|
className: '',
|
|
component: 'div'
|
|
}
|
|
|
|
render() {
|
|
const { component: Component, ...other } = this.props;
|
|
|
|
return (
|
|
<Component
|
|
{...other}
|
|
{...restyle(this.props)}
|
|
/>
|
|
);
|
|
}
|
|
}
|
|
|
|
export { StylePropTypes, restyle, WebStyleComponent };
|