0
我有一個ScrollView
是有問題的,因爲我需要把一個底部邊框,所以我需要它加載最初的全屏,但是當添加<ErrorSection />
組件時,能夠讓ScrollView自動增加高度。React Native,如何使滾動視圖加載最低全屏沒有滾動條,但隨着內容增長滾動
它似乎不適用於flex: 1
,所以我試圖明確聲明ScrollView的height
和width
,但這也會產生不可預知的結果。
這裏是我的滾動型電流代碼:
import React from 'react'
import { StyleSheet, ScrollView, Dimensions } from 'react-native'
import * as Animatable from 'react-native-animatable'
const E1ScrollView = ({ children, animation, style, bottomBorder }) => {
const { container, E1bottomBorder } = styles
const { height, width } = Dimensions.get('window')
// const pxHeight = height * PixelRatio.get()
// const pxWidth = width * PixelRatio.get()
return (
<ScrollView style={[container, style]}>
<Animatable.View
style={[{ height, width }, (bottomBorder) ? E1bottomBorder : null]}
animation={animation}
iterationCount={1}>
{children}
</Animatable.View>
</ScrollView>
)
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#F0F0F0',
flexDirection: 'column'
},
E1bottomBorder: {
borderBottomWidth: 5,
borderColor: '#DD0426',
}
})
export { E1ScrollView }
接受您自己的答案以使其得到解決。 – WilomGfx