React native ScrollView未显示所有内容,已被切断
我需要这个屏幕显示scrollview中的所有内容,我已经尝试了将scrollview的flexGrow设置为1,将父视图的flex设置为100。scrollview一直向下滚动到Bark Central Dog Park&Cafe的迭代,但是它被截去了一半,无法再滚动了,而且我注意到文本HELP ME也找不到了。非常感谢,因为这个问题一直困扰着我,也困扰着我在react native方面的进步 请告诉我该做什么,我哪里做错了。再次感谢你 NotificationScreen.jsReact native ScrollView未显示所有内容,已被切断,react-native,react-native-android,React Native,React Native Android,我需要这个屏幕显示scrollview中的所有内容,我已经尝试了将scrollview的flexGrow设置为1,将父视图的flex设置为100。scrollview一直向下滚动到Bark Central Dog Park&Cafe的迭代,但是它被截去了一半,无法再滚动了,而且我注意到文本HELP ME也找不到了。非常感谢,因为这个问题一直困扰着我,也困扰着我在react native方面的进步 请告诉我该做什么,我哪里做错了。再次感谢你 NotificationScreen.js export
export default class NotificationScreen extends Component
{
static navigationOptions = ({ navigation }) => {
const { state } = navigation;
const {} = state;
return {
header: null,
};
}
render() {
return (
<View style={styles.parentContainer}>
<View style={{flexDirection: 'row', marginLeft: '5%', marginTop: '5%'}}>
<TouchableOpacity onPress={() => this.props.navigation.navigate('JobFeedScreen')}>
<Entypo name="chevron-thin-left" color={Colors.red} size={30} />
</TouchableOpacity>
<View style={{marginLeft: 80,}}>
<Text style={{ fontFamily: 'CoreSansD65Heavy',color: Colors.semiGray, fontSize: 25,}}> Ty, Next</Text>
</View>
<TouchableOpacity onPress={()=> this.props.navigation.navigate('LaunchScreenStack')} style={{marginLeft: 87,marginRight: '5%',}}>
<SimpleLineIcons name='bubbles' color={Colors.red} size={30} />
</TouchableOpacity>
</View>
<View style={{marginLeft: '5%'}}>
<Text style={styles.notificationHeader}> Notifications</Text>
</View>
<ScrollView horizontal={false} overScrollMode={'auto'}>
<TouchableOpacity style={styles.notifPlace}>
<View style={styles.notifTextPlace}>
</View>
<Text style ={styles.text}>Anteriore, Inc.</Text>
</TouchableOpacity>
<TouchableOpacity style={styles.notifPlace}>
<View style={styles.notifTextPlace}>
</View>
<Text style ={styles.text}>The Palace Manila</Text>
</TouchableOpacity>
<TouchableOpacity style={styles.notifPlace}>
<View style={styles.notifTextPlace}>
</View>
<Text style ={styles.text}>Boozy.ph</Text>
</TouchableOpacity>
<TouchableOpacity style={styles.notifPlace}>
<View style={styles.notifTextPlace}>
</View>
<Text style ={styles.text}>Pet warehouse PH</Text>
</TouchableOpacity>
<TouchableOpacity style={styles.notifPlace}>
<View style={styles.notifTextPlace}>
</View>
<Text style ={styles.text}>Bark Central Dog Park & Cafe</Text>
</TouchableOpacity>
<TouchableOpacity style={styles.notifPlace}>
<View style={styles.notifTextPlace}>
</View>
<Text style ={styles.text}>Pet warehouse PH</Text>
</TouchableOpacity>
<TouchableOpacity style={styles.notifPlace}>
<View style={styles.notifTextPlace}>
</View>
<Text style ={styles.text}>Bark Central Dog Park & Cafe</Text>
</TouchableOpacity>
<Text> PLEASE HELP ME </Text>
<Text> PLEASE HELP ME </Text>
<Text> PLEASE HELP ME </Text>
<Text> PLEASE HELP ME </Text>
</ScrollView>
</View>
);
}
截图1:
屏幕截图2:(仅滚动到此处)
请提供您看到的样式表和屏幕截图 要添加的测试 高度=尺寸。获取(“窗口”)。高度 到您的父容器
也可以尝试将paddingBottom添加到您的scrollview样式表中这是react native的滚动视图中的一个已知问题,请在滚动视图的样式中使用
paddingBottom:100
100可以根据您所拥有的内容设置为任何值刚刚遇到这个问题,最终为我解决的是确保我的scrollview不是布局中的最后一个组件。因此,我在scrollview之后添加了一个不可见的组件(设置了一个高度以抵消我看不到的scrollview内容量)。在我的例子中,我为scrollview的包装组件添加了一个高度。这对我来说很有效 例如:-
{filteredItems.map((item)=>{item.title})
你能提供你的模拟器的截图吗?@BrijeshShiroya我已经上传了截图,请看一下。今天尝试添加,但没有成功。我在我的项目中添加了从a到j的touchableopacity,它只显示a。还尝试将paddingbottom更改为500,但仍然无法显示…在滚动视图中添加更多项目时会发生什么?paddingbottom用于滚动视图listview变大是的,我在滚动视图中添加了它并进行了尝试。显示的新项目是否与您的文本一样隐藏?我添加的一些项目显示出来了,但一些也没有。我希望他们能尽快解决这个问题。在我这里的问题中,我已经尝试了填充底部并增加了它的数量,但它不起作用。所有的项目都不会显示。我尝试添加更多项目以确保,但它仍然无法显示所有内容。您是否尝试过此操作:高度=尺寸。获取(“窗口”)。高度对我来说,您的父容器似乎不在视野中。我回家后会尝试,我现在正在旅行,并将尽快尝试。
import { StyleSheet } from 'react-native'
import { Metrics, ApplicationStyles, Colors } from '../../Themes/'
export default StyleSheet.create({
...ApplicationStyles.screen,
container: {
paddingBottom: Metrics.baseMargin
},
logo: {
marginTop: Metrics.doubleSection,
height: Metrics.images.logo,
width: Metrics.images.logo,
resizeMode: 'contain'
},
centered: {
alignItems: 'center'
},
parentContainer: {
flex:1,
backgroundColor: Colors.white
},
notificationHeader: {
justifyContent: 'flex-start',
fontFamily: 'CoreSansD45Medium',
marginTop: 40,
marginBottom: 20,
fontSize: 20,
color: Colors.gray,
textAlign: 'left',
},
notifPlace: {
flexGrow: 0,
flexDirection: 'row',
backgroundColor: Colors.white,
width: '100%',
height: '12%',
borderWidth: 0.5,
borderColor: Colors.buttonGray,
},
notifTextPlace: {
width:60,
height:60,
borderRadius: 60/2,
backgroundColor:Colors.buttonGray ,
alignSelf: 'center',
justifyContent: 'flex-start',
marginLeft: '5%',
marginRight: 10,
marginBottom: 20,
marginTop: 20,
},
text: {
fontFamily: 'CoreSansD45Medium',
fontSize: 15,
alignSelf: 'center',
color: Colors.gray,
marginBottom: 10,
},
text2: {
alignSelf: 'center',
fontFamily: 'CoreSansD35Regular',
fontSize: 15,
marginBottom: 10,
},
})
<View style={{ height: hp(500) }}>
<ScrollView showsVerticalScrollIndicator={false}>
{filteredItems.map((item) => <Text style={styles.listItemText}>{item.title}</Text>)}
</ScrollView>
</View>