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

AsyncStorage won't be in RN core anymore #1260

Closed
MoOx opened this issue Feb 27, 2019 · 12 comments
Closed

AsyncStorage won't be in RN core anymore #1260

MoOx opened this issue Feb 27, 2019 · 12 comments

Comments

@MoOx
Copy link
Contributor

MoOx commented Feb 27, 2019

Is your feature request related to a problem? Please describe.

AsyncStorage module has been moved into a separate package https://github.com/react-native-community/react-native-async-storage

Describe a solution you'd like

Should we do something similar?

Describe alternatives you've considered

Since RNW is a monorepo, we could create react-native-async-storage-web (or react-native-web-async-storage.

@SimenB
Copy link

SimenB commented Feb 28, 2019

Ideally, wouldn't a web implementation live in https://github.com/react-native-community/react-native-async-storage?

@MoOx
Copy link
Contributor Author

MoOx commented Feb 28, 2019

@SimenB if community is ok for it, I would say clearly YES.

@necolas
Copy link
Owner

necolas commented Mar 8, 2019

Does someone want to open an issue in the community repo about moving the implementation there?

@piranna
Copy link

piranna commented Mar 10, 2019

It would be just a copy&paste, but ideally, it would need to be an implementation wrapper of the low level platform dependent native implementation, added to the NativeModules object, so the high level logic is common to all platforms. This way it would be easier it gets merged and maintained upstream. Is that possible.

@arqex
Copy link

arqex commented Mar 13, 2019

I like @piranna's idea. In fact I have just found this issue looking for a way to plug a "native" module for the web, after reading this issue: #470

If we had a standard way to hook our modules into react-native-web, it would be easier to implement (or mock) web versions of many react-native libraries.

@krizzu
Copy link

krizzu commented Apr 3, 2019

Hey everyone 👋

I'm maintainer of Async Storage on RN community Repo and I love the idea of having support for the web in the same repo. I'm up for doing adding this in upcoming days.

Regarding @piranna idea, my long-term plan for the library is to add a functionality similar to Adapter pattern used in Android community, where there's one public facing interface (getItem, setItem etc.), but underlying implementation is based on "adapter", which can change by developers/based on target platform. I believe this could help with hooking modules into react-native-web.

@piranna
Copy link

piranna commented Apr 3, 2019

@krizzu your idea looks nice, it would also allow to change what backend implementation to use :-)

@krizzu
Copy link

krizzu commented Apr 3, 2019

Hey @piranna,

Thank you, and yes, that's exactly why I'd love to introduce this feature. I'll start to write roadmap, but in meantime, if someone would like to contribute, I'd be more than happy to help with Async Storage's web support.

@MoOx
Copy link
Contributor Author

MoOx commented Apr 3, 2019

@krizzu if I am correct, you can probably just move the code from this repo (as it's supported) to yours?

@cohawk
Copy link

cohawk commented Apr 23, 2019

As @MoOx says, just copying the existing code over for now would relieve us who try and run RN and RNWeb with the same codebase from having separate imports for async-storage

@zhigang1992
Copy link
Contributor

zhigang1992 commented Apr 27, 2019

Before it's moved over to @react-native-community/async-storage we can do this with webpack alias, customize-cra for create-react-app

addWebpackAlias({
  '@react-native-community/async-storage': 'react-native-web/dist/exports/AsyncStorage/index.js'
}),

@necolas
Copy link
Owner

necolas commented May 20, 2019

Please move this conversation to the repo where the API would be maintained.

react-native-async-storage/async-storage#52

@necolas necolas closed this as completed May 20, 2019
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

8 participants