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 not available in RNW 0.12 #6654

Closed
Sharathnasa opened this issue Jan 2, 2020 · 17 comments
Closed

AsyncStorage not available in RNW 0.12 #6654

Sharathnasa opened this issue Jan 2, 2020 · 17 comments
Assignees
Labels
Platform: web Using Expo in the browser

Comments

@Sharathnasa
Copy link

Hi Team,

I'm getting the below mentioned error when i try run application in the web mode.

/node_modules/expo/build/Notifications/Notifications.js
Module not found: Can't resolve 'react-native-web/dist/exports/AsyncStorage' in '/Users/i322865/node_modules/expo/build/Notifications'

I'm using the latest expo(0.36, same error i faced when i was using 0.35 version as well) and react native web 0.12.0-rc.1. Please help to solve this issue and let me know if you require any further details

Regards,
Sharath

@Sharathnasa Sharathnasa added the bug label Jan 2, 2020
@cruzach
Copy link
Contributor

cruzach commented Jan 3, 2020

Hi! Sorry, but the Notifications module isn't available for web. I'll update the docs to reflect that

Otherwise, hard to say what could be going on here without all the info we ask for in the bug report template. This snack uses AsyncStorage on web without an issue, so you might try debugging with it.

If you still have problems, please provide a full repro and I can reopen

@cruzach cruzach closed this as completed Jan 3, 2020
@jaulz
Copy link
Contributor

jaulz commented Feb 4, 2020

AsyncStorage is deprecated from 0.12on react-native-web and that's causing the issues I think.
@cruzach why is it not available on web? At least we do have the .web.js files here and I'm using it without issues.

@cruzach
Copy link
Contributor

cruzach commented Feb 4, 2020

It's not explicitly supported. We have some code around it, but it's not a full implementation yet

@jaulz
Copy link
Contributor

jaulz commented Feb 5, 2020

Ah, thanks for the clarification 😊

@actuallymentor
Copy link
Contributor

It's not explicitly supported. We have some code around it, but it's not a full implementation yet

Even when not importing the Notification module I'm getting this error when using 0.12 of react-native-web.

@zeptonaut
Copy link

Yep - I searched my project for "import.*Notification" and nothing came up. I think this might be getting pulled in as a recursive dependency through another file that is web compatible, which is causing the problems.

Are there any guards in place to prevent Notifications from being pulled in as a transitive dependency of web-compatible files?

@Norfeldt
Copy link
Contributor

Norfeldt commented Apr 1, 2020

@cruzach are you sure that the bug issue should be marked closed?
I'm also having the issue

@shubhamdeol
Copy link

@cruzach Please reopen this issue, I'm also having the same problem

@cruzach cruzach reopened this Apr 7, 2020
@cruzach
Copy link
Contributor

cruzach commented Apr 10, 2020

If you're having this issue, please share a minimal reproducible demo

For those using react-native-web 0.12, the version pinned in SDK 37 projects is 0.11

@cruzach cruzach added needs repro Platform: web Using Expo in the browser and removed bug labels Apr 10, 2020
@actuallymentor
Copy link
Contributor

If you're having this issue, please share a minimal reproducible demo

I think we've established that the issue arises when people update their react-native-web version.

@younes0
Copy link

younes0 commented Apr 13, 2020

the deprecated react-native AsyncStorage is not compatible with react-native-web 12.x.x and we can't use https://github.com/react-native-community/async-storage (which has support for web) unless we link (so need to eject)

please see:
react-native-async-storage/async-storage#317
necolas/react-native-web#1515 (comment)

@cruzach cruzach changed the title AsyncStorage module not found in /expo/build/Notifications AsyncStorage not available in RNW 0.12 Apr 13, 2020
@actuallymentor
Copy link
Contributor

Browsers have native storage support that should be easy to implement. This is also perhaps relevant for expo secure storage web support.

hyochan added a commit to dooboolab-community/dooboo-expo that referenced this issue Apr 16, 2020
- Issue is expo web currently expo/expo#6654
@AdityaRanjanSingh
Copy link

I am facing the same issue as well. did you guys find a workaround

@actuallymentor
Copy link
Contributor

Note that this is NOT a secure storage method, but an unsecure drop-in you could use for non sensitive items:

// This is NOT secure storage, just local storage
const { localStorage } = window

const UnsecureStorage = {
	getItemAsync: key => localStorage.getItem( key ),
	setItemAsync: ( key, value ) => localStorage.setItem( key, value ),
	deleteItemAsync: key => localStorage.removeItem( key )
}

export default UnsecureStorage

@cruzach
Copy link
Contributor

cruzach commented May 20, 2020

this would be addressed by #8315

@deltamish
Copy link

deltamish commented Jun 14, 2020

Still having this issue after installing react-native-community/async-storage
command used: yarn add @react-native-community/async-storage

web Failed to compile.

D:/Work/Projects/VS/react-native-test/test-pdf-app/node_modules/expo/build/Notifications/Notifications.js
Module not found: Can't resolve 'react-native-web/dist/exports/AsyncStorage' in 'D:\Work\Projects\VS\react-native-test\test-pdf-app\node_modules\expo\build\Notifications'

Its highly difficult for a newcomer to find the answer as all closed comments led to hopping back and forth between multiple pages with no definitive solution.
Guess it would be better to have text saying what exactly to do in AsyncStorage doc in some frequently faced problem sub tag.

hyochan added a commit to dooboolab-community/dooboo-expo that referenced this issue Jun 26, 2020
- Issue is expo web currently expo/expo#6654
hyochan added a commit to dooboolab-community/dooboo-expo that referenced this issue Jun 26, 2020
* Upgrade expo sdk to 37
* RootStackNavigator coverage for dark mode
* Upgrade packages
   - Issue is expo web currently expo/expo#6654
* Correctly import styled-component from /native package
* Remove unused packages
* Upgrade packages and downgrade react-native-web to 0.11
@EvanBacon
Copy link
Contributor

This is fixed in SDK 38

@EvanBacon EvanBacon self-assigned this Jul 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: web Using Expo in the browser
Projects
None yet
Development

No branches or pull requests