mirror of
https://github.com/zhigang1992/react-native-web.git
synced 2026-03-27 01:34:17 +08:00
43 lines
856 B
JavaScript
43 lines
856 B
JavaScript
import React, { PropTypes } from 'react'
|
|
import restyle from './modules/restyle'
|
|
import stylePropTypes from './modules/stylePropTypes'
|
|
|
|
class CoreComponent extends React.Component {
|
|
static propTypes = {
|
|
className: PropTypes.string,
|
|
component: PropTypes.oneOfType([
|
|
PropTypes.func,
|
|
PropTypes.string
|
|
]),
|
|
style: PropTypes.object,
|
|
testID: PropTypes.string
|
|
}
|
|
|
|
static stylePropTypes = stylePropTypes;
|
|
|
|
static defaultProps = {
|
|
className: '',
|
|
component: 'div'
|
|
}
|
|
|
|
render() {
|
|
const {
|
|
className,
|
|
component: Component,
|
|
style,
|
|
testID,
|
|
...other
|
|
} = this.props
|
|
|
|
return (
|
|
<Component
|
|
{...other}
|
|
{...restyle({ className, style })}
|
|
data-testid={process.env.NODE_ENV === 'production' ? null : testID}
|
|
/>
|
|
)
|
|
}
|
|
}
|
|
|
|
export default CoreComponent
|