-
Notifications
You must be signed in to change notification settings - Fork 467
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
feat(expo): add an Expo config plugin to simplify enabling Next Storage implementation #1145
base: main
Are you sure you want to change the base?
feat(expo): add an Expo config plugin to simplify enabling Next Storage implementation #1145
Conversation
🦋 Changeset detectedLatest commit: 220ba63 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
177a920
to
e570c09
Compare
This is awesome 🙏 Let's move it as a separate workspace (packages/default-storage-expo-plugin) and we'll do npm releases from there. I understand then expo users will have to install this plugin via npm to use it, correct? |
Hi @krizzu, thanks for the kind words <3 Happy to move the code to a separate workspace, but I just wanted to note that typically Expo plugins are included with the native module package itself (see Expo Contacts or Expo Calendar) - an example from one of my projects looks like: {
"expo": {
"plugins": [
[
"expo-build-properties",
{
"android": {
"kotlinVersion": "1.9.23"
}
}
],
"expo-router",
[
"expo-calendar",
{
"calendarPermission": "$(PRODUCT_NAME) needs to access your calendar to sync your events and performances."
}
],
[
"expo-contacts",
{
"contactsPermission": "Allow $(PRODUCT_NAME) to access your contacts."
}
]
]
}
} My suggestion would be to
|
Async storage is used outside expo as well, so I'd rather not add anything expo specific, unless necessary. Seems like an extra package to install and configured in wdyt @tido64 ? |
That does make sense - my rationale for it being there is the recommendation of Expo as the framework for React Native apps (paraphrasing the React Native devs here). Additionally, Expo config plugins can also be used for out-of-tree RN platforms; see https://github.com/byCedric/custom-prebuild-example. |
From what I've seen, the convention is to include the plugin in the same package. However, looking at the plugin implementation, that would mean that we have to add a direct dependency on That said, I don't like that fact that we're now forcing all users of AsyncStorage to download I'm also not a fan of the option name, |
e570c09
to
4ebf423
Compare
Thanks for the comments @tido64, I've updated the PR accordingly.
My understanding is that
This would only be true if
I used the name as described in the documentation (which already indicates that it's only for Android). Instead of prefixing it, I've nested it since there are other configurable options that I haven't added support for. |
6c7a374
to
a024e18
Compare
That part is fine. However, dependencies may not be installed in such a way that the plugin will be able to find Expo. In a standalone repo with a single app, all dependencies are installed under
In this specific case, the plugin will be able to find Expo. But this isn't always the case.
In this case, the plugin will not be able to find Expo. This is why we cannot rely on implicit dependencies. We always declare our dependencies.
Since it looks like "peerDependencies": {
"expo": ">=51"
},
"peerDependenciesMeta": {
"expo": {
"optional": true
}
}, This should allow us to keep the footprint to a minimum. |
3a0af31
to
f3aa9fc
Compare
…ge on Android Fixes react-native-async-storage#750 Co-Authored-By: Bill Spooner <[email protected]>
f3aa9fc
to
220ba63
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, I think this can be removed, as it'll be released with version specified in package.json
@hassankhan thanks, appreciate the changed 🙏 I think we missed the other configuration bits from the next storage, such as kotlin, ksp and room versions. Can you add this in to config as well? |
Summary
Adds a config plugin to enable Next storage implementation.
Fixes #750
Note
As of Expo v51, this will cause issues with the KSP version lookup so users will also need to use Expo's
BuildProperties
plugin to setkotlinVersion
to1.9.23
Test Plan
Link the newly-built package into your Expo project (
bun/npm/yarn link
)Add the config plugin to your Expo project's
app.json
:android/gradle.properties
to confirmAsyncStorage_useNextStorage=true
is there