2017-09-28 29 views
0

enter image description hereは、ネイティブのListViewに反応

100%の高さを取って私のリストビューコンテナは、リスト中の含有量が少ないその場合であっても、100%の高さを取っています。マイコード

<View style={{ flex: 1, width: '95%', flexDirection: 'row', justifyContent: 'center', alignSelf: 'center' }}> 
    <Card style={{ width: '95%', alignSelf: 'center', marginTop: 10 }}> 
    <ListView 
    dataSource={this.state.dataSource} 
    renderRow={(item) => 
      <CardItem 
       key={`transaction-${item.data.transactionid}`} 
      > 
       // my list code was here 
      </CardItem>} 
    ListFooterComponent={this.renderFooter} 
    onRefresh={this._onRefresh} 
    refreshing={this.state.refreshing} 
    onEndReached={this.fetchGoalTransactions} 
    onEndReachedThreshold={50} 
    /> 
</Card> 

+0

あなたの 'Card'コンポーネントスタイルに' flex:1'を追加するか、 'ListView'のスタイルを作成してそこにポップアップさせてみてください。 –

答えて

0
<View style={{flex:1}}> 
<View style={{flex:2}}> 
    //Here is your List View 
</View> 
<View style={{flex:2}}> 
//Its a Empty View 
</View> 
</View> 

がために、リストビューの高さをバインドするために、直接(落胆)ビューの高さを設定したり、すべての親ビューを確認してくださいLisviewはScrollviewを使用するので、高さが制限されている

ScrollView docs

+0

お返事ありがとうございます。しかし、上記の提案を実装すると、カードコンポーネントの高さが制限されます。今すぐリストにデータがあると、カードのコンポーネントの高さは変わりません。 ex(50%)。だから私は、リストビューのデータに応じて高さを取るためにリストビューにする必要があります。 –

関連する問題