React Native:_reactotronReactNative2.default.createStore不是一个函数

时间:2019-05-16 20:53:02

标签: reactjs react-native reactotron

在我的React Native应用程序中,我无法使Reactotron工作,这意味着它无法连接到我的应用程序。该应用程序确实有success: function(data){ if(data.status == 200){ $.ajax({ url: '{{route('second route)}}', method: 'GET', success: function(response){ $('.thanks').innerHTML = reponse $('#hideFrom').hide() $('.thanks').show() } }) } } "reactotron-react-native": "1.14.0",

,我分别升级到"reactotron-redux": "1.13.0","reactotron-react-native": "^3.5.0",,我的应用程序坏了,但是现在它正在连接到Reactotron UI: enter image description here

Reactotron本身告诉我问题出在"reactotron-redux": "^3.1.0"文件的第53行,这是下面的代码的最后一行:

App.js

我刚刚熟悉Reactotron的存在,并且看起来它是调试的有效工具,我想知道是否正在使用//eslint-disable-next-line console.ignoredYellowBox = ["Setting a timer"]; import './ReactotronConfig'; import React, {PureComponent} from 'react'; import { StyleSheet, View, StatusBar, Linking, Platform, Alert, } from 'react-native'; import {applyMiddleware, compose, combineReducers} from 'redux'; import {Provider} from 'react-redux'; import thunkMiddleware from 'redux-thunk'; import Reactotron from 'reactotron-react-native'; import logger from 'logger'; import OneSignal from 'react-native-onesignal'; import SplashScreen from 'react-native-splash-screen'; import {Sentry} from 'react-native-sentry'; import { setJSExceptionHandler, setNativeExceptionHandler, } from 'react-native-exception-handler'; import {jsHandler, nativeHandler} from 'utils/error-handlers'; import RootNavigation from 'navigation/RootNavigation'; import LocalStorage from 'services/LocalStorage'; import reducers from 'reducers'; import { setCurrentUser, validateUserInformationForVoterVoice, } from 'auth/loginActions'; import {handleEventsDeepLink} from 'events/actions'; import {handleBallotsDeepLink} from 'surveys-ballots/actions'; import {setResetPasswordKey} from 'auth/registrationActions'; import {setNotificationData, deepLinkReceived} from 'navigation/actions'; import {view} from 'utils/view'; import {v2Colors} from 'theme'; import env from 'env'; import base from 'base-endpoint'; import * as appcenter from 'utils/appcenterLogger'; import * as cache from 'utils/cache'; import * as regex from 'utils/helpers/regex'; const appReducer = combineReducers({ ...reducers, }); const middleware = applyMiddleware(thunkMiddleware); //react-native-debugger config // eslint-disable-next-line no-underscore-dangle const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose; const store = Reactotron.createStore(appReducer, composeEnhancers(middleware)); "reactotron-react-native": "^3.5.0",的人可能知道发生了什么在第53行?我假设它像大多数React Native一样需要重构,但是我还没有找到关于如何配置"reactotron-redux": "^3.1.0"的文档,如果该行甚至是必须的话。如果有人知道,请帮助。

1 个答案:

答案 0 :(得分:0)

根据文档: https://github.com/infinitered/reactotron/blob/master/docs/plugin-redux.md

我必须确保已这样导入createStore

import {createStore, applyMiddleware, compose, combineReducers} from 'redux';

然后像这样重构商店:

const appReducer = combineReducers({
  ...reducers,
});
const middleware = applyMiddleware(thunkMiddleware);
//react-native-debugger config
// eslint-disable-next-line no-underscore-dangle
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
// const store = Reactotron.createStore(appReducer, composeEnhancers(middleware));
const store = createStore(appReducer, composeEnhancers(middleware, Reactotron.createEnhancer()));