[英]React Native ScrollView dynamic footer
如何制作 React 原生滾動視圖頁腳。 如果內容小於屏幕,屏幕最底部應該有一個按鈕; 如果它更大,那么按鈕應該是 go 到內容之后的最底部
我這樣做了,但是如果沒有足夠的內容,那么按鈕就會上升
<ScrollView>
<Text>asdasd</Text>
<Button text="Next" />
</ScrollView>
如果是這樣,那么請始終坐在按鈕下方的滾動條下方,但我也需要按鈕 go
<View>
<ScrollView>
<Text>asdasd</Text>
</ScrollView>
<Button text="Next" />
</View>
嘗試將滾動視圖設置為彈性可用空間,並將按鈕設置為底部的 position
<ScrollView style={{flex: 1}}>
<Text>asdasd</Text>
<Button text="Next" style={{bottom: 0}}/>
</ScrollView>
這是我找到的解決方案
<ScrollView>
<View style={{ minHeight: height - buttonHeight - safeAreaView }}>
<Text>Content</Text>
</View>
<Button text="Next" />
</ScrollView>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.