小编Wes*_*rra的帖子

React Native TypeError store.getState不是一个函数

大家好,我正在尝试使我的代码更具可读性和实用性。

在React Native中使用redux-saga我遇到了一些问题。

当我尝试加载应用程序时,出现错误:

TypeError:store.getState不是函数

该错误位于:

in Connect(Reprov) (at App.js:17)
in RCTView (at View.js:44)
in Provider (at App.js:14)
in App (at renderApplication.js:34)
in RCTView (at View.js:44)
in RCTView (at View.js:44)
in AppContainer (at renderApplication.js:33)
Run Code Online (Sandbox Code Playgroud)

src / store / configureStore.js


import {createStore, applyMiddleware} from 'redux'
import createSagaMiddleware from 'redux-saga';
import rootReducer from '../reducers';
import rootSaga from '../sagas';

export default function () {
  const sagaMiddleware = createSagaMiddleware();
  const store = createStore(
    rootReducer,
    applyMiddleware(sagaMiddleware)
  );

  sagaMiddleware.run(rootSaga)

  return store;
}
Run Code Online (Sandbox Code Playgroud)

src / App.js

import …
Run Code Online (Sandbox Code Playgroud)

javascript react-native redux-saga react-redux

1
推荐指数
1
解决办法
1278
查看次数

'NSInternalInconsistencyException',原因:'请求的第 (0) 部分的行数超出范围。'

当我尝试在 iOS 13 上运行我的应用程序时,出现此错误,旧版本运行正常。

'NSInternalInconsistencyException', reason: 'Requested the number of rows for section (0) which is out of bounds.'
Run Code Online (Sandbox Code Playgroud)

我认为这就是导致异常的原因

override func reloadData() {
    super.reloadData()

    let rows = self.numberOfRows(inSection: 0) // what I know is that this line is causing the exception
    if (rows > 0) {
        if placeholderStackView != nil {
            self.placeholderStackView.removeFromSuperview()
        }
    } else {
        setTableStatus(type: .empty)
    }

}
Run Code Online (Sandbox Code Playgroud)

当我将变量行设置为一个数字时,它会毫无例外地加载,我认为 UITableView SDK 的更新导致了它,我尝试在谷歌上搜索一些见解,但没有成功。

uitableview ios swift

1
推荐指数
1
解决办法
1622
查看次数