答案是肯定可以的!
我想楼主的意思是想在一个组件上既显示一个ListView,还要显示一些其他的东西,比如图片,文本,具体代码参考如下:
import ReactNative from 'react-native';
import React, { Component } from 'react';
import styles from './styles';
const { View, Text, ScrollView, Image, ListView } = ReactNative;
class MyNewComponent extends Component {
constructor(props){
super(props);
const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
this.state = {
dataSource: ds.cloneWithRows(['hello', '1ffasdf', 'fasdfasd', 'Peter', '8799ffff','faddsffasd', 'afdafsdf', 'fasdfasdf',' afsdfasdfasd', 'a', 'b', 'c', 'd']),
}
}
render() {
return (
dataSource={this.state.dataSource}
renderRow={(rowData) =>{rowData} }
style={{height: 100,}}
/>
Hello World
);
}
}
export default MyNewComponent;
存在问题呢?在真机上上拉加载和下拉的时候都会出现一些难以预计的问题