2017-05-16 2 views
0

Nach der erfolgreichen Initialisierung eines Template-Builds einer React-nativen App mit Expo habe ich begonnen, meine eigene Vorlage einschließlich redux hinzuzufügen. Es gibt folgende Fehler (im Remote-Debug-Fenster):React-native (expo) - ungültiger Typ

Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in. 

Check your code at App.js:10. 
    in Unknown (created by AwakeInDevApp) 
    in RCTView (at View.js:514) 
    in View (created by AwakeInDevApp) 
    in AwakeInDevApp (at registerRootComponent.js:21) 
    in ExponentRootComponent (at renderApplication.js:35) 
    in RCTView (at View.js:514) 
    in View (at AppContainer.js:93) 
    in RCTView (at View.js:514) 
    in View (at AppContainer.js:92) 
    in AppContainer (at renderApplication.js:34) 
reactConsoleErrorHandler @ crna-entry.bundle:6725 
newConsoleFunc @ crna-entry.bundle:52943 
console.error @ crna-entry.bundle:36227 
printWarning @ crna-entry.bundle:3015 
warning @ crna-entry.bundle:3036 
createElement @ crna-entry.bundle:17021 
exports.default @ crna-entry.bundle:81790 
(anonymous) @ crna-entry.bundle:21644 
measureLifeCyclePerf @ crna-entry.bundle:21459 
_constructComponentWithoutOwner @ crna-entry.bundle:21643 
_constructComponent @ crna-entry.bundle:21620 
mountComponent @ crna-entry.bundle:21513 
mountComponent @ crna-entry.bundle:17847 
mountChildren @ crna-entry.bundle:21043 
initializeChildren @ crna-entry.bundle:20502 
mountComponent @ crna-entry.bundle:20562 
mountComponent @ crna-entry.bundle:17847 
performInitialMount @ crna-entry.bundle:21686 
mountComponent @ crna-entry.bundle:21590 
mountComponent @ crna-entry.bundle:17847 
performInitialMount @ crna-entry.bundle:21686 
mountComponent @ crna-entry.bundle:21590 
mountComponent @ crna-entry.bundle:17847 
performInitialMount @ crna-entry.bundle:21686 
mountComponent @ crna-entry.bundle:21590 
mountComponent @ crna-entry.bundle:17847 
mountChildren @ crna-entry.bundle:21043 
initializeChildren @ crna-entry.bundle:20502 
mountComponent @ crna-entry.bundle:20562 
mountComponent @ crna-entry.bundle:17847 
performInitialMount @ crna-entry.bundle:21686 
mountComponent @ crna-entry.bundle:21590 
mountComponent @ crna-entry.bundle:17847 
mountChildren @ crna-entry.bundle:21043 
initializeChildren @ crna-entry.bundle:20502 
mountComponent @ crna-entry.bundle:20562 
mountComponent @ crna-entry.bundle:17847 
performInitialMount @ crna-entry.bundle:21686 
mountComponent @ crna-entry.bundle:21590 
mountComponent @ crna-entry.bundle:17847 
performInitialMount @ crna-entry.bundle:21686 
mountComponent @ crna-entry.bundle:21590 
mountComponent @ crna-entry.bundle:17847 
performInitialMount @ crna-entry.bundle:21686 
mountComponent @ crna-entry.bundle:21590 
mountComponent @ crna-entry.bundle:17847 
mountComponentIntoNode @ crna-entry.bundle:22829 
perform @ crna-entry.bundle:18133 
batchedMountComponentIntoNode @ crna-entry.bundle:22836 
perform @ crna-entry.bundle:18133 
batchedUpdates @ crna-entry.bundle:17658 
batchedUpdates @ crna-entry.bundle:17727 
renderComponent @ crna-entry.bundle:22881 
render @ crna-entry.bundle:6353 
renderApplication @ crna-entry.bundle:49001 
run @ crna-entry.bundle:48790 
runApplication @ crna-entry.bundle:48830 
__callFunction @ crna-entry.bundle:3451 
(anonymous) @ crna-entry.bundle:3322 
guard @ crna-entry.bundle:3286 
callFunctionReturnFlushedQueue @ crna-entry.bundle:3321 
(anonymous) @ debuggerWorker.js:71 
crna-entry.bundle:6717 Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in. 

Check the render method of `StatelessComponent`. 
handleException @ crna-entry.bundle:6717 
handleError @ crna-entry.bundle:6577 
reportFatalError @ crna-entry.bundle:683 
guard @ crna-entry.bundle:3288 
callFunctionReturnFlushedQueue @ crna-entry.bundle:3321 
(anonymous) @ debuggerWorker.js:71 
crna-entry.bundle:52943 Remote debugger is in a background tab which may cause apps to perform slowly. Fix this by foregrounding the tab (or opening it in a separate window). 
newConsoleFunc @ crna-entry.bundle:52943 
console.warn @ crna-entry.bundle:36235 
(anonymous) @ debuggerWorker.js:25 
(anonymous) @ debuggerWorker.js:53 

App.js ist:

import React from 'react'; 
import Provider from 'react-redux'; 
import HomeScreen from './components/HomeScreen'; 
import createStore from './createStore'; 

const store = createStore(); 

export default() => (
    <Provider store={store}> 
    <HomeScreen /> 
    </Provider> 
); 

Und der vollständige Code: https://github.com/wastelandtime/rpgame

Bitte beraten.

Antwort

1

In Ihrer App.js importieren Sie Ihren Provider als Standardmodul, aber er heißt eigentlich export.

So wechseln Sie in

import { Provider } from 'react-redux';

+0

Das ist es. Vielen Dank. Ich weiß nicht, wie ich es verpasst habe. – Wasteland