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