Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rn-babelHelpers.objectDestructuringEmpty #939

Closed
jaikensai888 opened this issue May 28, 2017 · 3 comments
Closed

Rn-babelHelpers.objectDestructuringEmpty #939

jaikensai888 opened this issue May 28, 2017 · 3 comments

Comments

@jaikensai888
Copy link

在React-native 中使用了dva 出现了babelHelpers.objectDestructuringEmpty 错误,这个错误在打开了hotLoading模式后消失。求解决方案.谢谢 @sorrycc 。我的配置是参考 react-native-dva-starter的
.babelrc:
{
"presets": [
"react-native"
],
"plugins": [
"transform-decorators-legacy",
[
"import",
{
"libraryName": "antd-mobile"
}
]
]
}

npm:
"dependencies": {
"antd-mobile": "^1.1.3",
"axios": "^0.16.1",
"babel-runtime": "^6.23.0",
"dva": "^1.2.1",
"prop-types": "^15.5.9",
"react": "16.0.0-alpha.6",
"react-dom": "^15.5.4",
"react-native": "0.44.0",
"react-native-image-picker": "^0.26.3",
"react-native-image-zoom-viewer": "^2.0.5",
"react-native-router-flux": "^3.38.0",
"redux-persist": "^4.6.0"
},
"devDependencies": {
"babel-jest": "20.0.1",
"babel-plugin-import": "^1.1.1",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-react-native": "^1.9.1",
"jest": "20.0.1",
"node-cmd": "^3.0.0",
"react-test-renderer": "16.0.0-alpha.6",
"remote-redux-devtools": "^0.5.0",
"remote-redux-devtools-on-debugger": "^0.7.1"
},
"jest": {
"preset": "react-native"
}

@sorrycc
Copy link
Member

sorrycc commented Jun 1, 2017

没明白问题,但感觉和 dva 无关。

@nihgwu
Copy link
Member

nihgwu commented Jun 1, 2017

跟 dva 无关,应该是代码写错了,看看这个 facebook/react-native#4831 (comment)

@sorrycc sorrycc closed this as completed Jun 1, 2017
@jaikensai888
Copy link
Author

问题原因找到了,错误是因为在effect中使用了{}作为值

 effects: {
        *method({ payload: {  }}, { select,call, put }) {
        },

在关闭了hotModel 之后 payLoad这种参数为{}的写法不被支持;
修改成下面的方法,就没有报错了:

 effects: {
        *method({ payload}, { select,call, put }) {
        },

@nihgwu @sorrycc thank you all the same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants