'use strict'
var React = require('react-native');
var{
ListView,
View,
Text,
StyleSheet,
View,
Switch,
number,
string
} = React;
var styles = StyleSheet.create({
rowContainer:{
flexDirection:'row',
height:68,
alignItems:'center',
borderBottomColor: '#E0E0E0',
borderBottomWidth: 1
},
cellTextAttributes:{
fontSize:19,
color:'#333333',
left:30,
alignItems:'center',
justifyContent:'center',
flex:1
},
separator: {
height: 3,
backgroundColor: '#000',
marginLeft:16
},
switchStyle:{
marginRight:30,
alignItems:'flex-end'
}
});
class WebViewExample extends React.Component{
constructor(props) {
super(props);
var dataSource = new ListView.DataSource(
{rowHasChanged: (r1, r2) => r1 !== r2});
this.state = {
dataSource: dataSource.cloneWithRows(['推送', '清除缓存','关于我们','我要反馈']),
};
}
renderRow(rowData,sectionID,rowID){
if(rowID === '0'){
return (
<View style={ styles.rowContainer}>
<Text style = {styles.cellTextAttributes}>{rowData}</Text>
<Switch style = {styles.switchStyle} disabled = {false} value = {true}/>
</View>
);
}
return (
<View style={ styles.rowContainer}>
<Text style = {styles.cellTextAttributes}>{rowData}</Text>
</View>
);
}
render() {
return (
<ListView
dataSource={this.state.dataSource}
renderRow={this.renderRow.bind(this)}
/>
);
}
}
React.AppRegistry.registerComponent('WebViewExample', function() { return WebViewExample});