带有react-navigation的React-Native中DrawerNavigator中的问题

时间:2019-06-09 02:42:06

标签: javascript react-native navigation-drawer react-navigation

我试图在我的应用程序中实现一个Drawer Navigator,但是它返回此错误。

我正在使用React-Native和react-navigation以及用于模拟器的android 9.0

错误消息: App return

import React, { Component } from "react";
import {
  Platform,
  StyleSheet,
  Text,
  View,
  ScroollView,
  Dimensions,
  Image
} from "react-native";
import {
  createDrawerNavigator,
  createAppContainer,
  DrawerItems,
  SafeAreaView[enter image description here][3]
} from "react-navigation";

import LoginScreen from "./Screens/Login/LoginScreen";
import HomeScreen from "./Screens/Home/HomeScreen";

type Props = {};
export default class App extends Component<Props> {
  render() {
    return <Apps />;
  }
}

const CustomDrawerComponent = props => (
  <SafeAreaView style={{ flex: 1 }}>
    <View
      style={{
        height: 150,
        backgroundColor: "white",
        alignItems: "center",
        justifyContent: "center"
      }}
    >
      <Image
        source={require("./images/perfil.png")}
        style={{ height: 120, width: 120, borderRadius: 60 }}
      />
    </View>
    <ScroollView>
      <DrawerItems {...props} />
    </ScroollView>
  </SafeAreaView>
);

const AppDrawerNavigator = createDrawerNavigator(
  {
    Home: HomeScreen,
    Settings: LoginScreen
  },
  {
    contentComponent: CustomDrawerComponent
  }
);
const Apps = createAppContainer(AppDrawerNavigator);

const styles = StyleSheet.create({});

我希望该应用程序从侧面菜单开始运行。

1 个答案:

答案 0 :(得分:0)

问题出在我的代码中。我的坏xd是ScrollView而不是ScroollView