Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion ios/Tflite.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifdef RCT_NEW_ARCH_ENABLED

#import "RNTfliteSpec.h"
@interface Tflite : NSObject <NativeTfliteSpec>
@interface Tflite : NSObject <NativeRNTfliteSpec>
@end

#else
Expand Down
6 changes: 3 additions & 3 deletions ios/Tflite.mm
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ @interface RCTBridge (RCTTurboModule)
using namespace facebook;

@implementation Tflite
RCT_EXPORT_MODULE()
RCT_EXPORT_MODULE(Tflite)

RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install) {
- (NSNumber *)install {
RCTBridge* bridge = [RCTBridge currentBridge];
RCTCxxBridge* cxxBridge = (RCTCxxBridge*)bridge;
if (!cxxBridge.runtime) {
Expand Down Expand Up @@ -50,7 +50,7 @@ @implementation Tflite
#ifdef RCT_NEW_ARCH_ENABLED
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
(const facebook::react::ObjCTurboModule::InitParams&)params {
return std::make_shared<facebook::react::NativeTfliteSpecJSI>(params);
return std::make_shared<facebook::react::NativeRNTfliteSpecJSI>(params);
}
#endif

Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,5 +138,10 @@
]
]
},
"packageManager": "[email protected]+sha1.4ba7fc5c6e704fce2066ecbfb0b0d8976fe62447"
"packageManager": "[email protected]+sha1.4ba7fc5c6e704fce2066ecbfb0b0d8976fe62447",
"codegenConfig": {
"name": "RNTfliteSpec",
"type": "modules",
"jsSrcsDir": "spec"
}
}
8 changes: 8 additions & 0 deletions spec/NativeRNTflite.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { TurboModule } from 'react-native'
import { TurboModuleRegistry } from 'react-native'

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

export default TurboModuleRegistry.getEnforcing<Spec>('Tflite')
24 changes: 1 addition & 23 deletions src/TensorflowModule.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1 @@
import { NativeModules, Platform } from 'react-native'

const LINKING_ERROR =
"The package 'react-native-fast-tflite' doesn't seem to be linked. Make sure: \n\n" +
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
'- You rebuilt the app after installing the package\n' +
'- You are not using Expo Go\n'

// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const Tflite =
NativeModules.Tflite != null
? NativeModules.Tflite
: new Proxy(
{},
{
get() {
throw new Error(LINKING_ERROR)
},
}
)

// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
export const TensorflowModule = Tflite
export { default as TensorflowModule } from '../spec/NativeRNTflite'
Loading