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

React Native项目中报错 #24

Closed
roytan883 opened this issue May 26, 2020 · 7 comments
Closed

React Native项目中报错 #24

roytan883 opened this issue May 26, 2020 · 7 comments

Comments

@roytan883
Copy link

尝试在RN中使用,但是加载编译就失败了

error: Error: Unable to resolve module `react-dom` from `node_modules\concent\src\core\base\append-dispatcher.js`: react-dom could not be found within the project.
@fantasticsoul
Copy link
Contributor

fantasticsoul commented May 27, 2020

升级到2.5.1即可,最新版本在内部去掉了react-dom依赖.

btw, 欢迎提出更多关于concent搭配react-native的issues

@roytan883
Copy link
Author

@fantasticsoul

Can't find variable: localStorage

concent\src\cc-context\index.js 264:26

RN 官方建议使用
https://github.com/react-native-community/async-storage
这个库好像也支持web

@fantasticsoul
Copy link
Contributor

RN 官方建议使用
https://github.com/react-native-community/async-storage
这个库好像也支持web

感谢推荐,升级至2.5.2即可,调整了localStorage的获取策略,在web环境默认是window.localStorage,在rn环境,你需要人工的在run的时候在options参数里传入第三方实现库

import AsyncStorage from '@react-native-community/async-storage';
import { run } from 'concent';

run({
     /** your store config */
  },{
   localStorage: AsyncStorage,
})

@fantasticsoul
Copy link
Contributor

你好,现在最新的情况如何了呢

@roytan883
Copy link
Author

不好意思,今天在忙其它的,我明天来测试 2.5.2

@roytan883
Copy link
Author

@fantasticsoul OK,已经可以正常使用了。没有全面测试,但是基本的appCtx.setStateappCtx.moduleComputed.fullName2, appCtx.moduleReducer.changeFirstName都是可以使用的

@fantasticsoul
Copy link
Contributor

好的,感谢提供帮助,欢迎继续提供新的issue,有了你们 concent才会越来越好越来越强大

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

2 participants