This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.visionnativemodulepoc | |
import android.util.Log | |
import com.facebook.react.bridge.ReactApplicationContext | |
import com.facebook.react.bridge.ReactContextBaseJavaModule | |
import com.facebook.react.bridge.ReactMethod | |
class RNVisionModulePOC(reactContext: ReactApplicationContext): ReactContextBaseJavaModule(reactContext) { | |
private val TAG = "VisionModule" | |
override fun getName() = "VisionModule" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: "com.android.application" | |
apply plugin: "com.facebook.react" | |
import com.android.build.OutputFile | |
/** | |
* This is the configuration block to customize your React Native Android app. | |
* By default you don't need to apply any configuration, just uncomment the lines you need. | |
*/ | |
react { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Top-level build file where you can add configuration options common to all sub-projects/modules. | |
buildscript { | |
ext { | |
buildToolsVersion = "33.0.0" | |
minSdkVersion = 21 | |
compileSdkVersion = 33 | |
targetSdkVersion = 33 | |
kotlinVersion = "1.8.0" | |
// We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// RCTVisionModule.swift | |
// VisionNativeModulePOC | |
// | |
// Created by Tanner West on 6/2/23. | |
// | |
import Foundation | |
import CoreImage | |
import Vision |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// RCTVisionModule.m | |
// VisionNativeModulePOC | |
// | |
// Created by Tanner West on 6/2/23. | |
// | |
#import <Foundation/Foundation.h> | |
#import <React/RCTBridgeModule.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {FC} from 'react'; | |
import {Button, NativeModules, SafeAreaView} from 'react-native'; | |
const {VisionModule} = NativeModules; | |
const App: FC = () => { | |
const callback = (firstArg: any, secondArg: any) => { | |
console.log('callback args: ', firstArg, secondArg); | |
}; | |
return ( | |
<SafeAreaView> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// RCTVisionModule.swift | |
// VisionNativeModulePOC | |
// | |
// Created by Tanner West on 6/2/23. | |
// | |
import Foundation | |
@objc(RCTVisionModule) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// RCTVisionModule.m | |
// VisionNativeModulePOC | |
// | |
// Created by Tanner West on 6/2/23. | |
// | |
#import <Foundation/Foundation.h> | |
#import <React/RCTBridgeModule.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {FC} from 'react'; | |
import {Button, NativeModules, SafeAreaView} from 'react-native'; | |
const {VisionModule} = NativeModules; | |
const App: FC = () => { | |
return ( | |
<SafeAreaView> | |
<Button | |
title="Say Hello" | |
onPress={() => VisionModule?.sayHello('this message is special', 1764)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// RCTVisionModule.swift | |
// VisionNativeModulePOC | |
// | |
// Created by Tanner West on 6/2/23. | |
// | |
import Foundation | |
@objc(RCTVisionModule) | |
class RCTVisionModule: NSObject { |