React Native Router Flux - 期望组件 class,单击按钮转到另一个屏幕时得到 [object Object]

React Native Router Flux - expected a component class, got [object Object] when click a button to go to another screen

我正在获取组件 class 在使用 react-native-router-flux 时出现对象错误,这是我的 app.js 文件和组件文件。

app.js

import * as React from 'react';
import { Text, View, StyleSheet } from 'react-native';
import ScarletScreen from './components/ScarletScreen';
import GrayScreen from './components/GrayScreen';
import {Router, Scene} from 'react-native-router-flux';

const App = () => {

    return (
     <Router>
      <Scene key = "root">

        <Scene
          key = "scarlet"
          component =  {ScarletScreen }
          title = "Scarlet"
          initial
        />


      <Scene
          key = "gray"
          component = { GrayScreen }
          title = "Gray"
        />
      </Scene>

     </Router>
    );
  }

export default App;

ScarletScreen.js

import React, { Component } from 'react';
import { Text, View, Button } from 'react-native';

import { Actions } from 'react-native-router-flux';

const ScarletScreen = () => {
  return (
    <View
      style={{
        backgroundColor: '#bb0000',
        flex: 1,
        alignItems: 'center',
        justifyContent: 'center',
      }}>
      <Text>Scarlet Screen</Text>

      <Button title="IR PARA GRAY" onPress={() => Actions.gray()} />
    </View>
  );
};

export default ScarletScreen;

GrayScreen.js

import React, { Component } from 'react';
import {Text, View} from 'react-native';

import { Actions } from 'react-native-router-flux';

const GrayScreen = () => {
  return(
    <View style={{backgroundColor: '#666666', flex: 1, alignItems: 'center', justifyContent: 'center'}}>
      <Text>Gray Screen</Text>
    </View>
  );
};

当我点击按钮时,显示错误 "element type is invalid: expected a string"。

您需要确保导出所有组件。 GrayScreen 缺少导出。

export default Grayscreen