2017-07-12 20 views
0

私はReact-Nativeで作業を開始し、iOSを実行しました。 私はgithubで共有されているが最新の依存関係にアップグレードするf8Appに基づいてアプリケーションを作成しています。React Native with Redux - 予期しないトークン

私も、このアプリを実行するためにReduxのを使用しています。この場合の最初の目標は、firebase Authを使用するログインページをロードすることです。以下は

setup.jsです:

/** 
* @flow 
*/ 

'use strict'; 

import React, { Component } from 'React'; 
import {Provider} from 'react-redux'; 
import AsistenciaApp from './AsistenciaApp'; 
import {configureStore} from './store/configureStore'; 

function setup(): ReactClass<{}> { 
    class Root extends Component { 
     state: { 
      isLoading: boolean; 
      store: any; 
     }; 

     constructor() { 
      super(); 
      this.state = { 
       isLoading = true, 
       store: 
        configureStore(
         () => this.setState({isLoading: false}) 
        ) 
      }; 
     } 

     render() { 
      if (this.state.isLoading) { 
       return null; 
      } 

      return (
       <Provider store={this.state.store}> 
        <AsistenciaApp /> 
       </Provider> 
      ); 
     }; 
    } 

    return Root; 
} 

module.exports setup; 

私はreact-native run-iosを実行すると、私は次のエラーを取得:私はそのためのコードを添付の下、

Syntax Error setup.js Unexpected token, expected, (25,30)

この機能configureStoreを指しファイル:

/** 
* 
* @flow 
*/ 

'use strict'; 

import {applyMiddleware, createStore} from 'redux'; 
import thunk from 'redux-thunk'; 
import promise from './promise'; 
import array from './array'; 
import {createLogger} from 'redux-logger'; 
import reducers from '../reducers'; 
import {persistStore, autoRehydrate} from 'redux-persist'; 
import {AsyncStorage} from 'react-native'; 


let isDebuggingInChrome = __DEV__ && !!window.navigator.userAgent; 

let logger = createLogger({ 
    predicate: (getState, action) => isDebuggingInChrome, 
    collapsed: true, 
    duration: true, 
}); 

let createD4mStore = applyMiddleware(thunk, promise, array, logger)(createStore); 

function configureStore(onComplete: ?() => void) { 
    const store = autoRehydrate()(createD4mStore)(reducers); 
    persistStore(store, {storage: AsyncStorage}, onComplete); 
    if (isDebuggingInChrome) { 
     window.store = store; 
    } 

    return store; 
} 

module.exports = configureStore; 

私は間違って何をしていますか?

答えて

0

あなたはdefaultとしてエクスポートconfigureStoreを持っています。置き換え:

import {configureStore} from './store/configureStore'; 

import configureStore from './store/configureStore'; 

またはエクスポートconfigureStoreexportという名前の通り。置き換え:

module.exports = configureStore; 

export configureStore; 
関連する問題