Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: powersync-ja/react-native-quick-sqlite
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: powersync-ja/react-native-quick-sqlite
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: raiden/expo-plugin
Choose a head ref
  • 6 commits
  • 6 files changed
  • 3 contributors

Commits on Mar 17, 2025

  1. Copy the full SHA
    c3a0641 View commit details
  2. Expo Config Plugin Created

    Raiden-16F7 committed Mar 17, 2025
    Copy the full SHA
    f5b8578 View commit details

Commits on May 12, 2025

  1. Cleanup.

    Chriztiaan committed May 12, 2025
    Copy the full SHA
    88e8fa2 View commit details
  2. Copy the full SHA
    d486af7 View commit details

Commits on May 13, 2025

  1. Updated app.plugin.js

    Chriztiaan committed May 13, 2025
    Copy the full SHA
    59b1920 View commit details
  2. Copy the full SHA
    fd97b6c View commit details
Showing with 376 additions and 13 deletions.
  1. +5 −0 .changeset/funny-crabs-smoke.md
  2. +16 −0 README.md
  3. +1 −0 app.plugin.js
  4. +2 −0 package.json
  5. +53 −0 src/withUseFrameworks.ts
  6. +299 −13 yarn.lock
5 changes: 5 additions & 0 deletions .changeset/funny-crabs-smoke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@journeyapps/react-native-quick-sqlite": patch
---

Added expo config plugin, that automatically applies podfile changes needed for use_frameworks.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -5,3 +5,19 @@
This repository is a fork of [react-native-quick-sqlite](https://github.com/ospfranco/react-native-quick-sqlite?tab=readme-ov-file) that includes custom SQLite extensions built specifically for **PowerSync**. It has been modified to meet the needs of **PowerSync**, adding features or behaviors that are different from the original repository.

It is **not** intended to be used independently, use [PowerSync React Native SDK](https://github.com/powersync-ja/powersync-js/tree/main/packages/react-native) and install this alongside it as a peer dependency.

### For Expo

#### iOS with `use_frameworks!`

If your iOS project uses `use_frameworks!`, add the config plugin to your **app.json** or **app.config.js**:

```json
{
"expo": {
"plugins": [["@journeyapps/react-native-quick-sqlite"]]
}
}
```

This plugin automatically configures the necessary build settings for `react-native-quick-sqlite` to work with `use_frameworks!`.
1 change: 1 addition & 0 deletions app.plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('./lib/commonjs/withUseFrameworks');
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@
"ios",
"cpp",
"meta.json",
"app.plugin.js",
"react-native-quick-sqlite.podspec",
"!android/build",
"!android/.cxx",
@@ -49,6 +50,7 @@
"homepage": "https://github.com/powersync-ja/react-native-quick-sqlite#readme",
"devDependencies": {
"@changesets/cli": "^2.26.2",
"@expo/config-plugins": "^9.0.17",
"prettier": "^3.3.3",
"react": "18.3.1",
"react-native": "0.76.2",
53 changes: 53 additions & 0 deletions src/withUseFrameworks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
const { ConfigPlugin, withDangerousMod, createRunOncePlugin } = require('@expo/config-plugins');
const fs = require('fs');
const path = require('path');

// Define package metadata
const pkg = { name: '@journeyapps/react-native-quick-sqlite', version: 'UNVERSIONED' };

// Function to modify the Podfile
function modifyPodfile(podfilePath: string, staticLibrary: boolean) {
let podfile = fs.readFileSync(podfilePath, 'utf8');
const preinstallScript = `
pre_install do |installer|
installer.pod_targets.each do |pod|
if pod.name.eql?('react-native-quick-sqlite')
def pod.build_type
Pod::BuildType.static_library
end
end
end
end
`;
// Ensure script is added only once
if (staticLibrary && !podfile.includes('react-native-quick-sqlite')) {
podfile = podfile.replace(/target\s+'[^']+'\s+do/, `$&\n${preinstallScript}`);
fs.writeFileSync(podfilePath, podfile, 'utf8');
console.log(`Added pre_install script for react-native-quick-sqlite to Podfile`);
}
}

// Config Plugin
const withUseFrameworks = (config, options = { staticLibrary: false }) => {
const { staticLibrary } = options;

return withDangerousMod(config, [
'ios',
(config) => {
const podfilePath = path.join(config.modRequest.platformProjectRoot, 'Podfile');
if (fs.existsSync(podfilePath)) {
modifyPodfile(podfilePath, staticLibrary);
} else {
console.warn(`Podfile not found at ${podfilePath}`);
}
return config;
}
]);
};

const pluginWithOptions = (config, options) => {
return withUseFrameworks(config, options);
};

// Export the plugin with Expo's createRunOncePlugin
module.exports = createRunOncePlugin(pluginWithOptions, pkg.name, pkg.version);
Loading