1 回答

TA貢獻(xiàn)1844條經(jīng)驗(yàn) 獲得超8個(gè)贊
答案是肯定可以的!
我想樓主的意思是想在一個(gè)組件上既顯示一個(gè)ListView,還要顯示一些其他的東西,比如圖片,文本,具體代碼參考如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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 (
<View style={styles.container}>
<ScrollView>
<ListView
dataSource={this.state.dataSource}
renderRow={(rowData) => <Text>{rowData}</Text>}
style={{height: 100,}}
/>
<Text>Hello World</Text>
<Image source={require("../../images/user2.jpg")} />
<Image source={require("../../images/user2.jpg")} />
</ScrollView>
</View>
);
}
}
export default MyNewComponent;

TA貢獻(xiàn)1813條經(jīng)驗(yàn) 獲得超2個(gè)贊
存在問題呢?在真機(jī)上上拉加載和下拉的時(shí)候都會(huì)出現(xiàn)一些難以預(yù)計(jì)的問題
- 1 回答
- 0 關(guān)注
- 1003 瀏覽
添加回答
舉報(bào)