I made a ListView that scrolls if you want!
ListBillScreen.js
export default class ListBillScreen extends React.Component{ /*Constructor*/ render() { return ( <ScrollView style = {styles.container}> <View style ={styles.header}> <Text style = {styles.textHeader}> Title</Text> </View> <ListView style={styles.listView} dataSource={this.state.dataSource} renderRow={(data) => <Row {...data} navigator={this.props.navigator} />} renderSeparator={(sectionId, rowId) => <View key={rowId} style= {styles.separator} />} /> <AndroidBackButton onPress={this.popIfExists.bind(this)} /> </ScrollView> );
}}
Styles
import { StyleSheet } from 'react-native' import { Colors, Metrics } from '../../Themes' export default StyleSheet.create({ container: { paddingTop: 20, backgroundColor: Colors.background }, separator: { height: StyleSheet.hairlineWidth, backgroundColor: '#8E8E8E', }, textHeader: { color: Colors.steel, textAlign: 'center', }, image: { height:64, width: 64, }, listView: { paddingTop: 10, paddingBottom: 20 }, actionButtonIcon: { fontSize: 20, height: 22, color: 'white', }, })
It scrolls completely even if you add a few lines =) (My lines are created using a JSon file with Row.js )
Enjoy it!
source share