Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 20 additions & 18 deletions example/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,26 @@ GEM
base64
nkf
rexml
activesupport (7.1.3.3)
activesupport (7.2.2)
base64
benchmark (>= 0.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
logger (>= 1.4.2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
algoliasearch (1.27.5)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
atomos (0.1.3)
base64 (0.2.0)
benchmark (0.4.0)
bigdecimal (3.1.8)
claide (1.1.0)
cocoapods (1.15.2)
Expand Down Expand Up @@ -62,43 +65,42 @@ GEM
netrc (~> 0.11)
cocoapods-try (1.2.0)
colored2 (3.1.2)
concurrent-ruby (1.2.3)
concurrent-ruby (1.3.4)
connection_pool (2.4.1)
drb (2.2.1)
escape (0.0.4)
ethon (0.16.0)
ffi (>= 1.15.0)
ffi (1.16.3)
ffi (1.17.0)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
httpclient (2.8.3)
i18n (1.14.5)
i18n (1.14.6)
concurrent-ruby (~> 1.0)
json (2.7.2)
minitest (5.23.1)
json (2.8.1)
logger (1.6.1)
minitest (5.25.1)
molinillo (0.8.0)
mutex_m (0.2.0)
nanaimo (0.3.0)
nap (1.1.0)
netrc (0.11.0)
nkf (0.2.0)
public_suffix (4.0.7)
rexml (3.2.8)
strscan (>= 3.0.9)
rexml (3.3.9)
ruby-macho (2.5.1)
strscan (3.1.0)
securerandom (0.3.2)
typhoeus (1.4.1)
ethon (>= 0.9.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
xcodeproj (1.24.0)
xcodeproj (1.25.1)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.3.0)
rexml (~> 3.2.4)
rexml (>= 3.3.6, < 4.0)

PLATFORMS
ruby
Expand All @@ -112,4 +114,4 @@ RUBY VERSION
ruby 3.3.0p0

BUNDLED WITH
2.5.10
2.5.20
23 changes: 23 additions & 0 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1620,6 +1620,29 @@ PODS:
- RNScreens/common (= 3.35.0)
- Yoga
- RNScreens/common (3.35.0):
- DoubleConversion
- glog
- hermes-engine
- RCT-Folly (= 2024.01.01.00)
- RCTRequired
- RCTTypeSafety
- React-Core
- React-debug
- React-Fabric
- React-featureflags
- React-graphics
- React-ImageManager
- React-NativeModulesApple
- React-RCTFabric
- React-RCTImage
- React-rendererdebug
- React-utils
- ReactCodegen
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- RNScreens/common (= 3.34.0)
- Yoga
- RNScreens/common (3.34.0):
- DoubleConversion
- glog
- hermes-engine
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.margelo.rnquicksqlite;

import android.util.Log;

import androidx.annotation.NonNull;

import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactApplicationContext;

public class RNQuickSQLiteModule extends NativeRNQuickSQLiteSpec {
public RNQuickSQLiteModule(ReactApplicationContext reactContext) {
super(reactContext);
}

@Override
@NonNull
public String getName() {
return NAME;
}

@Override
public boolean install() {
try {
QuickSQLiteBridge.instance.install(getReactApplicationContext());
return true;
} catch (Exception exception) {
Log.e(NAME, "Failed to install JSI Bindings!", exception);
return false;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.margelo.rnquicksqlite;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.module.model.ReactModuleInfo;
import com.facebook.react.module.model.ReactModuleInfoProvider;
import com.facebook.react.TurboReactPackage;

import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class RNQuickSQLitePackage extends TurboReactPackage {
static {
System.loadLibrary("RNQuickSQLite");
}

@Nullable
@Override
public NativeModule getModule(String name, ReactApplicationContext reactContext) {
if (name.equals(RNQuickSQLiteModule.NAME)) {
return new RNQuickSQLiteModule(reactContext);
} else {
return null;
}
}

@Override
public ReactModuleInfoProvider getReactModuleInfoProvider() {
return () -> {
final Map<String, ReactModuleInfo> moduleInfos = new HashMap<>();
moduleInfos.put(
RNQuickSQLiteModule.NAME,
new ReactModuleInfo(
RNQuickSQLiteModule.NAME,
RNQuickSQLiteModule.NAME,
false,
true,
true,
false,
true));
return moduleInfos;
};
}
}

This file was deleted.

This file was deleted.

17 changes: 14 additions & 3 deletions package/ios/QuickSQLite.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
#import <React/RCTBridgeModule.h>
#import <React/RCTInvalidating.h>
#ifdef RCT_NEW_ARCH_ENABLED
#import <RNQuickSQLite/RNQuickSQLite.h>

@interface QuickSQLite : NSObject <RCTBridgeModule, RCTInvalidating>
NS_ASSUME_NONNULL_BEGIN

@interface RNQuickSQLite : NSObject<NativeRNQuickSQLiteSpec>
#else
#import <React/RCTBridge.h>

@interface RNQuickSQLite : NSObject<RCTBridgeModule>
#endif

@property(nonatomic, assign) BOOL setBridgeOnMainQueue;

@end

#ifdef RCT_NEW_ARCH_ENABLED
NS_ASSUME_NONNULL_END
#endif
36 changes: 21 additions & 15 deletions package/ios/QuickSQLite.mm
Original file line number Diff line number Diff line change
@@ -1,29 +1,40 @@
#import "QuickSQLite.h"

#import <React/RCTBridge+Private.h>

#import <React/RCTUtils.h>
#import <React/RCTBridge+Private.h>
#import <ReactCommon/RCTTurboModule.h>
#import <jsi/jsi.h>

#import "QuickSQLite.h"
#import "../cpp/bindings.h"

@implementation QuickSQLite
using namespace facebook;

RCT_EXPORT_MODULE(QuickSQLite)
@implementation RNQuickSQLite

#ifdef RCT_NEW_ARCH_ENABLED
RCT_EXPORT_MODULE()
#else
RCT_EXPORT_MODULE(RNQuickSQLite)
#endif

@synthesize bridge = _bridge;

#ifdef RCT_NEW_ARCH_ENABLED
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
(const facebook::react::ObjCTurboModule::InitParams &)params
{
return std::make_shared<facebook::react::NativeRNQuickSQLiteSpecJSI>(params);
}

- (NSNumber *) install {
#else
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install) {
NSLog(@"Installing QuickSQLite module...");
#endif
NSLog(@"Installing RNQuickSQLite module...");

RCTCxxBridge *cxxBridge = (RCTCxxBridge *)self.bridge;
if (cxxBridge == nil) {
return @false;
}

using namespace facebook;

auto jsiRuntime = (jsi::Runtime *)cxxBridge.runtime;
if (jsiRuntime == nil) {
return @false;
Expand Down Expand Up @@ -57,9 +68,4 @@ @implementation QuickSQLite
return @true;
}

- (void)invalidate {
osp::clearState();
}


@end
8 changes: 8 additions & 0 deletions package/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@
"<rootDir>/lib/"
]
},
"codegenConfig": {
"name": "RNQuickSQLite",
"type": "modules",
"jsSrcsDir": "src",
"android": {
"javaPackageName": "com.margelo.rnquicksqlite"
}
},
"release-it": {
"npm": {
"publish": true
Expand Down
7 changes: 7 additions & 0 deletions package/src/NativeRNQuickSQLite.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { TurboModuleRegistry, type TurboModule } from 'react-native'

export interface Spec extends TurboModule {
install(): boolean
}

export default TurboModuleRegistry.getEnforcing<Spec>('RNQuickSQLite')
Loading
Loading