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

Support Expo SDK 36 #375

Merged
merged 1 commit into from May 11, 2020
Merged

Support Expo SDK 36 #375

merged 1 commit into from May 11, 2020

Conversation

nickineering
Copy link
Member

Expo 36 bumped the React Native version above 0.60 thus requiring the native branch. Unfortunately, the native branch also switches to using @react-native-community/async-storage which is not supported by expo. This pull request restores support for Expo 36 by moving back to the deprecated import { AsyncStorage } from "react-native"; until such a time that Expo adds support.

I am unsure whether the community would want to move back to react-native AsyncStorage since it is deprecated, but for the significant number of developers using managed Expo they cannot use @react-native-community/async-storage until Expo chooses to support it. It might be best to put this on its own branch, or simply leave it here so other developers who upgrade to Expo 36 can still figure out how to use redux offline with Expo 36.

I'm still somewhat new to redux-offline, so if I missed anything please let me know.

@nickineering
Copy link
Member Author

Would revert #350

@sorodrigo
Copy link
Member

can you use the previous version where this change hadn't landed?

@nickineering
Copy link
Member Author

No, it requires #372, which was merged afterwards

@sorodrigo
Copy link
Member

ok new version is up so should work if you update

@react-native-community/async-storage is the way of the future, but not yet supported by expo
@nickineering
Copy link
Member Author

I'm still getting the same error in 2.5.2-native.3.

Sorry for the late reply. Just launched a new app at work.

@sorodrigo
Copy link
Member

I don't know what to do, I can't merge this because it will break someone else's app probably. And maintaining a native branch in parallel is already quite complicated so I wouldn't like to also maintain a 3 branch for expo.

@janrop
Copy link

janrop commented Mar 5, 2020

I think you could remove the import of the storage engine in redux-offline itself and enable users to provide it themself, so it will be passed through to redux-persist.

Redux-persist itself does it this way and I think it is a valid tradeoff for still supporting expo and bare react-native :)

https://github.com/rt2zz/redux-persist

Web: no breaking changes React Native: Users must now explicitly pass their storage engine in. e.g.

import AsyncStorage from '@react-native-community/async-storage';

const persistConfig = {
  //...
  storage: AsyncStorage
}

@janrop
Copy link

janrop commented Mar 30, 2020

For a quick fix could you maybe publish a expo tagged version that supports expo 36 by (I believe):

  • Importing {AsyncStorage} from 'react-native'; in persists.native.js;
  • Importing NetInfo from '@react-native-community/netinfo'; in detectNetwork.native.js

This is getting kind of urgent, because Apple will no longer accept new builds using UIWebview to the AppStore and unfortunately all Expo Versions prior to 36 produce those.

Alternatively I would be very thankful for some pointers on how I could publish a forked version of this package to npm including those changes.

@sorodrigo
Copy link
Member

sorodrigo commented Mar 30, 2020

@janrop @nferrara100 Apologies, have this on my TODO list and havent dedicated time to it. Could you give me a week to take care of this and publish a new version? Or is it super super super urgent?

@janrop
Copy link

janrop commented Mar 30, 2020

Apple will begin declining builds on the first of april, but I will probably be able to stave of my clients from updating for one week.

I would be happy to help however. Is it possible to symlink a fork of this project into a running react-native project to hack around?
Any pointers on how I could assist would be appreciated 🙂

@sorodrigo
Copy link
Member

Yeah you can download the repo run a build and run yarn link. See the docs in yarn's website. I'm planning on finally doing a push to v3. Because this fix will probably need a breaking change and we have several breaking changes waiting for v3. My idea is to have an alpha/beta on monday. If you want to help I can add you to some tasks that will be needed as soon as I start.

@sorodrigo sorodrigo added this to the v3 milestone Mar 30, 2020
@nickineering
Copy link
Member Author

@janrop I'm presently using my fork with Expo 36 and it works fine. I suggest you do the same for anything urgent. Not ideal, but hopefully Expo will upgrade on their end soon and solve this for us.

@superyarik
Copy link

  • Importing NetInfo from '@react-native-community/netinfo'; in detectNetwork.native.js

This is getting kind of urgent, because Apple will no longer accept new builds using UIWebview to the AppStore and unfortunately all Expo Versions prior to 36 produce those.

there is new 37 version with updated netinfo and without UIWebview

@janrop
Copy link

janrop commented May 11, 2020

  • Importing NetInfo from '@react-native-community/netinfo'; in detectNetwork.native.js

This is getting kind of urgent, because Apple will no longer accept new builds using UIWebview to the AppStore and unfortunately all Expo Versions prior to 36 produce those.

there is new 37 version with updated netinfo and without UIWebview

Yes, but redux-offline is not compatible because it uses @react-native-community/async-storage.

@janrop I'm presently using my fork with Expo 36 and it works fine. I suggest you do the same for anything urgent. Not ideal, but hopefully Expo will upgrade on their end soon and solve this for us.

How would I do that? I tried adding it to my package.json like

"@redux-offline/redux-offline": "git+https://git@github.com/nferrara100/redux-offline",

but it did not work. Going into the directory and executing npm install and npm run build did not work aswell, because babel cant parse flow.

@sorodrigo
Copy link
Member

Yes, but redux-offline is not compatible because it uses @react-native-community/async-storage.

I see. I thought this might've bought me some time to deal with this differently. I'll publish an expo tag to npm. Sorry for the slow response.

@sorodrigo sorodrigo changed the base branch from native to expo May 11, 2020 21:31
@sorodrigo sorodrigo merged commit 59e51a7 into redux-offline:expo May 11, 2020
@sorodrigo
Copy link
Member

@nferrara100 @janrop could you take care of maintaining this branch up to date with what expo needs? I can make sure it's synced with whatever lands on master.

@sorodrigo
Copy link
Member

yarn add @redux-offline/redux-offline@expo

@nickineering
Copy link
Member Author

@nferrara100 @janrop could you take care of maintaining this branch up to date with what expo needs? I can make sure it's synced with whatever lands on master.

@sorodrigo, thank you! Will do. Just installed this on my Expo 37 app and it works perfectly.

@superyarik
Copy link

superyarik commented May 22, 2020

guys, thanks for this expo branch!

btw: looks like in one of upcomung SKD updates there is react-native-community version of async-storage

expo/expo#8315

@nickineering
Copy link
Member Author

@sorodrigo Thank you again for your support on this! Expo has added support so it is no longer necessary to maintain a separate expo branch.

@superyarik
Copy link

@sorodrigo Thank you again for your support on this! Expo has added support so it is no longer necessary to maintain a separate expo branch.

yep, but there is users of SDK 36 and 37 can use this branch

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

Successfully merging this pull request may close these issues.

None yet

5 participants