weex-nuke
Version:
基于 Rax 、Weex 的高性能组件体系 ~~
26 lines (19 loc) • 628 B
JavaScript
/** @jsx createElement */
;
import { createElement, PropTypes, Component } from 'rax';
import { isWeex } from 'nuke-env';
import View from 'nuke-view';
const initStyle = { zIndex: 2, position: 'sticky', top: 0 };
class Header extends Component {
static contextTypes = {
isInARecyclerView: PropTypes.bool,
};
render() {
const { append = 'tree', style = {}, ...others } = this.props;
if (isWeex && this.context.isInARecyclerView) {
return <header append={append} style={style} {...others} />;
}
return <View style={[initStyle, style]} {...others} />;
}
}
export default Header;