Skip to content

Expo Config Plugin #79

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

Merged
merged 11 commits into from
May 13, 2025
Merged

Expo Config Plugin #79

merged 11 commits into from
May 13, 2025

Conversation

Raiden-16F7
Copy link
Contributor

@Raiden-16F7 Raiden-16F7 commented Mar 17, 2025

Add Expo Config Plugin for iOS Compilation with use_frameworks!

Description

This PR introduces an Expo Config Plugin to automate the required Podfile modifications when using react-native-quick-sqlite with use_frameworks! on iOS. This enhancement is based on the PowerSync documentation, ensuring seamless integration for Expo users.

Changes

  • Added a config plugin to handle iOS-specific setup automatically.
  • Updates Podfile during Expo prebuild to ensure compatibility with use_frameworks! when staticLibrary option is specified.
  • Simplifies the setup for Expo projects using react-native-quick-sqlite.

Usage

To enable the plugin, add the following to your app.json or app.config.js:

For app.json

{
  "expo": {
    "plugins": [
      [
        "@journeyapps/react-native-quick-sqlite",
        {
          "staticLibrary": true
        }
      ]
    ]
  }
}

Copy link
Contributor Author

@Raiden-16F7 Raiden-16F7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactored my previous implementation

@Chriztiaan
Copy link
Contributor

Chriztiaan commented May 12, 2025

Hey @Raiden-16F7, have you been able to test this branch? I made a dev-release at @journeyapps/react-native-quick-sqlite@0.0.0-dev-20250512083150 which indicates an error on running prebuild.

/Users/christiaanlandman/code/powersync-js/node_modules/@expo/config-plugins/build/plugins/withStaticPlugin.js:126
        throw error;
        ^

Error: Cannot find module './src/withUseFrameworks'
Require stack:

I might be able to look into this, just wanted to check with you first.

@Raiden-16F7
Copy link
Contributor Author

Hey @Raiden-16F7, have you been able to test this branch? I made a dev-release at @journeyapps/react-native-quick-sqlite@0.0.0-dev-20250512083150 which indicates an error on running prebuild.

/Users/christiaanlandman/code/powersync-js/node_modules/@expo/config-plugins/build/plugins/withStaticPlugin.js:126
        throw error;
        ^

Error: Cannot find module './src/withUseFrameworks'
Require stack:

I might be able to look into this, just wanted to check with you first.

Yes, i think i did, i don't remember now 😅, ill also take a look at this again and let you know.

@Raiden-16F7
Copy link
Contributor Author

I found the issue, the following file has to be changed app.plugin.js

module.exports = require('./src/withUseFrameworks').default;

to

module.exports = require('./lib/commonjs/withUseFrameworks');

@Chriztiaan
Copy link
Contributor

@stevensJourney Updated the PR, tested the dev package at @journeyapps/react-native-quick-sqlite@0.0.0-dev-20250513072906 on our powersync react-native-supabase-todolist demo. If you use expo prebuild or regenerate the ios directory the pre-install entry is added.

image

Chriztiaan
Chriztiaan previously approved these changes May 13, 2025
@Chriztiaan Chriztiaan requested a review from stevensJourney May 13, 2025 08:17
Copy link
Contributor

@Chriztiaan Chriztiaan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going to add a plugin option for this.

{
  "expo": {
    "plugins": [
      [
        "@journeyapps/react-native-quick-sqlite",
        {
          "staticLibrary": true
        }
      ]
    ]
  }
}

stevensJourney
stevensJourney previously approved these changes May 13, 2025
@Chriztiaan Chriztiaan merged commit 2fd1357 into powersync-ja:main May 13, 2025
@Chriztiaan
Copy link
Contributor

Thanks for the contribution @Raiden-16F7 !

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.

3 participants