Javascript 反应本机:滚动视图未显示全部内容
我正在用React Native构建一个应用程序,在我的主页上我使用ScrollView,但它没有显示全部内容。我有e头在顶部,所以可能会阻止完整的内容或我不知道 守则:Javascript 反应本机:滚动视图未显示全部内容,javascript,reactjs,react-native,scrollview,Javascript,Reactjs,React Native,Scrollview,我正在用React Native构建一个应用程序,在我的主页上我使用ScrollView,但它没有显示全部内容。我有e头在顶部,所以可能会阻止完整的内容或我不知道 守则: import React from "react"; import { View, StyleSheet, Text, ScrollView } from "react-native"; import Content from "../components/Content/content"; import Header fro
import React from "react";
import { View, StyleSheet, Text, ScrollView } from "react-native";
import Content from "../components/Content/content";
import Header from "../components/Header/header";
import Carousel1 from "../components/Carousel/index";
import Buttons from "../components/Buttons/buttons";
export default class HomeScreen extends React.Component {
static navigationOptions = ({ navigation }) => {
let drawerLabel = "Home";
return { drawerLabel };
};
render() {
return (
<View style={styles.container}>
<Header {...this.props} />
<ScrollView style={{flex:1}}>
<Carousel1 />
<Content />
<Buttons />
</ScrollView>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#f9f9f9"
}
});
从“React”导入React;
从“react native”导入{View,StyleSheet,Text,ScrollView};
从“./组件/内容/内容”导入内容;
从“./组件/标题/标题”导入标题;
从“./组件/转盘/索引”导入转盘1;
从“./组件/按钮/按钮”导入按钮;
导出默认类主屏幕扩展React.Component{
静态导航选项=({navigation})=>{
让抽屉标签=“主页”;
返回{drawerLabel};
};
render(){
返回(
);
}
}
const styles=StyleSheet.create({
容器:{
弹性:1,
背景颜色:“f9f9f9”
}
});
知道如何解决此问题吗?尝试使用react native Flatlist而不是ScrollView: 尝试使用而不是
样式
由于我无法访问您的Carousel1
、内容
和按钮
组件,因此我建议您尝试以下操作:
render() {
return (
<View style={styles.container}>
<Header {...this.props} />
<ScrollView contentContainerStyle={{ flexDirection:"column" }}>
<Carousel1 />
<Content />
<Buttons />
</ScrollView>
</View>
);
}
}
render(){
返回(
);
}
}
报告您的结果。从ScrollView中删除style={{{flex:1}}并查看查看expo零食示例:我曾经遇到过这个问题,我用Flatlist解决了它。。。这与标题几乎是一样的,我在主容器上有flex:1,flex-direction:column,出于某种原因,我还将Flatlist放在另一个容器中。