首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >not本机:_reactotronReactNative2.default.createStore不是一个函数

not本机:_reactotronReactNative2.default.createStore不是一个函数
EN

Stack Overflow用户
提问于 2019-05-16 20:53:02
回答 1查看 1.1K关注 0票数 0

在我的Reactive原住民应用程序中,我无法让Reactotron工作,这意味着它不会连接到我的应用程序。这个应用程序确实有"reactotron-react-native": "1.14.0", "reactotron-redux": "1.13.0",

我分别升级到"reactotron-react-native": "^3.5.0","reactotron-redux": "^3.1.0",我的应用程序坏了,但现在它正在连接到Reactotron:

Reactotron本身告诉我,问题出现在App.js文件的第53行,这是下面最后一行代码:

代码语言:javascript
复制
//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的存在,它似乎是一种有效的调试工具,我想知道是否有人在使用"reactotron-react-native": "^3.5.0","reactotron-redux": "^3.1.0",可能知道第53行发生了什么?

我假设它需要一个重构,就像大多数响应本机破坏的更改一样,但是我还没有找到任何关于如何配置store的文档,如果这行是必需的。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-05-21 17:26:34

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

我必须确保我已经像这样导入了createStore

代码语言:javascript
复制
import {createStore, applyMiddleware, compose, combineReducers} from 'redux';

然后对商店进行如下重构:

代码语言:javascript
复制
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()));
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56176449

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档