小编Jin*_*Jin的帖子

React Native 导航显示白屏

使用反应本机导航进行编译时出现白屏,请问为什么会这样?我似乎没有收到任何错误代码,什么也没有,我只看到一个白屏。为什么会这样呢?我的代码看起来像这样,表明到目前为止我似乎没有任何错误。

这是错误的样子 错误抽屉.png

正如您所看到的,它看起来并成功编译,但是当我尝试查看到目前为止我所做的事情时,我得到一个纯白色的屏幕

我的代码如下所示:

应用程序.js

//import liraries
import React, { Component } from 'react';
import { View, Text, StyleSheet } from 'react-native';
import DrawerNavigator from './components/ControlPage';

// create a component
class App extends Component {
  render() {
    return (
      <View style={styles.container}>
        <DrawerNavigator/>
      </View>
    );
  }
}

// define your styles
const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#FFF',
  },
});

//make this component available to the app
export default App;
Run Code Online (Sandbox Code Playgroud)

控制页面.js

import React, { …
Run Code Online (Sandbox Code Playgroud)

navigation react-native

2
推荐指数
1
解决办法
7832
查看次数

标签 统计

navigation ×1

react-native ×1