UNPKG

weex-nuke

Version:

基于 Rax 、Weex 的高性能组件体系 ~~

83 lines (75 loc) 1.74 kB
# Header 具备 sticky 效果 - title_en : Header will be sticky when scrolling. - order: 0 --- ```js /** @jsx createElement */ import { View, Text, ListView, Cell, Header } from 'weex-nuke'; <NukePlayGround> <Header style={{ backgroundColor: '#dddddd' }}> <Text>Sticky text</Text> </Header> </NukePlayGround> ``` --- ```js import { createElement, Component, render } from 'rax'; class Demo extends Component { constructor() { super(); this.state = { data: ['固定项1', '固定项2', '固定项3', '固定项4', '固定项5', '固定项6', '固定项7'] }; } render() { return ( <ListView _autoWrapCell={false} showScrollbar={false} style={styles.listContainer}> <Header style={styles.header}> <View style={styles.dataHeaderItem}> <Text style={styles.headerText}>表头</Text> </View> </Header> {this.state.data.map((item, index) => { return ( <Cell key={`cell_${index}`}> <View style={[styles.cellItem]}> <Text style={styles.text}>{item}</Text> </View> </Cell> ); })} </ListView> ); } } const styles = { listContainer: { flex: 1 }, header: { width: 750, backgroundColor: '#ff6600', height: 100, justifyContent: 'center', alignItems: 'center' }, headerText: { color: '#ffffff' }, cellItem: { width: 750, height: 300, paddingTop: 20, flexDirection: 'row', borderBottomWidth: 1, borderBottomStyle: 'solid', borderBottomColor: '#cccccc', justifyContent: 'center', alignItems: 'center' }, text: { color: '#666666' } }; render(<Demo />); ```