├── android ├── JsiImage.cpp ├── src │ └── main │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── com │ │ └── reactnativejsiimage │ │ ├── JsiImageModule.java │ │ └── JsiImagePackage.java ├── cpp-adapter.cpp ├── CMakeLists.txt └── build.gradle ├── .gitattributes ├── tsconfig.build.json ├── example ├── app.json ├── ios │ ├── File.swift │ ├── JsiImageExample │ │ ├── Images.xcassets │ │ │ ├── Contents.json │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ ├── AppDelegate.h │ │ ├── main.m │ │ ├── AppDelegate.m │ │ ├── Info.plist │ │ └── LaunchScreen.storyboard │ ├── JsiImageExample-Bridging-Header.h │ ├── JsiImageExample.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ ├── Podfile │ ├── JsiImageExample.xcodeproj │ │ ├── xcshareddata │ │ │ └── xcschemes │ │ │ │ └── JsiImageExample.xcscheme │ │ └── project.pbxproj │ └── Podfile.lock ├── android │ ├── app │ │ ├── debug.keystore │ │ ├── src │ │ │ ├── main │ │ │ │ ├── res │ │ │ │ │ ├── values │ │ │ │ │ │ ├── strings.xml │ │ │ │ │ │ └── styles.xml │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ └── mipmap-xxxhdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── java │ │ │ │ │ └── com │ │ │ │ │ │ └── example │ │ │ │ │ │ └── reactnativejsiimage │ │ │ │ │ │ ├── MainActivity.java │ │ │ │ │ │ └── MainApplication.java │ │ │ │ └── AndroidManifest.xml │ │ │ └── debug │ │ │ │ └── AndroidManifest.xml │ │ ├── proguard-rules.pro │ │ └── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── settings.gradle │ ├── gradle.properties │ ├── build.gradle │ ├── gradlew.bat │ └── gradlew ├── index.js ├── babel.config.js ├── package.json ├── metro.config.js └── src │ └── App.tsx ├── babel.config.js ├── .editorconfig ├── ios ├── JsiImage.h ├── ImageHostObject.h ├── JsiImage.mm ├── ImageHostObject.mm └── JsiImage.xcodeproj │ └── project.pbxproj ├── tsconfig.json ├── .gitignore ├── LICENSE ├── cpp └── JSI Utils │ ├── JsiPromise.h │ ├── JsiPromise.cpp │ ├── TypedArray.h │ └── TypedArray.cpp ├── src ├── index.ts └── Image.ts ├── react-native-jsi-image.podspec ├── package.json ├── README.md └── CONTRIBUTING.md /android/JsiImage.cpp: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | # specific for windows script files 3 | *.bat text eol=crlf -------------------------------------------------------------------------------- /tsconfig.build.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "extends": "./tsconfig", 4 | "exclude": ["example"] 5 | } 6 | -------------------------------------------------------------------------------- /example/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "JsiImageExample", 3 | "displayName": "JsiImage Example" 4 | } 5 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['module:metro-react-native-babel-preset'], 3 | }; 4 | -------------------------------------------------------------------------------- /example/ios/File.swift: -------------------------------------------------------------------------------- 1 | // 2 | // File.swift 3 | // JsiImageExample 4 | // 5 | 6 | import Foundation 7 | -------------------------------------------------------------------------------- /example/android/app/debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrousavy/react-native-jsi-image/HEAD/example/android/app/debug.keystore -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | JsiImage Example 3 | 4 | -------------------------------------------------------------------------------- /example/ios/JsiImageExample/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /example/ios/JsiImageExample-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrousavy/react-native-jsi-image/HEAD/example/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrousavy/react-native-jsi-image/HEAD/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrousavy/react-native-jsi-image/HEAD/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrousavy/react-native-jsi-image/HEAD/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrousavy/react-native-jsi-image/HEAD/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrousavy/react-native-jsi-image/HEAD/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrousavy/react-native-jsi-image/HEAD/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrousavy/react-native-jsi-image/HEAD/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrousavy/react-native-jsi-image/HEAD/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrousavy/react-native-jsi-image/HEAD/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrousavy/react-native-jsi-image/HEAD/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/index.js: -------------------------------------------------------------------------------- 1 | import { AppRegistry } from 'react-native'; 2 | import App from './src/App'; 3 | import { name as appName } from './app.json'; 4 | 5 | AppRegistry.registerComponent(appName, () => App); 6 | -------------------------------------------------------------------------------- /android/cpp-adapter.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern "C" 4 | JNIEXPORT void JNICALL 5 | Java_com_reactnativejsiimage_JsiImageModule_nativeInstall(JNIEnv *env, jclass type) { 6 | // TODO: Install JSI Bindings 7 | } 8 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /example/ios/JsiImageExample.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/ios/JsiImageExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # editorconfig.org 4 | 5 | root = true 6 | 7 | [*] 8 | 9 | indent_style = space 10 | indent_size = 2 11 | 12 | end_of_line = lf 13 | charset = utf-8 14 | trim_trailing_whitespace = true 15 | insert_final_newline = true 16 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'JsiImageExample' 2 | apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) 3 | include ':app' 4 | 5 | include ':reactnativejsiimage' 6 | project(':reactnativejsiimage').projectDir = new File(rootProject.projectDir, '../../android') 7 | -------------------------------------------------------------------------------- /ios/JsiImage.h: -------------------------------------------------------------------------------- 1 | // 2 | // JsiImage.h 3 | // JsiImage 4 | // 5 | // Created by Marc Rousavy on 04.01.22. 6 | // Copyright © 2022 Facebook. All rights reserved. 7 | // 8 | 9 | #pragma once 10 | 11 | #import 12 | 13 | @interface JsiImage : NSObject 14 | 15 | @property (nonatomic, assign) BOOL setBridgeOnMainQueue; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /android/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.4.1) 2 | 3 | set (CMAKE_VERBOSE_MAKEFILE ON) 4 | set (CMAKE_CXX_STANDARD 11) 5 | 6 | add_library(jsi-image 7 | SHARED 8 | cpp-adapter.cpp 9 | JsiImage.cpp 10 | ../cpp/TypedArray/TypedArray.cpp 11 | ) 12 | 13 | include_directories( 14 | ./android 15 | ../cpp 16 | # RN JSI sources 17 | ) 18 | -------------------------------------------------------------------------------- /example/babel.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const pak = require('../package.json'); 3 | 4 | module.exports = { 5 | presets: ['module:metro-react-native-babel-preset'], 6 | plugins: [ 7 | [ 8 | 'module-resolver', 9 | { 10 | extensions: ['.tsx', '.ts', '.js', '.json'], 11 | alias: { 12 | [pak.name]: path.join(__dirname, '..', pak.source), 13 | }, 14 | }, 15 | ], 16 | ], 17 | }; 18 | -------------------------------------------------------------------------------- /example/ios/JsiImageExample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (nonatomic, strong) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /example/ios/JsiImageExample/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /example/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/com/example/reactnativejsiimage/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.reactnativejsiimage; 2 | 3 | import com.facebook.react.ReactActivity; 4 | 5 | public class MainActivity extends ReactActivity { 6 | 7 | /** 8 | * Returns the name of the main component registered from JavaScript. This is used to schedule 9 | * rendering of the component. 10 | */ 11 | @Override 12 | protected String getMainComponentName() { 13 | return "JsiImageExample"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/ios/Podfile: -------------------------------------------------------------------------------- 1 | require_relative '../node_modules/react-native/scripts/react_native_pods' 2 | require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' 3 | 4 | platform :ios, '12.0' 5 | 6 | target 'JsiImageExample' do 7 | config = use_native_modules! 8 | 9 | use_react_native!( 10 | :path => config["reactNativePath"], 11 | :hermes_enabled => false 12 | ) 13 | 14 | pod 'react-native-jsi-image', :path => '../..' 15 | 16 | post_install do |installer| 17 | react_native_post_install(installer) 18 | __apply_Xcode_12_5_M1_post_install_workaround(installer) 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /example/ios/JsiImageExample/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": "./", 4 | "paths": { 5 | "react-native-jsi-image": ["./src/index"] 6 | }, 7 | "allowUnreachableCode": false, 8 | "allowUnusedLabels": false, 9 | "esModuleInterop": true, 10 | "importsNotUsedAsValues": "error", 11 | "forceConsistentCasingInFileNames": true, 12 | "jsx": "react", 13 | "lib": ["esnext"], 14 | "module": "esnext", 15 | "moduleResolution": "node", 16 | "noFallthroughCasesInSwitch": true, 17 | "noImplicitReturns": true, 18 | "noImplicitUseStrict": false, 19 | "noStrictGenericChecks": false, 20 | "noUnusedLocals": true, 21 | "noUnusedParameters": true, 22 | "resolveJsonModule": true, 23 | "skipLibCheck": true, 24 | "strict": true, 25 | "target": "esnext" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-jsi-image-example", 3 | "description": "Example app for react-native-jsi-image", 4 | "version": "0.0.1", 5 | "private": true, 6 | "scripts": { 7 | "android": "react-native run-android", 8 | "ios": "react-native run-ios", 9 | "start": "react-native start", 10 | "pods": "cd ios && pod install" 11 | }, 12 | "dependencies": { 13 | "react": "^17.0.2", 14 | "react-native": "^0.66.4" 15 | }, 16 | "devDependencies": { 17 | "@babel/core": "^7.12.9", 18 | "@babel/runtime": "^7.12.5", 19 | "@react-native-community/eslint-config": "^2.0.0", 20 | "babel-jest": "^26.6.3", 21 | "babel-plugin-module-resolver": "^4.1.0", 22 | "eslint": "7.14.0", 23 | "jest": "^26.6.3", 24 | "metro-react-native-babel-preset": "^0.66.2", 25 | "react-test-renderer": "17.0.2" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ios/ImageHostObject.h: -------------------------------------------------------------------------------- 1 | // 2 | // ImageHostObject.h 3 | // JsiImage 4 | // 5 | // Created by Marc Rousavy on 04.01.22. 6 | // Copyright © 2021 Facebook. All rights reserved. 7 | // 8 | 9 | #pragma once 10 | 11 | #import 12 | #import 13 | #import "../cpp/JSI Utils/JsiPromise.h" 14 | 15 | using namespace facebook; 16 | 17 | class JSI_EXPORT ImageHostObject: public jsi::HostObject { 18 | public: 19 | ImageHostObject(UIImage* image, std::shared_ptr promiseVendor): image(image), _promiseVendor(promiseVendor) { }; 20 | 21 | public: 22 | jsi::Value get(jsi::Runtime&, const jsi::PropNameID& name) override; 23 | std::vector getPropertyNames(jsi::Runtime& rt) override; 24 | 25 | public: 26 | UIImage* image; 27 | 28 | private: 29 | std::shared_ptr _promiseVendor; 30 | }; 31 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # XDE 6 | .expo/ 7 | 8 | # VSCode 9 | .vscode/ 10 | jsconfig.json 11 | 12 | # Xcode 13 | # 14 | build/ 15 | *.pbxuser 16 | !default.pbxuser 17 | *.mode1v3 18 | !default.mode1v3 19 | *.mode2v3 20 | !default.mode2v3 21 | *.perspectivev3 22 | !default.perspectivev3 23 | xcuserdata 24 | *.xccheckout 25 | *.moved-aside 26 | DerivedData 27 | *.hmap 28 | *.ipa 29 | *.xcuserstate 30 | project.xcworkspace 31 | 32 | # Android/IJ 33 | # 34 | .classpath 35 | .cxx 36 | .gradle 37 | .idea 38 | .project 39 | .settings 40 | local.properties 41 | android.iml 42 | 43 | # Cocoapods 44 | # 45 | example/ios/Pods 46 | 47 | # node.js 48 | # 49 | node_modules/ 50 | npm-debug.log 51 | yarn-debug.log 52 | yarn-error.log 53 | 54 | # BUCK 55 | buck-out/ 56 | \.buckd/ 57 | android/app/libs 58 | android/keystores/debug.keystore 59 | 60 | # Expo 61 | .expo/* 62 | 63 | # generated by bob 64 | lib/ 65 | -------------------------------------------------------------------------------- /android/src/main/java/com/reactnativejsiimage/JsiImageModule.java: -------------------------------------------------------------------------------- 1 | package com.reactnativejsiimage; 2 | 3 | import androidx.annotation.NonNull; 4 | 5 | import com.facebook.react.bridge.Promise; 6 | import com.facebook.react.bridge.ReactApplicationContext; 7 | import com.facebook.react.bridge.ReactContextBaseJavaModule; 8 | import com.facebook.react.bridge.ReactMethod; 9 | import com.facebook.react.module.annotations.ReactModule; 10 | 11 | @ReactModule(name = JsiImageModule.NAME) 12 | public class JsiImageModule extends ReactContextBaseJavaModule { 13 | public static final String NAME = "JsiImage"; 14 | 15 | public JsiImageModule(ReactApplicationContext reactContext) { 16 | super(reactContext); 17 | // TODO: call nativeInstall() 18 | } 19 | 20 | @Override 21 | @NonNull 22 | public String getName() { 23 | return NAME; 24 | } 25 | 26 | static { 27 | System.loadLibrary("jsi-image"); 28 | } 29 | 30 | public static native void nativeInstall(); 31 | } 32 | -------------------------------------------------------------------------------- /android/src/main/java/com/reactnativejsiimage/JsiImagePackage.java: -------------------------------------------------------------------------------- 1 | package com.reactnativejsiimage; 2 | 3 | import androidx.annotation.NonNull; 4 | 5 | import com.facebook.react.ReactPackage; 6 | import com.facebook.react.bridge.NativeModule; 7 | import com.facebook.react.bridge.ReactApplicationContext; 8 | import com.facebook.react.uimanager.ViewManager; 9 | 10 | import java.util.ArrayList; 11 | import java.util.Collections; 12 | import java.util.List; 13 | 14 | public class JsiImagePackage implements ReactPackage { 15 | @NonNull 16 | @Override 17 | public List createNativeModules(@NonNull ReactApplicationContext reactContext) { 18 | List modules = new ArrayList<>(); 19 | modules.add(new JsiImageModule(reactContext)); 20 | return modules; 21 | } 22 | 23 | @NonNull 24 | @Override 25 | public List createViewManagers(@NonNull ReactApplicationContext reactContext) { 26 | return Collections.emptyList(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | android.useAndroidX=true 21 | android.enableJetifier=true 22 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 13 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Marc Rousavy 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /cpp/JSI Utils/JsiPromise.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #import 5 | 6 | namespace JsiPromise { 7 | 8 | using namespace facebook; 9 | 10 | class Promise { 11 | public: 12 | Promise(std::function resolve, std::function reject): _resolve(std::move(resolve)), _reject(std::move(reject)) {} 13 | public: 14 | bool isResolved; 15 | void resolve(jsi::Value&& value) { 16 | _resolve(std::forward(value)); 17 | } 18 | void reject(const std::string& errorMessage) { 19 | _reject(errorMessage); 20 | } 21 | 22 | private: 23 | std::function _resolve; 24 | std::function _reject; 25 | }; 26 | 27 | class PromiseVendor { 28 | public: 29 | PromiseVendor(jsi::Runtime* runtime, std::shared_ptr callInvoker): _runtime(runtime), _callInvoker(callInvoker) {} 30 | 31 | public: 32 | jsi::Value createPromise(std::function)> func); 33 | 34 | private: 35 | jsi::Runtime* _runtime; 36 | std::shared_ptr _callInvoker; 37 | }; 38 | 39 | } 40 | 41 | -------------------------------------------------------------------------------- /example/metro.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const blacklist = require('metro-config/src/defaults/exclusionList'); 3 | const escape = require('escape-string-regexp'); 4 | const pak = require('../package.json'); 5 | 6 | const root = path.resolve(__dirname, '..'); 7 | 8 | const modules = Object.keys({ 9 | ...pak.peerDependencies, 10 | }); 11 | 12 | module.exports = { 13 | projectRoot: __dirname, 14 | watchFolders: [root], 15 | 16 | // We need to make sure that only one version is loaded for peerDependencies 17 | // So we blacklist them at the root, and alias them to the versions in example's node_modules 18 | resolver: { 19 | blacklistRE: blacklist( 20 | modules.map( 21 | (m) => 22 | new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`) 23 | ) 24 | ), 25 | 26 | extraNodeModules: modules.reduce((acc, name) => { 27 | acc[name] = path.join(__dirname, 'node_modules', name); 28 | return acc; 29 | }, {}), 30 | }, 31 | 32 | transformer: { 33 | getTransformOptions: async () => ({ 34 | transform: { 35 | experimentalImportSupport: false, 36 | inlineRequires: true, 37 | }, 38 | }), 39 | }, 40 | }; 41 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | import { Platform } from 'react-native'; 2 | import type { Image } from './Image'; 3 | 4 | const LINKING_ERROR = 5 | `The package 'react-native-jsi-image' doesn't seem to be linked. Make sure: \n\n` + 6 | Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) + 7 | '- You rebuilt the app after installing the package\n' + 8 | '- You are not using Expo managed workflow\n'; 9 | 10 | // @ts-expect-error JSI unknown 11 | if (typeof global.jsiImageLoadFromFile !== 'function') { 12 | throw new Error(LINKING_ERROR); 13 | } 14 | 15 | /** 16 | * Loads an Image from the given file path. 17 | * @param filePath The file path of the image file. 18 | * @returns An in-memory Image 19 | */ 20 | export function loadImageFromFile(filePath: string): Promise { 21 | // @ts-expect-error JSI unknown 22 | return global.jsiImageLoadFromFile(filePath); 23 | } 24 | 25 | /** 26 | * Loads an Image from the given URL. 27 | * @param url The URL or URI to the Image. 28 | * @returns An in-memory Image 29 | */ 30 | export function loadImageFromUrl(url: string): Promise { 31 | // @ts-expect-error JSI unknown 32 | return global.jsiImageLoadFromUrl(url); 33 | } 34 | 35 | export * from './Image'; 36 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext { 5 | buildToolsVersion = "30.0.2" 6 | minSdkVersion = 21 7 | compileSdkVersion = 30 8 | targetSdkVersion = 30 9 | ndkVersion = "21.4.7075529" 10 | } 11 | repositories { 12 | google() 13 | mavenCentral() 14 | } 15 | dependencies { 16 | classpath("com.android.tools.build:gradle:4.2.2") 17 | 18 | // NOTE: Do not place your application dependencies here; they belong 19 | // in the individual module build.gradle files 20 | } 21 | } 22 | 23 | allprojects { 24 | repositories { 25 | mavenCentral() 26 | mavenLocal() 27 | maven { 28 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 29 | url("$rootDir/../node_modules/react-native/android") 30 | } 31 | maven { 32 | // Android JSC is installed from npm 33 | url("$rootDir/../node_modules/jsc-android/dist") 34 | } 35 | 36 | google() 37 | maven { url 'https://www.jitpack.io' } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Image.ts: -------------------------------------------------------------------------------- 1 | export type Orientation = 'up' | 'down' | 'left' | 'right'; 2 | 3 | export interface Image { 4 | /** 5 | * The Image's width in pixels. 6 | */ 7 | readonly width: number; 8 | /** 9 | * The Image's height in pixels. 10 | */ 11 | readonly height: number; 12 | /** 13 | * The Image's scale factor. For most images, this is `1.0`. 14 | */ 15 | readonly scale: number; 16 | /** 17 | * Whether the image is horizontally flipped ("mirrored"), or not. 18 | */ 19 | readonly isFlipped: boolean; 20 | /** 21 | * The Image's orientation. 22 | */ 23 | readonly orientation: Orientation; 24 | 25 | /** 26 | * The Image's PNG data. 27 | * 28 | * See [`pngData`](https://developer.apple.com/documentation/uikit/uiimage/1624096-pngdata) for more information. 29 | */ 30 | readonly data: Uint8Array; 31 | /** 32 | * Horizontally flips ("mirror") the Image and returns the new copy. 33 | * 34 | * @example 35 | * ```ts 36 | * console.log(image.isFlipped) // false 37 | * const flippedImage = image.flip() 38 | * console.log(flippedImage.isFlipped) // true 39 | * ``` 40 | */ 41 | flip(): Image; 42 | /** 43 | * Writes the Image to the given file path. 44 | * @param filePath The file path to save the Image to. File extension should either be `.png` or `.jpg`. 45 | * 46 | * @example 47 | * ```ts 48 | * await image.save('file:///Users/Marc/profile-picture.png') 49 | * ``` 50 | */ 51 | save(filePath: string): Promise; 52 | /** 53 | * Returns a string-representation of the Image useful for debugging. 54 | */ 55 | toString(): string; 56 | } 57 | -------------------------------------------------------------------------------- /example/ios/JsiImageExample/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import "AppDelegate.h" 9 | 10 | #import 11 | #import 12 | #import 13 | 14 | @implementation AppDelegate 15 | 16 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 17 | { 18 | RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; 19 | RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge 20 | moduleName:@"JsiImageExample" 21 | initialProperties:nil]; 22 | 23 | if (@available(iOS 13.0, *)) { 24 | rootView.backgroundColor = [UIColor systemBackgroundColor]; 25 | } else { 26 | rootView.backgroundColor = [UIColor whiteColor]; 27 | } 28 | 29 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 30 | UIViewController *rootViewController = [UIViewController new]; 31 | rootViewController.view = rootView; 32 | self.window.rootViewController = rootViewController; 33 | [self.window makeKeyAndVisible]; 34 | return YES; 35 | } 36 | 37 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge 38 | { 39 | #if DEBUG 40 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; 41 | #else 42 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 43 | #endif 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/com/example/reactnativejsiimage/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.reactnativejsiimage; 2 | 3 | import android.app.Application; 4 | import android.content.Context; 5 | import com.facebook.react.PackageList; 6 | import com.facebook.react.ReactApplication; 7 | import com.facebook.react.ReactNativeHost; 8 | import com.facebook.react.ReactPackage; 9 | import com.facebook.react.ReactInstanceManager; 10 | import com.facebook.soloader.SoLoader; 11 | import java.lang.reflect.InvocationTargetException; 12 | import java.util.List; 13 | import com.reactnativejsiimage.JsiImagePackage; 14 | 15 | public class MainApplication extends Application implements ReactApplication { 16 | 17 | private final ReactNativeHost mReactNativeHost = 18 | new ReactNativeHost(this) { 19 | @Override 20 | public boolean getUseDeveloperSupport() { 21 | return BuildConfig.DEBUG; 22 | } 23 | 24 | @Override 25 | protected List getPackages() { 26 | @SuppressWarnings("UnnecessaryLocalVariable") 27 | List packages = new PackageList(this).getPackages(); 28 | // Packages that cannot be autolinked yet can be added manually here, for JsiImageExample: 29 | // packages.add(new MyReactNativePackage()); 30 | packages.add(new JsiImagePackage()); 31 | return packages; 32 | } 33 | 34 | @Override 35 | protected String getJSMainModuleName() { 36 | return "index"; 37 | } 38 | }; 39 | 40 | @Override 41 | public ReactNativeHost getReactNativeHost() { 42 | return mReactNativeHost; 43 | } 44 | 45 | @Override 46 | public void onCreate() { 47 | super.onCreate(); 48 | SoLoader.init(this, /* native exopackage */ false); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /example/ios/JsiImageExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | JsiImage Example 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSRequiresIPhoneOS 26 | 27 | NSAppTransportSecurity 28 | 29 | NSAllowsArbitraryLoads 30 | 31 | NSExceptionDomains 32 | 33 | localhost 34 | 35 | NSExceptionAllowsInsecureHTTPLoads 36 | 37 | 38 | 39 | 40 | NSLocationWhenInUseUsageDescription 41 | 42 | UILaunchStoryboardName 43 | LaunchScreen 44 | UIRequiredDeviceCapabilities 45 | 46 | armv7 47 | 48 | UISupportedInterfaceOrientations 49 | 50 | UIInterfaceOrientationPortrait 51 | UIInterfaceOrientationLandscapeLeft 52 | UIInterfaceOrientationLandscapeRight 53 | 54 | UIViewControllerBasedStatusBarAppearance 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /example/src/App.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | 3 | import { StyleSheet, View, Text } from 'react-native'; 4 | import { 5 | Image, 6 | loadImageFromFile, 7 | loadImageFromUrl, 8 | } from 'react-native-jsi-image'; 9 | 10 | const TEST_PATH = '/tmp/test.png'; 11 | 12 | export default function App() { 13 | React.useEffect(() => { 14 | const interval = setInterval(async () => { 15 | console.log('loading image from file...'); 16 | const image = await loadImageFromUrl( 17 | 'https://cpmr-islands.org/wp-content/uploads/sites/4/2019/07/test.png' 18 | ); 19 | console.log('loaded image from file!'); 20 | 21 | console.log(`image: ${image}`); 22 | console.log( 23 | `orientation: ${image.orientation} (${ 24 | image.isFlipped ? 'flipped' : 'normal' 25 | })` 26 | ); 27 | const flipped = image.flip(); 28 | console.log( 29 | `flipped: ${flipped.orientation} (${ 30 | flipped.isFlipped ? 'flipped' : 'normal' 31 | })` 32 | ); 33 | 34 | console.log(`saving to "${TEST_PATH}"...`); 35 | await image.save(TEST_PATH); 36 | console.log(`saved to "${TEST_PATH}"!`); 37 | 38 | console.log(`loading from "${TEST_PATH}"...`); 39 | const fromDisk = await loadImageFromFile(TEST_PATH); 40 | console.log(`loaded ${fromDisk.toString()} image from "${TEST_PATH}"!`); 41 | }, 3000); 42 | return () => clearInterval(interval); 43 | }, []); 44 | 45 | return ( 46 | 47 | Hello! 48 | 49 | ); 50 | } 51 | 52 | const styles = StyleSheet.create({ 53 | container: { 54 | flex: 1, 55 | alignItems: 'center', 56 | justifyContent: 'center', 57 | backgroundColor: 'white', 58 | }, 59 | box: { 60 | width: 60, 61 | height: 60, 62 | marginVertical: 20, 63 | }, 64 | }); 65 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | if (project == rootProject) { 3 | repositories { 4 | google() 5 | mavenCentral() 6 | jcenter() 7 | } 8 | 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:3.5.3' 11 | } 12 | } 13 | } 14 | 15 | apply plugin: 'com.android.library' 16 | 17 | def safeExtGet(prop, fallback) { 18 | rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback 19 | } 20 | 21 | android { 22 | compileSdkVersion safeExtGet('JsiImage_compileSdkVersion', 29) 23 | defaultConfig { 24 | minSdkVersion safeExtGet('JsiImage_minSdkVersion', 16) 25 | targetSdkVersion safeExtGet('JsiImage_targetSdkVersion', 29) 26 | versionCode 1 27 | versionName "1.0" 28 | 29 | externalNativeBuild { 30 | cmake { 31 | cppFlags "-O2 -frtti -fexceptions -Wall -fstack-protector-all" 32 | abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a' 33 | } 34 | } 35 | 36 | } 37 | 38 | externalNativeBuild { 39 | cmake { 40 | path "CMakeLists.txt" 41 | } 42 | } 43 | 44 | buildTypes { 45 | release { 46 | minifyEnabled false 47 | } 48 | } 49 | lintOptions { 50 | disable 'GradleCompatible' 51 | } 52 | compileOptions { 53 | sourceCompatibility JavaVersion.VERSION_1_8 54 | targetCompatibility JavaVersion.VERSION_1_8 55 | } 56 | } 57 | 58 | repositories { 59 | mavenLocal() 60 | maven { 61 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 62 | url("$rootDir/../node_modules/react-native/android") 63 | } 64 | google() 65 | mavenCentral() 66 | jcenter() 67 | } 68 | 69 | dependencies { 70 | //noinspection GradleDynamicVersion 71 | implementation "com.facebook.react:react-native:+" // From node_modules 72 | } 73 | -------------------------------------------------------------------------------- /react-native-jsi-image.podspec: -------------------------------------------------------------------------------- 1 | require "json" 2 | 3 | package = JSON.parse(File.read(File.join(__dir__, "package.json"))) 4 | 5 | reactVersion = '0.0.0' 6 | begin 7 | reactVersion = JSON.parse(File.read(File.join(__dir__, "..", "react-native", "package.json")))["version"] 8 | rescue 9 | reactVersion = '0.66.0' 10 | end 11 | rnVersion = reactVersion.split('.')[1] 12 | 13 | folly_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DRNVERSION=' + rnVersion 14 | folly_compiler_flags = folly_flags + ' ' + '-Wno-comma -Wno-shorten-64-to-32' 15 | folly_version = '2021.04.26.00' 16 | boost_compiler_flags = '-Wno-documentation' 17 | 18 | Pod::Spec.new do |s| 19 | s.name = "react-native-jsi-image" 20 | s.version = package["version"] 21 | s.summary = package["description"] 22 | s.homepage = package["homepage"] 23 | s.license = package["license"] 24 | s.authors = package["author"] 25 | 26 | s.platforms = { :ios => "11.0", :tvos => "12.0" } 27 | s.source = { :git => "https://github.com/mrousavy/react-native-jsi-image.git", :tag => "#{s.version}" } 28 | 29 | s.pod_target_xcconfig = { 30 | "USE_HEADERMAP" => "YES", 31 | "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_TARGET_SRCROOT)\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/Headers/Private/React-Core\" " 32 | } 33 | s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags 34 | s.xcconfig = { 35 | "CLANG_CXX_LANGUAGE_STANDARD" => "c++14", 36 | "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/glog\" \"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-hermes\" \"${PODS_ROOT}/Headers/Public/hermes-engine\"", 37 | "OTHER_CFLAGS" => "$(inherited)" + " " + folly_flags 38 | } 39 | 40 | # All source files that should be publicly visible 41 | # Note how this does not include headers, since those can nameclash. 42 | s.source_files = [ 43 | "ios/**/*.{m,mm}", 44 | "cpp/**/*.{c,cpp}", 45 | "ios/ImageHostObject.h", 46 | "ios/JsiImage.h" 47 | ] 48 | # Any private headers that are not globally unique should be mentioned here. 49 | # Otherwise there will be a nameclash, since CocoaPods flattens out any header directories 50 | # See https://github.com/firebase/firebase-ios-sdk/issues/4035 for more details. 51 | s.preserve_paths = [ 52 | 'ios/**/*.h', 53 | 'cpp/**/*.h' 54 | ] 55 | 56 | s.dependency "React-callinvoker" 57 | s.dependency "React" 58 | s.dependency "React-Core" 59 | end 60 | -------------------------------------------------------------------------------- /cpp/JSI Utils/JsiPromise.cpp: -------------------------------------------------------------------------------- 1 | #include "JsiPromise.h" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace JsiPromise { 8 | 9 | using namespace facebook; 10 | 11 | jsi::Value PromiseVendor::createPromise(std::function)> func) { 12 | if (_runtime == nullptr) { 13 | throw new std::runtime_error("Runtime was null!"); 14 | } 15 | auto& runtime = *_runtime; 16 | auto callInvoker = _callInvoker; 17 | 18 | // get Promise constructor 19 | auto promiseCtor = runtime.global().getPropertyAsFunction(runtime, "Promise"); 20 | 21 | // create a "run" function (first Promise arg" 22 | auto runPromise = jsi::Function::createFromHostFunction(runtime, 23 | jsi::PropNameID::forUtf8(runtime, "runPromise"), 24 | 2, 25 | [callInvoker, func](jsi::Runtime& runtime, 26 | const jsi::Value& thisValue, 27 | const jsi::Value* arguments, 28 | size_t count) -> jsi::Value { 29 | auto resolveLocal = arguments[0].asObject(runtime).asFunction(runtime); 30 | auto resolve = std::make_shared(std::move(resolveLocal)); 31 | auto rejectLocal = arguments[1].asObject(runtime).asFunction(runtime); 32 | auto reject = std::make_shared(std::move(rejectLocal)); 33 | 34 | auto resolveWrapper = [resolve, &runtime, callInvoker](jsi::Value value) -> void { 35 | auto valueShared = std::make_shared(std::move(value)); 36 | callInvoker->invokeAsync([resolve, &runtime, valueShared]() -> void { 37 | resolve->call(runtime, *valueShared); 38 | }); 39 | }; 40 | auto rejectWrapper = [reject, &runtime, callInvoker](const std::string& errorMessage) -> void { 41 | auto error = jsi::JSError(runtime, errorMessage); 42 | auto errorShared = std::make_shared(error); 43 | callInvoker->invokeAsync([reject, &runtime, errorShared]() -> void { 44 | reject->call(runtime, errorShared->value()); 45 | }); 46 | }; 47 | 48 | auto promise = std::make_shared(resolveWrapper, rejectWrapper); 49 | func(promise); 50 | 51 | return jsi::Value::undefined(); 52 | }); 53 | 54 | // return new Promise((resolve, reject) => ...) 55 | return promiseCtor.callAsConstructor(runtime, runPromise); 56 | } 57 | 58 | } 59 | 60 | -------------------------------------------------------------------------------- /example/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem http://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto init 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto init 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :init 68 | @rem Get command-line arguments, handling Windows variants 69 | 70 | if not "%OS%" == "Windows_NT" goto win9xME_args 71 | 72 | :win9xME_args 73 | @rem Slurp the command line arguments. 74 | set CMD_LINE_ARGS= 75 | set _SKIP=2 76 | 77 | :win9xME_args_slurp 78 | if "x%~1" == "x" goto execute 79 | 80 | set CMD_LINE_ARGS=%* 81 | 82 | :execute 83 | @rem Setup the command line 84 | 85 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 86 | 87 | @rem Execute Gradle 88 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 89 | 90 | :end 91 | @rem End local scope for the variables with windows NT shell 92 | if "%ERRORLEVEL%"=="0" goto mainEnd 93 | 94 | :fail 95 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 96 | rem the _cmd.exe /c_ return code! 97 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 98 | exit /b 1 99 | 100 | :mainEnd 101 | if "%OS%"=="Windows_NT" endlocal 102 | 103 | :omega 104 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-jsi-image", 3 | "version": "0.1.1", 4 | "description": "A writeable in-memory Image JSI Host Object", 5 | "main": "lib/commonjs/index", 6 | "module": "lib/module/index", 7 | "types": "lib/typescript/index.d.ts", 8 | "react-native": "src/index", 9 | "source": "src/index", 10 | "files": [ 11 | "src", 12 | "lib", 13 | "android", 14 | "ios", 15 | "cpp", 16 | "react-native-jsi-image.podspec", 17 | "!lib/typescript/example", 18 | "!android/build", 19 | "!ios/build", 20 | "!**/__tests__", 21 | "!**/__fixtures__", 22 | "!**/__mocks__" 23 | ], 24 | "scripts": { 25 | "typescript": "tsc --noEmit", 26 | "lint": "eslint \"**/*.{js,ts,tsx}\"", 27 | "build": "bob build", 28 | "release": "release-it", 29 | "example": "yarn --cwd example", 30 | "pods": "cd example && pod-install --quiet", 31 | "bootstrap": "yarn example && yarn && yarn pods" 32 | }, 33 | "keywords": [ 34 | "react-native", 35 | "ios", 36 | "android" 37 | ], 38 | "repository": "https://github.com/mrousavy/react-native-jsi-image", 39 | "author": "Marc Rousavy (https://github.com/mrousavy)", 40 | "license": "MIT", 41 | "bugs": { 42 | "url": "https://github.com/mrousavy/react-native-jsi-image/issues" 43 | }, 44 | "homepage": "https://github.com/mrousavy/react-native-jsi-image#readme", 45 | "publishConfig": { 46 | "registry": "https://registry.npmjs.org/" 47 | }, 48 | "devDependencies": { 49 | "@react-native-community/eslint-config": "^2.0.0", 50 | "@release-it/conventional-changelog": "^2.0.0", 51 | "@types/jest": "^26.0.0", 52 | "@types/react": "^16.9.19", 53 | "@types/react-native": "0.62.13", 54 | "eslint": "^7.2.0", 55 | "eslint-config-prettier": "^7.0.0", 56 | "eslint-plugin-prettier": "^3.1.3", 57 | "pod-install": "^0.1.0", 58 | "prettier": "^2.0.5", 59 | "react": "^17.0.2", 60 | "react-native": "^0.66.4", 61 | "react-native-builder-bob": "^0.18.0", 62 | "release-it": "^14.2.2", 63 | "typescript": "^4.1.3" 64 | }, 65 | "peerDependencies": { 66 | "react": "*", 67 | "react-native": "*" 68 | }, 69 | "release-it": { 70 | "git": { 71 | "commitMessage": "chore: release ${version}", 72 | "tagName": "v${version}" 73 | }, 74 | "npm": { 75 | "publish": true 76 | }, 77 | "github": { 78 | "release": true 79 | }, 80 | "plugins": { 81 | "@release-it/conventional-changelog": { 82 | "preset": "angular" 83 | } 84 | } 85 | }, 86 | "eslintConfig": { 87 | "root": true, 88 | "extends": [ 89 | "@react-native-community", 90 | "prettier" 91 | ], 92 | "rules": { 93 | "prettier/prettier": [ 94 | "error", 95 | { 96 | "quoteProps": "consistent", 97 | "singleQuote": true, 98 | "tabWidth": 2, 99 | "trailingComma": "es5", 100 | "useTabs": false 101 | } 102 | ] 103 | } 104 | }, 105 | "eslintIgnore": [ 106 | "node_modules/", 107 | "lib/" 108 | ], 109 | "prettier": { 110 | "quoteProps": "consistent", 111 | "singleQuote": true, 112 | "tabWidth": 2, 113 | "trailingComma": "es5", 114 | "useTabs": false 115 | }, 116 | "react-native-builder-bob": { 117 | "source": "src", 118 | "output": "lib", 119 | "targets": [ 120 | "commonjs", 121 | "module", 122 | [ 123 | "typescript", 124 | { 125 | "project": "tsconfig.build.json" 126 | } 127 | ] 128 | ] 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /example/ios/JsiImageExample.xcodeproj/xcshareddata/xcschemes/JsiImageExample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 51 | 52 | 53 | 54 | 64 | 66 | 72 | 73 | 74 | 75 | 81 | 83 | 89 | 90 | 91 | 92 | 94 | 95 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /cpp/JSI Utils/TypedArray.h: -------------------------------------------------------------------------------- 1 | // 2 | // TypedArray.h 3 | // JsiImage 4 | // 5 | // Created by Marc Rousavy on 31.10.21. 6 | // Originally created by Expo (expo-gl) 7 | // 8 | 9 | #pragma once 10 | 11 | #include 12 | 13 | namespace jsi = facebook::jsi; 14 | 15 | enum class TypedArrayKind { 16 | Int8Array, 17 | Int16Array, 18 | Int32Array, 19 | Uint8Array, 20 | Uint8ClampedArray, 21 | Uint16Array, 22 | Uint32Array, 23 | Float32Array, 24 | Float64Array, 25 | }; 26 | 27 | template 28 | class TypedArray; 29 | 30 | template 31 | struct typedArrayTypeMap; 32 | template <> 33 | struct typedArrayTypeMap { 34 | typedef int8_t type; 35 | }; 36 | template <> 37 | struct typedArrayTypeMap { 38 | typedef int16_t type; 39 | }; 40 | template <> 41 | struct typedArrayTypeMap { 42 | typedef int32_t type; 43 | }; 44 | template <> 45 | struct typedArrayTypeMap { 46 | typedef uint8_t type; 47 | }; 48 | template <> 49 | struct typedArrayTypeMap { 50 | typedef uint8_t type; 51 | }; 52 | template <> 53 | struct typedArrayTypeMap { 54 | typedef uint16_t type; 55 | }; 56 | template <> 57 | struct typedArrayTypeMap { 58 | typedef uint32_t type; 59 | }; 60 | template <> 61 | struct typedArrayTypeMap { 62 | typedef float type; 63 | }; 64 | template <> 65 | struct typedArrayTypeMap { 66 | typedef double type; 67 | }; 68 | 69 | void invalidateJsiPropNameIDCache(); 70 | 71 | class TypedArrayBase : public jsi::Object { 72 | public: 73 | template 74 | using ContentType = typename typedArrayTypeMap::type; 75 | 76 | TypedArrayBase(jsi::Runtime &, size_t, TypedArrayKind); 77 | TypedArrayBase(jsi::Runtime &, const jsi::Object &); 78 | TypedArrayBase(TypedArrayBase &&) = default; 79 | TypedArrayBase &operator=(TypedArrayBase &&) = default; 80 | 81 | TypedArrayKind getKind(jsi::Runtime &runtime) const; 82 | 83 | template 84 | TypedArray get(jsi::Runtime &runtime) const &; 85 | template 86 | TypedArray get(jsi::Runtime &runtime) &&; 87 | template 88 | TypedArray as(jsi::Runtime &runtime) const &; 89 | template 90 | TypedArray as(jsi::Runtime &runtime) &&; 91 | 92 | size_t size(jsi::Runtime &runtime) const; 93 | size_t length(jsi::Runtime &runtime) const; 94 | size_t byteLength(jsi::Runtime &runtime) const; 95 | size_t byteOffset(jsi::Runtime &runtime) const; 96 | bool hasBuffer(jsi::Runtime &runtime) const; 97 | 98 | std::vector toVector(jsi::Runtime &runtime); 99 | jsi::ArrayBuffer getBuffer(jsi::Runtime &runtime) const; 100 | 101 | private: 102 | template 103 | friend class TypedArray; 104 | }; 105 | 106 | bool isTypedArray(jsi::Runtime &runtime, const jsi::Object &jsObj); 107 | TypedArrayBase getTypedArray(jsi::Runtime &runtime, const jsi::Object &jsObj); 108 | 109 | std::vector arrayBufferToVector(jsi::Runtime &runtime, jsi::Object &jsObj); 110 | void arrayBufferUpdate( 111 | jsi::Runtime &runtime, 112 | jsi::ArrayBuffer &buffer, 113 | std::vector data, 114 | size_t offset); 115 | 116 | template 117 | class TypedArray : public TypedArrayBase { 118 | public: 119 | TypedArray(jsi::Runtime &runtime, size_t size); 120 | TypedArray(jsi::Runtime &runtime, std::vector> data); 121 | TypedArray(TypedArrayBase &&base); 122 | TypedArray(TypedArray &&) = default; 123 | TypedArray &operator=(TypedArray &&) = default; 124 | 125 | std::vector> toVector(jsi::Runtime &runtime); 126 | void update(jsi::Runtime &runtime, const std::vector> &data); 127 | }; 128 | 129 | template 130 | TypedArray TypedArrayBase::get(jsi::Runtime &runtime) const & { 131 | assert(getKind(runtime) == T); 132 | (void)runtime; // when assert is disabled we need to mark this as used 133 | return TypedArray(jsi::Value(runtime, jsi::Value(runtime, *this).asObject(runtime))); 134 | } 135 | 136 | template 137 | TypedArray TypedArrayBase::get(jsi::Runtime &runtime) && { 138 | assert(getKind(runtime) == T); 139 | (void)runtime; // when assert is disabled we need to mark this as used 140 | return TypedArray(std::move(*this)); 141 | } 142 | 143 | template 144 | TypedArray TypedArrayBase::as(jsi::Runtime &runtime) const & { 145 | if (getKind(runtime) != T) { 146 | throw jsi::JSError(runtime, "Object is not a TypedArray"); 147 | } 148 | return get(runtime); 149 | } 150 | 151 | template 152 | TypedArray TypedArrayBase::as(jsi::Runtime &runtime) && { 153 | if (getKind(runtime) != T) { 154 | throw jsi::JSError(runtime, "Object is not a TypedArray"); 155 | } 156 | return std::move(*this).get(runtime); 157 | } 158 | -------------------------------------------------------------------------------- /ios/JsiImage.mm: -------------------------------------------------------------------------------- 1 | // 2 | // JsiImage.mm 3 | // JsiImage 4 | // 5 | // Created by Marc Rousavy on 04.01.22. 6 | // Copyright © 2022 Facebook. All rights reserved. 7 | // 8 | 9 | #import "JsiImage.h" 10 | #import "ImageHostObject.h" 11 | 12 | #import 13 | #import 14 | #import 15 | #import 16 | #import 17 | 18 | #import "../cpp/JSI Utils/JsiPromise.h" 19 | 20 | #import 21 | 22 | using namespace facebook; 23 | 24 | @implementation JsiImage 25 | @synthesize bridge = _bridge; 26 | @synthesize methodQueue = _methodQueue; 27 | 28 | RCT_EXPORT_MODULE() 29 | 30 | + (BOOL)requiresMainQueueSetup { 31 | return YES; 32 | } 33 | 34 | + (dispatch_queue_t)queue { 35 | return dispatch_queue_create("jsi-image-loader-queue", DISPATCH_QUEUE_CONCURRENT); 36 | } 37 | 38 | static void install(jsi::Runtime* jsiRuntime, std::shared_ptr callInvoker) 39 | { 40 | auto promiseVendor = std::make_shared(jsiRuntime, callInvoker); 41 | auto& runtime = *jsiRuntime; 42 | 43 | // jsiImageLoadFromFile(filePath) 44 | auto jsiImageLoadFromFile = jsi::Function::createFromHostFunction(runtime, 45 | jsi::PropNameID::forAscii(runtime, "jsiImageLoadFromFile"), 46 | 1, 47 | [callInvoker, promiseVendor](jsi::Runtime& runtime, 48 | const jsi::Value& thisValue, 49 | const jsi::Value* arguments, 50 | size_t count) -> jsi::Value { 51 | if (count != 1) { 52 | throw jsi::JSError(runtime, "jsiImageLoadFromFile(..) expects one argument (string)!"); 53 | } 54 | auto string = arguments[0].asString(runtime).utf8(runtime); 55 | 56 | auto promise = promiseVendor->createPromise([&runtime, promiseVendor, string](std::shared_ptr promise) -> void { 57 | dispatch_async([JsiImage queue], ^{ 58 | auto path = [NSString stringWithUTF8String:string.c_str()]; 59 | 60 | auto image = [[UIImage alloc] initWithContentsOfFile:path]; 61 | if (image == nil) { 62 | auto message = "Failed to load image from path \"" + string + "\"!"; 63 | promise->reject(message); 64 | return; 65 | } 66 | 67 | auto instance = std::make_shared(image, promiseVendor); 68 | // success! Image loaded. 69 | promise->resolve(jsi::Object::createFromHostObject(runtime, instance)); 70 | }); 71 | }); 72 | return promise; 73 | }); 74 | runtime.global().setProperty(runtime, "jsiImageLoadFromFile", std::move(jsiImageLoadFromFile)); 75 | 76 | 77 | // jsiImageLoadFromUrl(filePath) 78 | auto jsiImageLoadFromUrl = jsi::Function::createFromHostFunction(runtime, 79 | jsi::PropNameID::forAscii(runtime, "jsiImageLoadFromUrl"), 80 | 1, 81 | [callInvoker, promiseVendor](jsi::Runtime& runtime, 82 | const jsi::Value& thisValue, 83 | const jsi::Value* arguments, 84 | size_t count) -> jsi::Value { 85 | if (count != 1) { 86 | throw jsi::JSError(runtime, "jsiImageLoadFromUrl(..) expects one argument (string)!"); 87 | } 88 | auto string = arguments[0].asString(runtime).utf8(runtime); 89 | 90 | auto promise = promiseVendor->createPromise([&runtime, promiseVendor, string](std::shared_ptr promise) -> void { 91 | dispatch_async([JsiImage queue], ^{ 92 | auto url = [NSString stringWithUTF8String:string.c_str()]; 93 | auto image = [[UIImage alloc] initWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:url]]]; 94 | if (image == nil) { 95 | auto message = "Failed to load image from URL \"" + string + "\"!"; 96 | promise->reject(message); 97 | return; 98 | } 99 | 100 | auto instance = std::make_shared(image, promiseVendor); 101 | // success! Image loaded. 102 | promise->resolve(jsi::Object::createFromHostObject(runtime, instance)); 103 | }); 104 | }); 105 | return promise; 106 | }); 107 | runtime.global().setProperty(runtime, "jsiImageLoadFromUrl", std::move(jsiImageLoadFromUrl)); 108 | } 109 | 110 | - (void)setup 111 | { 112 | RCTCxxBridge *cxxBridge = (RCTCxxBridge *)self.bridge; 113 | if (!cxxBridge.runtime) { 114 | // retry 10ms later - THIS IS A WACK WORKAROUND. wait for TurboModules to land. 115 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.001 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{ 116 | [self setup]; 117 | }); 118 | return; 119 | } 120 | 121 | install((jsi::Runtime *)cxxBridge.runtime, self.bridge.jsCallInvoker); 122 | } 123 | 124 | - (void)setBridge:(RCTBridge *)bridge 125 | { 126 | _bridge = bridge; 127 | _setBridgeOnMainQueue = RCTIsMainQueue(); 128 | [self setup]; 129 | } 130 | 131 | @end 132 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 🖼️ react-native-jsi-image 2 | 3 | **🏗️ This library is work in progress! 🏗️** 4 | 5 | **A writeable in-memory Image JSI Host Object.** 6 | 7 | JSI-Image is a modern library that provides Image primitives for the native iOS and Android Platforms, neatly packaged together in one single fast JavaScript API. 8 | 9 | There are 3 ways to create a JSI-Image instance: 10 | 11 | * Load from a file 12 | * Load from a Web-URL 13 | * Returned by another library, such as [VisionCamera](https://github.com/mrousavy/react-native-vision-camera)'s `takePhoto(...)` function. 14 | 15 | ## Why 16 | 17 | Traditionally, Images in React Native could not be handled efficiently. To demonstrate this, let's take a look at how a Camera library might take a photo: 18 | 19 | 1. [js] User taps capture button, `takePhoto(...)` is called. 20 | 2. [native] Camera takes a photo. The library now has `UIImage` instance (photo) in-memory. 21 | 3. [native] Library creates a new file on disk. (**slow!** 🐌) 22 | 4. [native] Library writes the `UIImage` instance to the file. (**slow!** 🐌) 23 | 5. [native] Library returns the path to the file to the caller (JS) 24 | 6. [js] App now navigates to the "captured media" screen to display the media. 25 | 7. [js] App passes the file path to a `` component. 26 | 8. [native] `` component has to load the image from file. (**slow!** 🐌) 27 | 9. [native] `` component then displays the `UIImage` from the file. 28 | 29 | With JSI-Image, all the unnecessary slow file operations can be skipped, since the Image can be passed around in-memory. 30 | 31 | 1. [js] User taps capture button, `takePhoto(...)` is called. 32 | 2. [native] Camera takes a photo. The library now has `UIImage` instance (photo) in-memory. 33 | 5. [native] Library returns the `UIImage` instance to the caller (JS) (**fast!** 🔥) 34 | 6. [js] App now navigates to the "captured media" screen to display the media. 35 | 7. [js] App passes the in-memory `Image` instance to a `` component. 36 | 8. [native] `` component then displays the already in-memory `UIImage` instance. (**fast!** 🔥) 37 | 38 | ## Benchmarks 39 | 40 | ### Without JSI-Image 41 | 42 | ``` 43 | [log] Successfully took photo in 312ms! 44 | ``` 45 | 46 | ### With JSI-Image 47 | 48 | ``` 49 | [log] Successfully took photo in 95ms! 50 | ``` 51 | 52 | JSI-Image improved capture speed (`takePhoto(...)`) by more than **3x**! 53 | 54 | These improvements are even greater at more complicated image processing, such as rotating an image, applying image filters, resizing images, etc. 55 | 56 | ## Installation 57 | 58 | ```sh 59 | yarn add react-native-jsi-image 60 | cd ios && pod install 61 | ``` 62 | 63 | ## Usage 64 | 65 | ### Load from URL 66 | 67 | ```ts 68 | import { loadImageFromUrl } from "react-native-jsi-image" 69 | 70 | const image = await loadImageFromUrl('https://...') 71 | console.log(`Successfully loaded ${image.width} x ${image.height} image!`) 72 | ``` 73 | 74 | ### Load from File 75 | 76 | ```ts 77 | import { loadImageFromFile } from "react-native-jsi-image" 78 | 79 | const image = await loadImageFromFile('file:///Users/Marc/image.png') 80 | console.log(`Successfully loaded ${image.width} x ${image.height} image!`) 81 | ``` 82 | 83 | ### Inspect Image 84 | 85 | ```ts 86 | const image = ... 87 | const size = image.width * image.height 88 | const realSize = size * image.scale 89 | const orientation = image.orientation 90 | 91 | for (const pixel of image.data) { 92 | console.log(`Pixel: ${pixel}`) 93 | } 94 | ``` 95 | 96 | ### Rotate/Flip Image 97 | 98 | ```ts 99 | const image = ... 100 | console.log(image.isFlipped) // false 101 | const flipped = image.flip() 102 | console.log(flipped.isFlipped) // true 103 | 104 | if (image.orientation === "up") { 105 | // rotates image in-memory 106 | image.orientation = "right" 107 | } 108 | ``` 109 | 110 | ### Save modified Image to File 111 | 112 | ```ts 113 | let image = ... 114 | image = rotateImageCorrectly(image) 115 | await image.save('file:///tmp/temp-image.png') // or .jpg 116 | ``` 117 | 118 | ### For Library Developers 119 | 120 | To use JSI-Image in your native library, your functions must be JSI functions. 121 | 122 | #### Accept `Image` Parameter 123 | 124 | In your JSI Module: 125 | 126 | ```cpp 127 | #include 128 | 129 | // ... 130 | 131 | jsi::Value myFunction(jsi::Runtime& runtime, 132 | jsi::Value& thisArg, 133 | jsi::Value* arguments, 134 | size_t count) { 135 | auto imageHostObject = arguments[0].asObject(runtime).asHostObject(runtime); 136 | auto uiImage = imageHostObject->image; 137 | // use uiImage here 138 | } 139 | ``` 140 | 141 | In your TypeScript declaration: 142 | 143 | ```ts 144 | import { Image } from 'react-native-jsi-image' 145 | 146 | export function myFunction(image: Image): void 147 | ``` 148 | 149 | #### Return `Image` from your native module 150 | 151 | In your JSI Module: 152 | 153 | ```cpp 154 | #include 155 | 156 | // ... 157 | 158 | jsi::Value myFunction(jsi::Runtime& runtime, 159 | jsi::Value& thisArg, 160 | jsi::Value* arguments, 161 | size_t count) { 162 | UIImage* image = // ... 163 | 164 | auto instance = std::make_shared(image, promiseVendor); 165 | return jsi::Object::createFromHostObject(runtime, instance); 166 | } 167 | ``` 168 | 169 | In your TypeScript declaration: 170 | 171 | ```ts 172 | import { Image } from 'react-native-jsi-image' 173 | 174 | export function myFunction(): Image 175 | ``` 176 | 177 | ## Contributing 178 | 179 | See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow. 180 | 181 | ## License 182 | 183 | MIT 184 | -------------------------------------------------------------------------------- /example/ios/JsiImageExample/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 25 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /example/android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | # Determine the Java command to use to start the JVM. 86 | if [ -n "$JAVA_HOME" ] ; then 87 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 88 | # IBM's JDK on AIX uses strange locations for the executables 89 | JAVACMD="$JAVA_HOME/jre/sh/java" 90 | else 91 | JAVACMD="$JAVA_HOME/bin/java" 92 | fi 93 | if [ ! -x "$JAVACMD" ] ; then 94 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 95 | 96 | Please set the JAVA_HOME variable in your environment to match the 97 | location of your Java installation." 98 | fi 99 | else 100 | JAVACMD="java" 101 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 102 | 103 | Please set the JAVA_HOME variable in your environment to match the 104 | location of your Java installation." 105 | fi 106 | 107 | # Increase the maximum file descriptors if we can. 108 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 109 | MAX_FD_LIMIT=`ulimit -H -n` 110 | if [ $? -eq 0 ] ; then 111 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 112 | MAX_FD="$MAX_FD_LIMIT" 113 | fi 114 | ulimit -n $MAX_FD 115 | if [ $? -ne 0 ] ; then 116 | warn "Could not set maximum file descriptor limit: $MAX_FD" 117 | fi 118 | else 119 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 120 | fi 121 | fi 122 | 123 | # For Darwin, add options to specify how the application appears in the dock 124 | if $darwin; then 125 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 126 | fi 127 | 128 | # For Cygwin or MSYS, switch paths to Windows format before running java 129 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 130 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 131 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 132 | JAVACMD=`cygpath --unix "$JAVACMD"` 133 | 134 | # We build the pattern for arguments to be converted via cygpath 135 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 136 | SEP="" 137 | for dir in $ROOTDIRSRAW ; do 138 | ROOTDIRS="$ROOTDIRS$SEP$dir" 139 | SEP="|" 140 | done 141 | OURCYGPATTERN="(^($ROOTDIRS))" 142 | # Add a user-defined pattern to the cygpath arguments 143 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 144 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 145 | fi 146 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 147 | i=0 148 | for arg in "$@" ; do 149 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 150 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 151 | 152 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 153 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 154 | else 155 | eval `echo args$i`="\"$arg\"" 156 | fi 157 | i=`expr $i + 1` 158 | done 159 | case $i in 160 | 0) set -- ;; 161 | 1) set -- "$args0" ;; 162 | 2) set -- "$args0" "$args1" ;; 163 | 3) set -- "$args0" "$args1" "$args2" ;; 164 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 165 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 166 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 167 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 168 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 169 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 170 | esac 171 | fi 172 | 173 | # Escape application args 174 | save () { 175 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 176 | echo " " 177 | } 178 | APP_ARGS=`save "$@"` 179 | 180 | # Collect all arguments for the java command, following the shell quoting and substitution rules 181 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 182 | 183 | exec "$JAVACMD" "$@" 184 | -------------------------------------------------------------------------------- /ios/ImageHostObject.mm: -------------------------------------------------------------------------------- 1 | // 2 | // ImageHostObject.mm 3 | // JsiImage 4 | // 5 | // Created by Marc Rousavy on 04.01.22. 6 | // Copyright © 2021 Facebook. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "ImageHostObject.h" 12 | #import "../cpp/JSI Utils/TypedArray.h" 13 | #import "../cpp/JSI Utils/JsiPromise.h" 14 | 15 | std::vector ImageHostObject::getPropertyNames(jsi::Runtime& rt) { 16 | std::vector result; 17 | result.push_back(jsi::PropNameID::forUtf8(rt, std::string("toString"))); 18 | result.push_back(jsi::PropNameID::forUtf8(rt, std::string("width"))); 19 | result.push_back(jsi::PropNameID::forUtf8(rt, std::string("height"))); 20 | return result; 21 | } 22 | 23 | NSString* imageOrientationToString(UIImageOrientation orientation) { 24 | switch (orientation) { 25 | case UIImageOrientationUp: 26 | case UIImageOrientationUpMirrored: 27 | return @"up"; 28 | case UIImageOrientationDown: 29 | case UIImageOrientationDownMirrored: 30 | return @"down"; 31 | case UIImageOrientationLeft: 32 | case UIImageOrientationLeftMirrored: 33 | return @"left"; 34 | case UIImageOrientationRight: 35 | case UIImageOrientationRightMirrored: 36 | return @"right"; 37 | } 38 | } 39 | 40 | bool isFlipped(UIImageOrientation orientation) { 41 | switch (orientation) { 42 | case UIImageOrientationUpMirrored: 43 | case UIImageOrientationDownMirrored: 44 | case UIImageOrientationLeftMirrored: 45 | case UIImageOrientationRightMirrored: 46 | return true; 47 | default: 48 | return false; 49 | } 50 | } 51 | 52 | jsi::Value ImageHostObject::get(jsi::Runtime& runtime, const jsi::PropNameID& propNameId) { 53 | auto propName = propNameId.utf8(runtime); 54 | 55 | // -------- Props -------- 56 | 57 | if (propName == "width") { 58 | return jsi::Value((double) image.size.width); 59 | } 60 | 61 | if (propName == "height") { 62 | return jsi::Value((double) image.size.height); 63 | } 64 | 65 | if (propName == "scale") { 66 | return jsi::Value((double) image.scale); 67 | } 68 | 69 | if (propName == "orientation") { 70 | NSString* string = imageOrientationToString(image.imageOrientation); 71 | return jsi::String::createFromUtf8(runtime, string.UTF8String); 72 | } 73 | 74 | if (propName == "isFlipped") { 75 | return jsi::Value(isFlipped(image.imageOrientation)); 76 | } 77 | 78 | if (propName == "data") { 79 | auto pngData = UIImagePNGRepresentation(image); 80 | if (pngData == nil) { 81 | throw jsi::JSError(runtime, "Underlying Image has no data!"); 82 | } 83 | size_t length = static_cast(pngData.length); 84 | // Create Uint8Array 85 | auto bitArray = TypedArray(runtime, length); 86 | // Get writeable ArrayBuffer 87 | auto buffer = bitArray.getBuffer(runtime); 88 | // Copy PNG Data to ArrayBuffer's buffer 89 | memcpy(buffer.data(runtime), pngData.bytes, length); 90 | return bitArray; 91 | } 92 | 93 | // -------- Functions -------- 94 | 95 | if (propName == "flip") { 96 | auto flip = [this] (jsi::Runtime& runtime, 97 | const jsi::Value&, 98 | const jsi::Value*, 99 | size_t) -> jsi::Value { 100 | auto flippedImage = [image imageWithHorizontallyFlippedOrientation]; 101 | auto newHostObject = std::make_shared(flippedImage, _promiseVendor); 102 | return jsi::Object::createFromHostObject(runtime, newHostObject); 103 | }; 104 | return jsi::Function::createFromHostFunction(runtime, 105 | jsi::PropNameID::forUtf8(runtime, "flip"), 106 | 0, 107 | flip); 108 | } 109 | 110 | 111 | 112 | if (propName == "save") { 113 | auto flip = [this] (jsi::Runtime& runtime, 114 | const jsi::Value&, 115 | const jsi::Value* arguments, 116 | size_t count) -> jsi::Value { 117 | if (count != 1) { 118 | throw jsi::JSError(runtime, "Image.save(..) expects one argument (string)!"); 119 | } 120 | auto string = arguments[0].asString(runtime).utf8(runtime); 121 | 122 | auto promise = _promiseVendor->createPromise([this, string](std::shared_ptr promise) -> void { 123 | NSString* path = [NSString stringWithUTF8String:string.c_str()]; 124 | 125 | dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ 126 | if ([path.lowercaseString hasSuffix:@".png"]) { 127 | // Write .png file 128 | [UIImagePNGRepresentation(image) writeToFile:path atomically:YES]; 129 | promise->resolve(jsi::Value::undefined()); 130 | } else if ([path.lowercaseString hasSuffix:@".jpg"]) { 131 | // Write .jpg file 132 | [UIImageJPEGRepresentation(image, 1.0) writeToFile:path atomically:YES]; 133 | promise->resolve(jsi::Value::undefined()); 134 | } else { 135 | // Unknown file type! 136 | promise->reject("Unknown file extension! File path must end with either \".png\" or \".jpg\"!"); 137 | } 138 | }); 139 | }); 140 | return promise; 141 | }; 142 | return jsi::Function::createFromHostFunction(runtime, 143 | jsi::PropNameID::forUtf8(runtime, "flip"), 144 | 0, 145 | flip); 146 | } 147 | 148 | if (propName == "toString") { 149 | auto toString = [this] (jsi::Runtime& runtime, 150 | const jsi::Value&, 151 | const jsi::Value*, 152 | size_t) -> jsi::Value { 153 | auto width = image.size.width; 154 | auto height = image.size.height; 155 | 156 | NSMutableString* string = [NSMutableString stringWithFormat:@"%f x %f Photo", width, height]; 157 | return jsi::String::createFromUtf8(runtime, string.UTF8String); 158 | }; 159 | return jsi::Function::createFromHostFunction(runtime, 160 | jsi::PropNameID::forUtf8(runtime, "toString"), 161 | 0, 162 | toString); 163 | } 164 | 165 | return jsi::Value::undefined(); 166 | } 167 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "com.android.application" 2 | 3 | import com.android.build.OutputFile 4 | 5 | /** 6 | * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets 7 | * and bundleReleaseJsAndAssets). 8 | * These basically call `react-native bundle` with the correct arguments during the Android build 9 | * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the 10 | * bundle directly from the development server. Below you can see all the possible configurations 11 | * and their defaults. If you decide to add a configuration block, make sure to add it before the 12 | * `apply from: "../../node_modules/react-native/react.gradle"` line. 13 | * 14 | * project.ext.react = [ 15 | * // the name of the generated asset file containing your JS bundle 16 | * bundleAssetName: "index.android.bundle", 17 | * 18 | * // the entry file for bundle generation 19 | * entryFile: "index.android.js", 20 | * 21 | * // https://reactnative.dev/docs/performance#enable-the-ram-format 22 | * bundleCommand: "ram-bundle", 23 | * 24 | * // whether to bundle JS and assets in debug mode 25 | * bundleInDebug: false, 26 | * 27 | * // whether to bundle JS and assets in release mode 28 | * bundleInRelease: true, 29 | * 30 | * // whether to bundle JS and assets in another build variant (if configured). 31 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants 32 | * // The configuration property can be in the following formats 33 | * // 'bundleIn${productFlavor}${buildType}' 34 | * // 'bundleIn${buildType}' 35 | * // bundleInFreeDebug: true, 36 | * // bundleInPaidRelease: true, 37 | * // bundleInBeta: true, 38 | * 39 | * // whether to disable dev mode in custom build variants (by default only disabled in release) 40 | * // for JsiImageExample: to disable dev mode in the staging build type (if configured) 41 | * devDisabledInStaging: true, 42 | * // The configuration property can be in the following formats 43 | * // 'devDisabledIn${productFlavor}${buildType}' 44 | * // 'devDisabledIn${buildType}' 45 | * 46 | * // the root of your project, i.e. where "package.json" lives 47 | * root: "../../", 48 | * 49 | * // where to put the JS bundle asset in debug mode 50 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", 51 | * 52 | * // where to put the JS bundle asset in release mode 53 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release", 54 | * 55 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 56 | * // require('./image.png')), in debug mode 57 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", 58 | * 59 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 60 | * // require('./image.png')), in release mode 61 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", 62 | * 63 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means 64 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to 65 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle 66 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ 67 | * // for JsiImageExample, you might want to remove it from here. 68 | * inputExcludes: ["android/**", "ios/**"], 69 | * 70 | * // override which node gets called and with what additional arguments 71 | * nodeExecutableAndArgs: ["node"], 72 | * 73 | * // supply additional arguments to the packager 74 | * extraPackagerArgs: [] 75 | * ] 76 | */ 77 | 78 | project.ext.react = [ 79 | enableHermes: false, // clean and rebuild if changing 80 | entryFile: "index.tsx", 81 | ] 82 | 83 | apply from: "../../node_modules/react-native/react.gradle" 84 | 85 | /** 86 | * Set this to true to create two separate APKs instead of one: 87 | * - An APK that only works on ARM devices 88 | * - An APK that only works on x86 devices 89 | * The advantage is the size of the APK is reduced by about 4MB. 90 | * Upload all the APKs to the Play Store and people will download 91 | * the correct one based on the CPU architecture of their device. 92 | */ 93 | def enableSeparateBuildPerCPUArchitecture = false 94 | 95 | /** 96 | * Run Proguard to shrink the Java bytecode in release builds. 97 | */ 98 | def enableProguardInReleaseBuilds = false 99 | 100 | /** 101 | * The preferred build flavor of JavaScriptCore. 102 | * 103 | * For JsiImageExample, to use the international variant, you can use: 104 | * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` 105 | * 106 | * The international variant includes ICU i18n library and necessary data 107 | * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that 108 | * give correct results when using with locales other than en-US. Note that 109 | * this variant is about 6MiB larger per architecture than default. 110 | */ 111 | def jscFlavor = 'org.webkit:android-jsc:+' 112 | 113 | /** 114 | * Whether to enable the Hermes VM. 115 | * 116 | * This should be set on project.ext.react and mirrored here. If it is not set 117 | * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode 118 | * and the benefits of using Hermes will therefore be sharply reduced. 119 | */ 120 | def enableHermes = project.ext.react.get("enableHermes", false); 121 | 122 | /** 123 | * Architectures to build native code for in debug. 124 | */ 125 | def nativeArchitectures = project.getProperties().get("reactNativeDebugArchitectures") 126 | 127 | android { 128 | ndkVersion rootProject.ext.ndkVersion 129 | compileSdkVersion rootProject.ext.compileSdkVersion 130 | 131 | compileOptions { 132 | sourceCompatibility JavaVersion.VERSION_1_8 133 | targetCompatibility JavaVersion.VERSION_1_8 134 | } 135 | 136 | defaultConfig { 137 | applicationId "com.example.reactnativejsiimage" 138 | minSdkVersion rootProject.ext.minSdkVersion 139 | targetSdkVersion rootProject.ext.targetSdkVersion 140 | versionCode 1 141 | versionName "1.0" 142 | } 143 | splits { 144 | abi { 145 | reset() 146 | enable enableSeparateBuildPerCPUArchitecture 147 | universalApk false // If true, also generate a universal APK 148 | include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" 149 | } 150 | } 151 | signingConfigs { 152 | debug { 153 | storeFile file('debug.keystore') 154 | storePassword 'android' 155 | keyAlias 'androiddebugkey' 156 | keyPassword 'android' 157 | } 158 | } 159 | buildTypes { 160 | debug { 161 | signingConfig signingConfigs.debug 162 | } 163 | release { 164 | // Caution! In production, you need to generate your own keystore file. 165 | // see https://reactnative.dev/docs/signed-apk-android. 166 | signingConfig signingConfigs.debug 167 | minifyEnabled enableProguardInReleaseBuilds 168 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 169 | } 170 | } 171 | // applicationVariants are e.g. debug, release 172 | applicationVariants.all { variant -> 173 | variant.outputs.each { output -> 174 | // For each separate APK per architecture, set a unique version code as described here: 175 | // https://developer.android.com/studio/build/configure-apk-splits.html 176 | def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4] 177 | def abi = output.getFilter(OutputFile.ABI) 178 | if (abi != null) { // null for the universal-debug, universal-release variants 179 | output.versionCodeOverride = 180 | defaultConfig.versionCode * 1000 + versionCodes.get(abi) 181 | } 182 | 183 | } 184 | } 185 | } 186 | 187 | dependencies { 188 | implementation fileTree(dir: "libs", include: ["*.jar"]) 189 | //noinspection GradleDynamicVersion 190 | implementation "com.facebook.react:react-native:+" // From node_modules 191 | 192 | 193 | implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" 194 | 195 | if (enableHermes) { 196 | def hermesPath = "../../node_modules/hermes-engine/android/"; 197 | debugImplementation files(hermesPath + "hermes-debug.aar") 198 | releaseImplementation files(hermesPath + "hermes-release.aar") 199 | } else { 200 | implementation jscFlavor 201 | } 202 | 203 | implementation project(':reactnativejsiimage') 204 | } 205 | 206 | // Run this once to be able to run the application with BUCK 207 | // puts all compile dependencies into folder libs for BUCK to use 208 | task copyDownloadableDepsToLibs(type: Copy) { 209 | from configurations.implementation 210 | into 'libs' 211 | } 212 | 213 | apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) 214 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | We want this community to be friendly and respectful to each other. Please follow it in all your interactions with the project. 4 | 5 | ## Development workflow 6 | 7 | To get started with the project, run `yarn` in the root directory to install the required dependencies for each package: 8 | 9 | ```sh 10 | yarn 11 | ``` 12 | 13 | > While it's possible to use [`npm`](https://github.com/npm/cli), the tooling is built around [`yarn`](https://classic.yarnpkg.com/), so you'll have an easier time if you use `yarn` for development. 14 | 15 | While developing, you can run the [example app](/example/) to test your changes. Any changes you make in your library's JavaScript code will be reflected in the example app without a rebuild. If you change any native code, then you'll need to rebuild the example app. 16 | 17 | To start the packager: 18 | 19 | ```sh 20 | yarn example start 21 | ``` 22 | 23 | To run the example app on Android: 24 | 25 | ```sh 26 | yarn example android 27 | ``` 28 | 29 | To run the example app on iOS: 30 | 31 | ```sh 32 | yarn example ios 33 | ``` 34 | 35 | Make sure your code passes TypeScript and ESLint. Run the following to verify: 36 | 37 | ```sh 38 | yarn typescript 39 | yarn lint 40 | ``` 41 | 42 | To fix formatting errors, run the following: 43 | 44 | ```sh 45 | yarn lint --fix 46 | ``` 47 | 48 | Remember to add tests for your change if possible. Run the unit tests by: 49 | 50 | ```sh 51 | yarn test 52 | ``` 53 | 54 | To edit the Objective-C files, open `example/ios/JsiImageExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > react-native-jsi-image`. 55 | 56 | To edit the Kotlin files, open `example/android` in Android studio and find the source files at `reactnativejsiimage` under `Android`. 57 | 58 | ### Commit message convention 59 | 60 | We follow the [conventional commits specification](https://www.conventionalcommits.org/en) for our commit messages: 61 | 62 | - `fix`: bug fixes, e.g. fix crash due to deprecated method. 63 | - `feat`: new features, e.g. add new method to the module. 64 | - `refactor`: code refactor, e.g. migrate from class components to hooks. 65 | - `docs`: changes into documentation, e.g. add usage example for the module.. 66 | - `test`: adding or updating tests, e.g. add integration tests using detox. 67 | - `chore`: tooling changes, e.g. change CI config. 68 | 69 | Our pre-commit hooks verify that your commit message matches this format when committing. 70 | 71 | ### Linting and tests 72 | 73 | [ESLint](https://eslint.org/), [Prettier](https://prettier.io/), [TypeScript](https://www.typescriptlang.org/) 74 | 75 | We use [TypeScript](https://www.typescriptlang.org/) for type checking, [ESLint](https://eslint.org/) with [Prettier](https://prettier.io/) for linting and formatting the code, and [Jest](https://jestjs.io/) for testing. 76 | 77 | Our pre-commit hooks verify that the linter and tests pass when committing. 78 | 79 | ### Publishing to npm 80 | 81 | We use [release-it](https://github.com/release-it/release-it) to make it easier to publish new versions. It handles common tasks like bumping version based on semver, creating tags and releases etc. 82 | 83 | To publish new versions, run the following: 84 | 85 | ```sh 86 | yarn release 87 | ``` 88 | 89 | ### Scripts 90 | 91 | The `package.json` file contains various scripts for common tasks: 92 | 93 | - `yarn bootstrap`: setup project by installing all dependencies and pods. 94 | - `yarn typescript`: type-check files with TypeScript. 95 | - `yarn lint`: lint files with ESLint. 96 | - `yarn test`: run unit tests with Jest. 97 | - `yarn example start`: start the Metro server for the example app. 98 | - `yarn example android`: run the example app on Android. 99 | - `yarn example ios`: run the example app on iOS. 100 | 101 | ### Sending a pull request 102 | 103 | > **Working on your first pull request?** You can learn how from this _free_ series: [How to Contribute to an Open Source Project on GitHub](https://app.egghead.io/playlists/how-to-contribute-to-an-open-source-project-on-github). 104 | 105 | When you're sending a pull request: 106 | 107 | - Prefer small pull requests focused on one change. 108 | - Verify that linters and tests are passing. 109 | - Review the documentation to make sure it looks good. 110 | - Follow the pull request template when opening a pull request. 111 | - For pull requests that change the API or implementation, discuss with maintainers first by opening an issue. 112 | 113 | ## Code of Conduct 114 | 115 | ### Our Pledge 116 | 117 | We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. 118 | 119 | We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. 120 | 121 | ### Our Standards 122 | 123 | Examples of behavior that contributes to a positive environment for our community include: 124 | 125 | - Demonstrating empathy and kindness toward other people 126 | - Being respectful of differing opinions, viewpoints, and experiences 127 | - Giving and gracefully accepting constructive feedback 128 | - Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience 129 | - Focusing on what is best not just for us as individuals, but for the overall community 130 | 131 | Examples of unacceptable behavior include: 132 | 133 | - The use of sexualized language or imagery, and sexual attention or 134 | advances of any kind 135 | - Trolling, insulting or derogatory comments, and personal or political attacks 136 | - Public or private harassment 137 | - Publishing others' private information, such as a physical or email 138 | address, without their explicit permission 139 | - Other conduct which could reasonably be considered inappropriate in a 140 | professional setting 141 | 142 | ### Enforcement Responsibilities 143 | 144 | Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. 145 | 146 | Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. 147 | 148 | ### Scope 149 | 150 | This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. 151 | 152 | ### Enforcement 153 | 154 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [INSERT CONTACT METHOD]. All complaints will be reviewed and investigated promptly and fairly. 155 | 156 | All community leaders are obligated to respect the privacy and security of the reporter of any incident. 157 | 158 | ### Enforcement Guidelines 159 | 160 | Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: 161 | 162 | #### 1. Correction 163 | 164 | **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. 165 | 166 | **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. 167 | 168 | #### 2. Warning 169 | 170 | **Community Impact**: A violation through a single incident or series of actions. 171 | 172 | **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. 173 | 174 | #### 3. Temporary Ban 175 | 176 | **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. 177 | 178 | **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. 179 | 180 | #### 4. Permanent Ban 181 | 182 | **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. 183 | 184 | **Consequence**: A permanent ban from any sort of public interaction within the community. 185 | 186 | ### Attribution 187 | 188 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, 189 | available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 190 | 191 | Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity). 192 | 193 | [homepage]: https://www.contributor-covenant.org 194 | 195 | For answers to common questions about this code of conduct, see the FAQ at 196 | https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations. 197 | -------------------------------------------------------------------------------- /ios/JsiImage.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | B8B1995B27843EBD00E74AEA /* ImageHostObject.mm in Sources */ = {isa = PBXBuildFile; fileRef = B8B1995A27843EBD00E74AEA /* ImageHostObject.mm */; }; 11 | B8B1995E2784456A00E74AEA /* JsiImage.mm in Sources */ = {isa = PBXBuildFile; fileRef = B8B1995D2784456A00E74AEA /* JsiImage.mm */; }; 12 | /* End PBXBuildFile section */ 13 | 14 | /* Begin PBXCopyFilesBuildPhase section */ 15 | 58B511D91A9E6C8500147676 /* CopyFiles */ = { 16 | isa = PBXCopyFilesBuildPhase; 17 | buildActionMask = 2147483647; 18 | dstPath = "include/$(PRODUCT_NAME)"; 19 | dstSubfolderSpec = 16; 20 | files = ( 21 | ); 22 | runOnlyForDeploymentPostprocessing = 0; 23 | }; 24 | /* End PBXCopyFilesBuildPhase section */ 25 | 26 | /* Begin PBXFileReference section */ 27 | 134814201AA4EA6300B7C361 /* libJsiImage.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libJsiImage.a; sourceTree = BUILT_PRODUCTS_DIR; }; 28 | B8B1995A27843EBD00E74AEA /* ImageHostObject.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ImageHostObject.mm; sourceTree = ""; }; 29 | B8B1995C27843EC400E74AEA /* ImageHostObject.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ImageHostObject.h; sourceTree = ""; }; 30 | B8B1995D2784456A00E74AEA /* JsiImage.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = JsiImage.mm; sourceTree = ""; }; 31 | B8B1995F2784457900E74AEA /* JsiImage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JsiImage.h; sourceTree = ""; }; 32 | B8B1996027845A2E00E74AEA /* cpp */ = {isa = PBXFileReference; lastKnownFileType = folder; name = cpp; path = ../cpp; sourceTree = ""; }; 33 | /* End PBXFileReference section */ 34 | 35 | /* Begin PBXFrameworksBuildPhase section */ 36 | 58B511D81A9E6C8500147676 /* Frameworks */ = { 37 | isa = PBXFrameworksBuildPhase; 38 | buildActionMask = 2147483647; 39 | files = ( 40 | ); 41 | runOnlyForDeploymentPostprocessing = 0; 42 | }; 43 | /* End PBXFrameworksBuildPhase section */ 44 | 45 | /* Begin PBXGroup section */ 46 | 134814211AA4EA7D00B7C361 /* Products */ = { 47 | isa = PBXGroup; 48 | children = ( 49 | 134814201AA4EA6300B7C361 /* libJsiImage.a */, 50 | ); 51 | name = Products; 52 | sourceTree = ""; 53 | }; 54 | 58B511D21A9E6C8500147676 = { 55 | isa = PBXGroup; 56 | children = ( 57 | B8B1995F2784457900E74AEA /* JsiImage.h */, 58 | B8B1995D2784456A00E74AEA /* JsiImage.mm */, 59 | B8B1995C27843EC400E74AEA /* ImageHostObject.h */, 60 | B8B1995A27843EBD00E74AEA /* ImageHostObject.mm */, 61 | B8B1996027845A2E00E74AEA /* cpp */, 62 | 134814211AA4EA7D00B7C361 /* Products */, 63 | ); 64 | sourceTree = ""; 65 | }; 66 | /* End PBXGroup section */ 67 | 68 | /* Begin PBXNativeTarget section */ 69 | 58B511DA1A9E6C8500147676 /* JsiImage */ = { 70 | isa = PBXNativeTarget; 71 | buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "JsiImage" */; 72 | buildPhases = ( 73 | 58B511D71A9E6C8500147676 /* Sources */, 74 | 58B511D81A9E6C8500147676 /* Frameworks */, 75 | 58B511D91A9E6C8500147676 /* CopyFiles */, 76 | ); 77 | buildRules = ( 78 | ); 79 | dependencies = ( 80 | ); 81 | name = JsiImage; 82 | productName = RCTDataManager; 83 | productReference = 134814201AA4EA6300B7C361 /* libJsiImage.a */; 84 | productType = "com.apple.product-type.library.static"; 85 | }; 86 | /* End PBXNativeTarget section */ 87 | 88 | /* Begin PBXProject section */ 89 | 58B511D31A9E6C8500147676 /* Project object */ = { 90 | isa = PBXProject; 91 | attributes = { 92 | LastUpgradeCheck = 0920; 93 | ORGANIZATIONNAME = Facebook; 94 | TargetAttributes = { 95 | 58B511DA1A9E6C8500147676 = { 96 | CreatedOnToolsVersion = 6.1.1; 97 | }; 98 | }; 99 | }; 100 | buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "JsiImage" */; 101 | compatibilityVersion = "Xcode 3.2"; 102 | developmentRegion = English; 103 | hasScannedForEncodings = 0; 104 | knownRegions = ( 105 | English, 106 | en, 107 | ); 108 | mainGroup = 58B511D21A9E6C8500147676; 109 | productRefGroup = 58B511D21A9E6C8500147676; 110 | projectDirPath = ""; 111 | projectRoot = ""; 112 | targets = ( 113 | 58B511DA1A9E6C8500147676 /* JsiImage */, 114 | ); 115 | }; 116 | /* End PBXProject section */ 117 | 118 | /* Begin PBXSourcesBuildPhase section */ 119 | 58B511D71A9E6C8500147676 /* Sources */ = { 120 | isa = PBXSourcesBuildPhase; 121 | buildActionMask = 2147483647; 122 | files = ( 123 | B8B1995E2784456A00E74AEA /* JsiImage.mm in Sources */, 124 | B8B1995B27843EBD00E74AEA /* ImageHostObject.mm in Sources */, 125 | ); 126 | runOnlyForDeploymentPostprocessing = 0; 127 | }; 128 | /* End PBXSourcesBuildPhase section */ 129 | 130 | /* Begin XCBuildConfiguration section */ 131 | 58B511ED1A9E6C8500147676 /* Debug */ = { 132 | isa = XCBuildConfiguration; 133 | buildSettings = { 134 | ALWAYS_SEARCH_USER_PATHS = NO; 135 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 136 | CLANG_CXX_LIBRARY = "libc++"; 137 | CLANG_ENABLE_MODULES = YES; 138 | CLANG_ENABLE_OBJC_ARC = YES; 139 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 140 | CLANG_WARN_BOOL_CONVERSION = YES; 141 | CLANG_WARN_COMMA = YES; 142 | CLANG_WARN_CONSTANT_CONVERSION = YES; 143 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 144 | CLANG_WARN_EMPTY_BODY = YES; 145 | CLANG_WARN_ENUM_CONVERSION = YES; 146 | CLANG_WARN_INFINITE_RECURSION = YES; 147 | CLANG_WARN_INT_CONVERSION = YES; 148 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 149 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 150 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 151 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 152 | CLANG_WARN_STRICT_PROTOTYPES = YES; 153 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 154 | CLANG_WARN_UNREACHABLE_CODE = YES; 155 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 156 | COPY_PHASE_STRIP = NO; 157 | ENABLE_STRICT_OBJC_MSGSEND = YES; 158 | ENABLE_TESTABILITY = YES; 159 | GCC_C_LANGUAGE_STANDARD = gnu99; 160 | GCC_DYNAMIC_NO_PIC = NO; 161 | GCC_NO_COMMON_BLOCKS = YES; 162 | GCC_OPTIMIZATION_LEVEL = 0; 163 | GCC_PREPROCESSOR_DEFINITIONS = ( 164 | "DEBUG=1", 165 | "$(inherited)", 166 | ); 167 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 168 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 169 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 170 | GCC_WARN_UNDECLARED_SELECTOR = YES; 171 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 172 | GCC_WARN_UNUSED_FUNCTION = YES; 173 | GCC_WARN_UNUSED_VARIABLE = YES; 174 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 175 | MTL_ENABLE_DEBUG_INFO = YES; 176 | ONLY_ACTIVE_ARCH = YES; 177 | SDKROOT = iphoneos; 178 | }; 179 | name = Debug; 180 | }; 181 | 58B511EE1A9E6C8500147676 /* Release */ = { 182 | isa = XCBuildConfiguration; 183 | buildSettings = { 184 | ALWAYS_SEARCH_USER_PATHS = NO; 185 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 186 | CLANG_CXX_LIBRARY = "libc++"; 187 | CLANG_ENABLE_MODULES = YES; 188 | CLANG_ENABLE_OBJC_ARC = YES; 189 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 190 | CLANG_WARN_BOOL_CONVERSION = YES; 191 | CLANG_WARN_COMMA = YES; 192 | CLANG_WARN_CONSTANT_CONVERSION = YES; 193 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 194 | CLANG_WARN_EMPTY_BODY = YES; 195 | CLANG_WARN_ENUM_CONVERSION = YES; 196 | CLANG_WARN_INFINITE_RECURSION = YES; 197 | CLANG_WARN_INT_CONVERSION = YES; 198 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 199 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 200 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 201 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 202 | CLANG_WARN_STRICT_PROTOTYPES = YES; 203 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 204 | CLANG_WARN_UNREACHABLE_CODE = YES; 205 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 206 | COPY_PHASE_STRIP = YES; 207 | ENABLE_NS_ASSERTIONS = NO; 208 | ENABLE_STRICT_OBJC_MSGSEND = YES; 209 | GCC_C_LANGUAGE_STANDARD = gnu99; 210 | GCC_NO_COMMON_BLOCKS = YES; 211 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 212 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 213 | GCC_WARN_UNDECLARED_SELECTOR = YES; 214 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 215 | GCC_WARN_UNUSED_FUNCTION = YES; 216 | GCC_WARN_UNUSED_VARIABLE = YES; 217 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 218 | MTL_ENABLE_DEBUG_INFO = NO; 219 | SDKROOT = iphoneos; 220 | VALIDATE_PRODUCT = YES; 221 | }; 222 | name = Release; 223 | }; 224 | 58B511F01A9E6C8500147676 /* Debug */ = { 225 | isa = XCBuildConfiguration; 226 | buildSettings = { 227 | HEADER_SEARCH_PATHS = ( 228 | "$(inherited)", 229 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 230 | "$(SRCROOT)/../../../React/**", 231 | "$(SRCROOT)/../../react-native/React/**", 232 | ); 233 | LIBRARY_SEARCH_PATHS = "$(inherited)"; 234 | OTHER_LDFLAGS = "-ObjC"; 235 | PRODUCT_NAME = JsiImage; 236 | SKIP_INSTALL = YES; 237 | }; 238 | name = Debug; 239 | }; 240 | 58B511F11A9E6C8500147676 /* Release */ = { 241 | isa = XCBuildConfiguration; 242 | buildSettings = { 243 | HEADER_SEARCH_PATHS = ( 244 | "$(inherited)", 245 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 246 | "$(SRCROOT)/../../../React/**", 247 | "$(SRCROOT)/../../react-native/React/**", 248 | ); 249 | LIBRARY_SEARCH_PATHS = "$(inherited)"; 250 | OTHER_LDFLAGS = "-ObjC"; 251 | PRODUCT_NAME = JsiImage; 252 | SKIP_INSTALL = YES; 253 | }; 254 | name = Release; 255 | }; 256 | /* End XCBuildConfiguration section */ 257 | 258 | /* Begin XCConfigurationList section */ 259 | 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "JsiImage" */ = { 260 | isa = XCConfigurationList; 261 | buildConfigurations = ( 262 | 58B511ED1A9E6C8500147676 /* Debug */, 263 | 58B511EE1A9E6C8500147676 /* Release */, 264 | ); 265 | defaultConfigurationIsVisible = 0; 266 | defaultConfigurationName = Release; 267 | }; 268 | 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "JsiImage" */ = { 269 | isa = XCConfigurationList; 270 | buildConfigurations = ( 271 | 58B511F01A9E6C8500147676 /* Debug */, 272 | 58B511F11A9E6C8500147676 /* Release */, 273 | ); 274 | defaultConfigurationIsVisible = 0; 275 | defaultConfigurationName = Release; 276 | }; 277 | /* End XCConfigurationList section */ 278 | }; 279 | rootObject = 58B511D31A9E6C8500147676 /* Project object */; 280 | } 281 | -------------------------------------------------------------------------------- /cpp/JSI Utils/TypedArray.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // TypedArray.cpp 3 | // JsiImage 4 | // 5 | // Created by Marc Rousavy on 31.10.21. 6 | // Originally created by Expo (expo-gl) 7 | // 8 | 9 | #include "TypedArray.h" 10 | 11 | #include 12 | 13 | template 14 | using ContentType = typename typedArrayTypeMap::type; 15 | 16 | enum class Prop { 17 | Buffer, // "buffer" 18 | Constructor, // "constructor" 19 | Name, // "name" 20 | Proto, // "__proto__" 21 | Length, // "length" 22 | ByteLength, // "byteLength" 23 | ByteOffset, // "offset" 24 | IsView, // "isView" 25 | ArrayBuffer, // "ArrayBuffer" 26 | Int8Array, // "Int8Array" 27 | Int16Array, // "Int16Array" 28 | Int32Array, // "Int32Array" 29 | Uint8Array, // "Uint8Array" 30 | Uint8ClampedArray, // "Uint8ClampedArray" 31 | Uint16Array, // "Uint16Array" 32 | Uint32Array, // "Uint32Array" 33 | Float32Array, // "Float32Array" 34 | Float64Array, // "Float64Array" 35 | }; 36 | 37 | class PropNameIDCache { 38 | public: 39 | const jsi::PropNameID &get(jsi::Runtime &runtime, Prop prop) { 40 | if (!this->props[prop]) { 41 | this->props[prop] = std::make_unique(createProp(runtime, prop)); 42 | } 43 | return *(this->props[prop]); 44 | } 45 | 46 | const jsi::PropNameID &getConstructorNameProp(jsi::Runtime &runtime, TypedArrayKind kind); 47 | 48 | void invalidate() { 49 | props.erase(props.begin(), props.end()); 50 | } 51 | 52 | private: 53 | std::unordered_map> props; 54 | 55 | jsi::PropNameID createProp(jsi::Runtime &runtime, Prop prop); 56 | }; 57 | 58 | PropNameIDCache propNameIDCache; 59 | 60 | void invalidateJsiPropNameIDCache() { 61 | propNameIDCache.invalidate(); 62 | } 63 | 64 | TypedArrayKind getTypedArrayKindForName(const std::string &name); 65 | 66 | TypedArrayBase::TypedArrayBase(jsi::Runtime &runtime, size_t size, TypedArrayKind kind) 67 | : TypedArrayBase( 68 | runtime, 69 | runtime.global() 70 | .getProperty(runtime, propNameIDCache.getConstructorNameProp(runtime, kind)) 71 | .asObject(runtime) 72 | .asFunction(runtime) 73 | .callAsConstructor(runtime, {static_cast(size)}) 74 | .asObject(runtime)) {} 75 | 76 | TypedArrayBase::TypedArrayBase(jsi::Runtime &runtime, const jsi::Object &obj) 77 | : jsi::Object(jsi::Value(runtime, obj).asObject(runtime)) {} 78 | 79 | TypedArrayKind TypedArrayBase::getKind(jsi::Runtime &runtime) const { 80 | auto constructorName = this->getProperty(runtime, propNameIDCache.get(runtime, Prop::Constructor)) 81 | .asObject(runtime) 82 | .getProperty(runtime, propNameIDCache.get(runtime, Prop::Name)) 83 | .asString(runtime) 84 | .utf8(runtime); 85 | return getTypedArrayKindForName(constructorName); 86 | }; 87 | 88 | size_t TypedArrayBase::size(jsi::Runtime &runtime) const { 89 | return getProperty(runtime, propNameIDCache.get(runtime, Prop::Length)).asNumber(); 90 | } 91 | 92 | size_t TypedArrayBase::length(jsi::Runtime &runtime) const { 93 | return getProperty(runtime, propNameIDCache.get(runtime, Prop::Length)).asNumber(); 94 | } 95 | 96 | size_t TypedArrayBase::byteLength(jsi::Runtime &runtime) const { 97 | return getProperty(runtime, propNameIDCache.get(runtime, Prop::ByteLength)).asNumber(); 98 | } 99 | 100 | size_t TypedArrayBase::byteOffset(jsi::Runtime &runtime) const { 101 | return getProperty(runtime, propNameIDCache.get(runtime, Prop::ByteOffset)).asNumber(); 102 | } 103 | 104 | bool TypedArrayBase::hasBuffer(jsi::Runtime &runtime) const { 105 | auto buffer = getProperty(runtime, propNameIDCache.get(runtime, Prop::Buffer)); 106 | return buffer.isObject() && buffer.asObject(runtime).isArrayBuffer(runtime); 107 | } 108 | 109 | std::vector TypedArrayBase::toVector(jsi::Runtime &runtime) { 110 | auto start = 111 | reinterpret_cast(getBuffer(runtime).data(runtime) + byteOffset(runtime)); 112 | auto end = start + byteLength(runtime); 113 | return std::vector(start, end); 114 | } 115 | 116 | jsi::ArrayBuffer TypedArrayBase::getBuffer(jsi::Runtime &runtime) const { 117 | auto buffer = getProperty(runtime, propNameIDCache.get(runtime, Prop::Buffer)); 118 | if (buffer.isObject() && buffer.asObject(runtime).isArrayBuffer(runtime)) { 119 | return buffer.asObject(runtime).getArrayBuffer(runtime); 120 | } else { 121 | throw std::runtime_error("no ArrayBuffer attached"); 122 | } 123 | } 124 | 125 | bool isTypedArray(jsi::Runtime &runtime, const jsi::Object &jsObj) { 126 | auto jsVal = runtime.global() 127 | .getProperty(runtime, propNameIDCache.get(runtime, Prop::ArrayBuffer)) 128 | .asObject(runtime) 129 | .getProperty(runtime, propNameIDCache.get(runtime, Prop::IsView)) 130 | .asObject(runtime) 131 | .asFunction(runtime) 132 | .callWithThis(runtime, runtime.global(), {jsi::Value(runtime, jsObj)}); 133 | if (jsVal.isBool()) { 134 | return jsVal.getBool(); 135 | } else { 136 | throw std::runtime_error("value is not a boolean"); 137 | } 138 | } 139 | 140 | TypedArrayBase getTypedArray(jsi::Runtime &runtime, const jsi::Object &jsObj) { 141 | auto jsVal = runtime.global() 142 | .getProperty(runtime, propNameIDCache.get(runtime, Prop::ArrayBuffer)) 143 | .asObject(runtime) 144 | .getProperty(runtime, propNameIDCache.get(runtime, Prop::IsView)) 145 | .asObject(runtime) 146 | .asFunction(runtime) 147 | .callWithThis(runtime, runtime.global(), {jsi::Value(runtime, jsObj)}); 148 | if (jsVal.isBool()) { 149 | return TypedArrayBase(runtime, jsObj); 150 | } else { 151 | throw std::runtime_error("value is not a boolean"); 152 | } 153 | } 154 | 155 | std::vector arrayBufferToVector(jsi::Runtime &runtime, jsi::Object &jsObj) { 156 | if (!jsObj.isArrayBuffer(runtime)) { 157 | throw std::runtime_error("Object is not an ArrayBuffer"); 158 | } 159 | auto jsArrayBuffer = jsObj.getArrayBuffer(runtime); 160 | 161 | uint8_t *dataBlock = jsArrayBuffer.data(runtime); 162 | size_t blockSize = 163 | jsArrayBuffer.getProperty(runtime, propNameIDCache.get(runtime, Prop::ByteLength)).asNumber(); 164 | return std::vector(dataBlock, dataBlock + blockSize); 165 | } 166 | 167 | void arrayBufferUpdate( 168 | jsi::Runtime &runtime, 169 | jsi::ArrayBuffer &buffer, 170 | std::vector data, 171 | size_t offset) { 172 | uint8_t *dataBlock = buffer.data(runtime); 173 | size_t blockSize = buffer.size(runtime); 174 | if (data.size() > blockSize) { 175 | throw jsi::JSError(runtime, "ArrayBuffer is to small to fit data"); 176 | } 177 | std::copy(data.begin(), data.end(), dataBlock + offset); 178 | } 179 | 180 | template 181 | TypedArray::TypedArray(jsi::Runtime &runtime, size_t size) : TypedArrayBase(runtime, size, T){}; 182 | 183 | template 184 | TypedArray::TypedArray(jsi::Runtime &runtime, std::vector> data) 185 | : TypedArrayBase(runtime, data.size(), T) { 186 | update(runtime, data); 187 | }; 188 | 189 | template 190 | TypedArray::TypedArray(TypedArrayBase &&base) : TypedArrayBase(std::move(base)) {} 191 | 192 | template 193 | std::vector> TypedArray::toVector(jsi::Runtime &runtime) { 194 | auto start = 195 | reinterpret_cast *>(getBuffer(runtime).data(runtime) + byteOffset(runtime)); 196 | auto end = start + size(runtime); 197 | return std::vector>(start, end); 198 | } 199 | 200 | template 201 | void TypedArray::update(jsi::Runtime &runtime, const std::vector> &data) { 202 | if (data.size() != size(runtime)) { 203 | throw jsi::JSError(runtime, "TypedArray can only be updated with a vector of the same size"); 204 | } 205 | uint8_t *rawData = getBuffer(runtime).data(runtime) + byteOffset(runtime); 206 | std::copy(data.begin(), data.end(), reinterpret_cast *>(rawData)); 207 | } 208 | 209 | const jsi::PropNameID &PropNameIDCache::getConstructorNameProp( 210 | jsi::Runtime &runtime, 211 | TypedArrayKind kind) { 212 | switch (kind) { 213 | case TypedArrayKind::Int8Array: 214 | return get(runtime, Prop::Int8Array); 215 | case TypedArrayKind::Int16Array: 216 | return get(runtime, Prop::Int16Array); 217 | case TypedArrayKind::Int32Array: 218 | return get(runtime, Prop::Int32Array); 219 | case TypedArrayKind::Uint8Array: 220 | return get(runtime, Prop::Uint8Array); 221 | case TypedArrayKind::Uint8ClampedArray: 222 | return get(runtime, Prop::Uint8ClampedArray); 223 | case TypedArrayKind::Uint16Array: 224 | return get(runtime, Prop::Uint16Array); 225 | case TypedArrayKind::Uint32Array: 226 | return get(runtime, Prop::Uint32Array); 227 | case TypedArrayKind::Float32Array: 228 | return get(runtime, Prop::Float32Array); 229 | case TypedArrayKind::Float64Array: 230 | return get(runtime, Prop::Float64Array); 231 | } 232 | } 233 | 234 | jsi::PropNameID PropNameIDCache::createProp(jsi::Runtime &runtime, Prop prop) { 235 | auto create = [&](const std::string &propName) { 236 | return jsi::PropNameID::forUtf8(runtime, propName); 237 | }; 238 | switch (prop) { 239 | case Prop::Buffer: 240 | return create("buffer"); 241 | case Prop::Constructor: 242 | return create("constructor"); 243 | case Prop::Name: 244 | return create("name"); 245 | case Prop::Proto: 246 | return create("__proto__"); 247 | case Prop::Length: 248 | return create("length"); 249 | case Prop::ByteLength: 250 | return create("byteLength"); 251 | case Prop::ByteOffset: 252 | return create("byteOffset"); 253 | case Prop::IsView: 254 | return create("isView"); 255 | case Prop::ArrayBuffer: 256 | return create("ArrayBuffer"); 257 | case Prop::Int8Array: 258 | return create("Int8Array"); 259 | case Prop::Int16Array: 260 | return create("Int16Array"); 261 | case Prop::Int32Array: 262 | return create("Int32Array"); 263 | case Prop::Uint8Array: 264 | return create("Uint8Array"); 265 | case Prop::Uint8ClampedArray: 266 | return create("Uint8ClampedArray"); 267 | case Prop::Uint16Array: 268 | return create("Uint16Array"); 269 | case Prop::Uint32Array: 270 | return create("Uint32Array"); 271 | case Prop::Float32Array: 272 | return create("Float32Array"); 273 | case Prop::Float64Array: 274 | return create("Float64Array"); 275 | } 276 | } 277 | 278 | std::unordered_map nameToKindMap = { 279 | {"Int8Array", TypedArrayKind::Int8Array}, 280 | {"Int16Array", TypedArrayKind::Int16Array}, 281 | {"Int32Array", TypedArrayKind::Int32Array}, 282 | {"Uint8Array", TypedArrayKind::Uint8Array}, 283 | {"Uint8ClampedArray", TypedArrayKind::Uint8ClampedArray}, 284 | {"Uint16Array", TypedArrayKind::Uint16Array}, 285 | {"Uint32Array", TypedArrayKind::Uint32Array}, 286 | {"Float32Array", TypedArrayKind::Float32Array}, 287 | {"Float64Array", TypedArrayKind::Float64Array}, 288 | }; 289 | 290 | TypedArrayKind getTypedArrayKindForName(const std::string &name) { 291 | return nameToKindMap.at(name); 292 | } 293 | 294 | template class TypedArray; 295 | template class TypedArray; 296 | template class TypedArray; 297 | template class TypedArray; 298 | template class TypedArray; 299 | template class TypedArray; 300 | template class TypedArray; 301 | template class TypedArray; 302 | template class TypedArray; 303 | -------------------------------------------------------------------------------- /example/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - boost (1.76.0) 3 | - DoubleConversion (1.1.6) 4 | - FBLazyVector (0.66.4) 5 | - FBReactNativeSpec (0.66.4): 6 | - RCT-Folly (= 2021.06.28.00-v2) 7 | - RCTRequired (= 0.66.4) 8 | - RCTTypeSafety (= 0.66.4) 9 | - React-Core (= 0.66.4) 10 | - React-jsi (= 0.66.4) 11 | - ReactCommon/turbomodule/core (= 0.66.4) 12 | - fmt (6.2.1) 13 | - glog (0.3.5) 14 | - RCT-Folly (2021.06.28.00-v2): 15 | - boost 16 | - DoubleConversion 17 | - fmt (~> 6.2.1) 18 | - glog 19 | - RCT-Folly/Default (= 2021.06.28.00-v2) 20 | - RCT-Folly/Default (2021.06.28.00-v2): 21 | - boost 22 | - DoubleConversion 23 | - fmt (~> 6.2.1) 24 | - glog 25 | - RCTRequired (0.66.4) 26 | - RCTTypeSafety (0.66.4): 27 | - FBLazyVector (= 0.66.4) 28 | - RCT-Folly (= 2021.06.28.00-v2) 29 | - RCTRequired (= 0.66.4) 30 | - React-Core (= 0.66.4) 31 | - React (0.66.4): 32 | - React-Core (= 0.66.4) 33 | - React-Core/DevSupport (= 0.66.4) 34 | - React-Core/RCTWebSocket (= 0.66.4) 35 | - React-RCTActionSheet (= 0.66.4) 36 | - React-RCTAnimation (= 0.66.4) 37 | - React-RCTBlob (= 0.66.4) 38 | - React-RCTImage (= 0.66.4) 39 | - React-RCTLinking (= 0.66.4) 40 | - React-RCTNetwork (= 0.66.4) 41 | - React-RCTSettings (= 0.66.4) 42 | - React-RCTText (= 0.66.4) 43 | - React-RCTVibration (= 0.66.4) 44 | - React-callinvoker (0.66.4) 45 | - React-Core (0.66.4): 46 | - glog 47 | - RCT-Folly (= 2021.06.28.00-v2) 48 | - React-Core/Default (= 0.66.4) 49 | - React-cxxreact (= 0.66.4) 50 | - React-jsi (= 0.66.4) 51 | - React-jsiexecutor (= 0.66.4) 52 | - React-perflogger (= 0.66.4) 53 | - Yoga 54 | - React-Core/CoreModulesHeaders (0.66.4): 55 | - glog 56 | - RCT-Folly (= 2021.06.28.00-v2) 57 | - React-Core/Default 58 | - React-cxxreact (= 0.66.4) 59 | - React-jsi (= 0.66.4) 60 | - React-jsiexecutor (= 0.66.4) 61 | - React-perflogger (= 0.66.4) 62 | - Yoga 63 | - React-Core/Default (0.66.4): 64 | - glog 65 | - RCT-Folly (= 2021.06.28.00-v2) 66 | - React-cxxreact (= 0.66.4) 67 | - React-jsi (= 0.66.4) 68 | - React-jsiexecutor (= 0.66.4) 69 | - React-perflogger (= 0.66.4) 70 | - Yoga 71 | - React-Core/DevSupport (0.66.4): 72 | - glog 73 | - RCT-Folly (= 2021.06.28.00-v2) 74 | - React-Core/Default (= 0.66.4) 75 | - React-Core/RCTWebSocket (= 0.66.4) 76 | - React-cxxreact (= 0.66.4) 77 | - React-jsi (= 0.66.4) 78 | - React-jsiexecutor (= 0.66.4) 79 | - React-jsinspector (= 0.66.4) 80 | - React-perflogger (= 0.66.4) 81 | - Yoga 82 | - React-Core/RCTActionSheetHeaders (0.66.4): 83 | - glog 84 | - RCT-Folly (= 2021.06.28.00-v2) 85 | - React-Core/Default 86 | - React-cxxreact (= 0.66.4) 87 | - React-jsi (= 0.66.4) 88 | - React-jsiexecutor (= 0.66.4) 89 | - React-perflogger (= 0.66.4) 90 | - Yoga 91 | - React-Core/RCTAnimationHeaders (0.66.4): 92 | - glog 93 | - RCT-Folly (= 2021.06.28.00-v2) 94 | - React-Core/Default 95 | - React-cxxreact (= 0.66.4) 96 | - React-jsi (= 0.66.4) 97 | - React-jsiexecutor (= 0.66.4) 98 | - React-perflogger (= 0.66.4) 99 | - Yoga 100 | - React-Core/RCTBlobHeaders (0.66.4): 101 | - glog 102 | - RCT-Folly (= 2021.06.28.00-v2) 103 | - React-Core/Default 104 | - React-cxxreact (= 0.66.4) 105 | - React-jsi (= 0.66.4) 106 | - React-jsiexecutor (= 0.66.4) 107 | - React-perflogger (= 0.66.4) 108 | - Yoga 109 | - React-Core/RCTImageHeaders (0.66.4): 110 | - glog 111 | - RCT-Folly (= 2021.06.28.00-v2) 112 | - React-Core/Default 113 | - React-cxxreact (= 0.66.4) 114 | - React-jsi (= 0.66.4) 115 | - React-jsiexecutor (= 0.66.4) 116 | - React-perflogger (= 0.66.4) 117 | - Yoga 118 | - React-Core/RCTLinkingHeaders (0.66.4): 119 | - glog 120 | - RCT-Folly (= 2021.06.28.00-v2) 121 | - React-Core/Default 122 | - React-cxxreact (= 0.66.4) 123 | - React-jsi (= 0.66.4) 124 | - React-jsiexecutor (= 0.66.4) 125 | - React-perflogger (= 0.66.4) 126 | - Yoga 127 | - React-Core/RCTNetworkHeaders (0.66.4): 128 | - glog 129 | - RCT-Folly (= 2021.06.28.00-v2) 130 | - React-Core/Default 131 | - React-cxxreact (= 0.66.4) 132 | - React-jsi (= 0.66.4) 133 | - React-jsiexecutor (= 0.66.4) 134 | - React-perflogger (= 0.66.4) 135 | - Yoga 136 | - React-Core/RCTSettingsHeaders (0.66.4): 137 | - glog 138 | - RCT-Folly (= 2021.06.28.00-v2) 139 | - React-Core/Default 140 | - React-cxxreact (= 0.66.4) 141 | - React-jsi (= 0.66.4) 142 | - React-jsiexecutor (= 0.66.4) 143 | - React-perflogger (= 0.66.4) 144 | - Yoga 145 | - React-Core/RCTTextHeaders (0.66.4): 146 | - glog 147 | - RCT-Folly (= 2021.06.28.00-v2) 148 | - React-Core/Default 149 | - React-cxxreact (= 0.66.4) 150 | - React-jsi (= 0.66.4) 151 | - React-jsiexecutor (= 0.66.4) 152 | - React-perflogger (= 0.66.4) 153 | - Yoga 154 | - React-Core/RCTVibrationHeaders (0.66.4): 155 | - glog 156 | - RCT-Folly (= 2021.06.28.00-v2) 157 | - React-Core/Default 158 | - React-cxxreact (= 0.66.4) 159 | - React-jsi (= 0.66.4) 160 | - React-jsiexecutor (= 0.66.4) 161 | - React-perflogger (= 0.66.4) 162 | - Yoga 163 | - React-Core/RCTWebSocket (0.66.4): 164 | - glog 165 | - RCT-Folly (= 2021.06.28.00-v2) 166 | - React-Core/Default (= 0.66.4) 167 | - React-cxxreact (= 0.66.4) 168 | - React-jsi (= 0.66.4) 169 | - React-jsiexecutor (= 0.66.4) 170 | - React-perflogger (= 0.66.4) 171 | - Yoga 172 | - React-CoreModules (0.66.4): 173 | - FBReactNativeSpec (= 0.66.4) 174 | - RCT-Folly (= 2021.06.28.00-v2) 175 | - RCTTypeSafety (= 0.66.4) 176 | - React-Core/CoreModulesHeaders (= 0.66.4) 177 | - React-jsi (= 0.66.4) 178 | - React-RCTImage (= 0.66.4) 179 | - ReactCommon/turbomodule/core (= 0.66.4) 180 | - React-cxxreact (0.66.4): 181 | - boost (= 1.76.0) 182 | - DoubleConversion 183 | - glog 184 | - RCT-Folly (= 2021.06.28.00-v2) 185 | - React-callinvoker (= 0.66.4) 186 | - React-jsi (= 0.66.4) 187 | - React-jsinspector (= 0.66.4) 188 | - React-logger (= 0.66.4) 189 | - React-perflogger (= 0.66.4) 190 | - React-runtimeexecutor (= 0.66.4) 191 | - React-jsi (0.66.4): 192 | - boost (= 1.76.0) 193 | - DoubleConversion 194 | - glog 195 | - RCT-Folly (= 2021.06.28.00-v2) 196 | - React-jsi/Default (= 0.66.4) 197 | - React-jsi/Default (0.66.4): 198 | - boost (= 1.76.0) 199 | - DoubleConversion 200 | - glog 201 | - RCT-Folly (= 2021.06.28.00-v2) 202 | - React-jsiexecutor (0.66.4): 203 | - DoubleConversion 204 | - glog 205 | - RCT-Folly (= 2021.06.28.00-v2) 206 | - React-cxxreact (= 0.66.4) 207 | - React-jsi (= 0.66.4) 208 | - React-perflogger (= 0.66.4) 209 | - React-jsinspector (0.66.4) 210 | - React-logger (0.66.4): 211 | - glog 212 | - react-native-jsi-image (0.1.0): 213 | - React 214 | - React-callinvoker 215 | - React-Core 216 | - React-perflogger (0.66.4) 217 | - React-RCTActionSheet (0.66.4): 218 | - React-Core/RCTActionSheetHeaders (= 0.66.4) 219 | - React-RCTAnimation (0.66.4): 220 | - FBReactNativeSpec (= 0.66.4) 221 | - RCT-Folly (= 2021.06.28.00-v2) 222 | - RCTTypeSafety (= 0.66.4) 223 | - React-Core/RCTAnimationHeaders (= 0.66.4) 224 | - React-jsi (= 0.66.4) 225 | - ReactCommon/turbomodule/core (= 0.66.4) 226 | - React-RCTBlob (0.66.4): 227 | - FBReactNativeSpec (= 0.66.4) 228 | - RCT-Folly (= 2021.06.28.00-v2) 229 | - React-Core/RCTBlobHeaders (= 0.66.4) 230 | - React-Core/RCTWebSocket (= 0.66.4) 231 | - React-jsi (= 0.66.4) 232 | - React-RCTNetwork (= 0.66.4) 233 | - ReactCommon/turbomodule/core (= 0.66.4) 234 | - React-RCTImage (0.66.4): 235 | - FBReactNativeSpec (= 0.66.4) 236 | - RCT-Folly (= 2021.06.28.00-v2) 237 | - RCTTypeSafety (= 0.66.4) 238 | - React-Core/RCTImageHeaders (= 0.66.4) 239 | - React-jsi (= 0.66.4) 240 | - React-RCTNetwork (= 0.66.4) 241 | - ReactCommon/turbomodule/core (= 0.66.4) 242 | - React-RCTLinking (0.66.4): 243 | - FBReactNativeSpec (= 0.66.4) 244 | - React-Core/RCTLinkingHeaders (= 0.66.4) 245 | - React-jsi (= 0.66.4) 246 | - ReactCommon/turbomodule/core (= 0.66.4) 247 | - React-RCTNetwork (0.66.4): 248 | - FBReactNativeSpec (= 0.66.4) 249 | - RCT-Folly (= 2021.06.28.00-v2) 250 | - RCTTypeSafety (= 0.66.4) 251 | - React-Core/RCTNetworkHeaders (= 0.66.4) 252 | - React-jsi (= 0.66.4) 253 | - ReactCommon/turbomodule/core (= 0.66.4) 254 | - React-RCTSettings (0.66.4): 255 | - FBReactNativeSpec (= 0.66.4) 256 | - RCT-Folly (= 2021.06.28.00-v2) 257 | - RCTTypeSafety (= 0.66.4) 258 | - React-Core/RCTSettingsHeaders (= 0.66.4) 259 | - React-jsi (= 0.66.4) 260 | - ReactCommon/turbomodule/core (= 0.66.4) 261 | - React-RCTText (0.66.4): 262 | - React-Core/RCTTextHeaders (= 0.66.4) 263 | - React-RCTVibration (0.66.4): 264 | - FBReactNativeSpec (= 0.66.4) 265 | - RCT-Folly (= 2021.06.28.00-v2) 266 | - React-Core/RCTVibrationHeaders (= 0.66.4) 267 | - React-jsi (= 0.66.4) 268 | - ReactCommon/turbomodule/core (= 0.66.4) 269 | - React-runtimeexecutor (0.66.4): 270 | - React-jsi (= 0.66.4) 271 | - ReactCommon/turbomodule/core (0.66.4): 272 | - DoubleConversion 273 | - glog 274 | - RCT-Folly (= 2021.06.28.00-v2) 275 | - React-callinvoker (= 0.66.4) 276 | - React-Core (= 0.66.4) 277 | - React-cxxreact (= 0.66.4) 278 | - React-jsi (= 0.66.4) 279 | - React-logger (= 0.66.4) 280 | - React-perflogger (= 0.66.4) 281 | - Yoga (1.14.0) 282 | 283 | DEPENDENCIES: 284 | - boost (from `../node_modules/react-native/third-party-podspecs/boost.podspec`) 285 | - DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`) 286 | - FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`) 287 | - FBReactNativeSpec (from `../node_modules/react-native/React/FBReactNativeSpec`) 288 | - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`) 289 | - RCT-Folly (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`) 290 | - RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`) 291 | - RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety`) 292 | - React (from `../node_modules/react-native/`) 293 | - React-callinvoker (from `../node_modules/react-native/ReactCommon/callinvoker`) 294 | - React-Core (from `../node_modules/react-native/`) 295 | - React-Core/DevSupport (from `../node_modules/react-native/`) 296 | - React-Core/RCTWebSocket (from `../node_modules/react-native/`) 297 | - React-CoreModules (from `../node_modules/react-native/React/CoreModules`) 298 | - React-cxxreact (from `../node_modules/react-native/ReactCommon/cxxreact`) 299 | - React-jsi (from `../node_modules/react-native/ReactCommon/jsi`) 300 | - React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`) 301 | - React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`) 302 | - React-logger (from `../node_modules/react-native/ReactCommon/logger`) 303 | - react-native-jsi-image (from `../..`) 304 | - React-perflogger (from `../node_modules/react-native/ReactCommon/reactperflogger`) 305 | - React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`) 306 | - React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`) 307 | - React-RCTBlob (from `../node_modules/react-native/Libraries/Blob`) 308 | - React-RCTImage (from `../node_modules/react-native/Libraries/Image`) 309 | - React-RCTLinking (from `../node_modules/react-native/Libraries/LinkingIOS`) 310 | - React-RCTNetwork (from `../node_modules/react-native/Libraries/Network`) 311 | - React-RCTSettings (from `../node_modules/react-native/Libraries/Settings`) 312 | - React-RCTText (from `../node_modules/react-native/Libraries/Text`) 313 | - React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`) 314 | - React-runtimeexecutor (from `../node_modules/react-native/ReactCommon/runtimeexecutor`) 315 | - ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`) 316 | - Yoga (from `../node_modules/react-native/ReactCommon/yoga`) 317 | 318 | SPEC REPOS: 319 | trunk: 320 | - fmt 321 | 322 | EXTERNAL SOURCES: 323 | boost: 324 | :podspec: "../node_modules/react-native/third-party-podspecs/boost.podspec" 325 | DoubleConversion: 326 | :podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec" 327 | FBLazyVector: 328 | :path: "../node_modules/react-native/Libraries/FBLazyVector" 329 | FBReactNativeSpec: 330 | :path: "../node_modules/react-native/React/FBReactNativeSpec" 331 | glog: 332 | :podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec" 333 | RCT-Folly: 334 | :podspec: "../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec" 335 | RCTRequired: 336 | :path: "../node_modules/react-native/Libraries/RCTRequired" 337 | RCTTypeSafety: 338 | :path: "../node_modules/react-native/Libraries/TypeSafety" 339 | React: 340 | :path: "../node_modules/react-native/" 341 | React-callinvoker: 342 | :path: "../node_modules/react-native/ReactCommon/callinvoker" 343 | React-Core: 344 | :path: "../node_modules/react-native/" 345 | React-CoreModules: 346 | :path: "../node_modules/react-native/React/CoreModules" 347 | React-cxxreact: 348 | :path: "../node_modules/react-native/ReactCommon/cxxreact" 349 | React-jsi: 350 | :path: "../node_modules/react-native/ReactCommon/jsi" 351 | React-jsiexecutor: 352 | :path: "../node_modules/react-native/ReactCommon/jsiexecutor" 353 | React-jsinspector: 354 | :path: "../node_modules/react-native/ReactCommon/jsinspector" 355 | React-logger: 356 | :path: "../node_modules/react-native/ReactCommon/logger" 357 | react-native-jsi-image: 358 | :path: "../.." 359 | React-perflogger: 360 | :path: "../node_modules/react-native/ReactCommon/reactperflogger" 361 | React-RCTActionSheet: 362 | :path: "../node_modules/react-native/Libraries/ActionSheetIOS" 363 | React-RCTAnimation: 364 | :path: "../node_modules/react-native/Libraries/NativeAnimation" 365 | React-RCTBlob: 366 | :path: "../node_modules/react-native/Libraries/Blob" 367 | React-RCTImage: 368 | :path: "../node_modules/react-native/Libraries/Image" 369 | React-RCTLinking: 370 | :path: "../node_modules/react-native/Libraries/LinkingIOS" 371 | React-RCTNetwork: 372 | :path: "../node_modules/react-native/Libraries/Network" 373 | React-RCTSettings: 374 | :path: "../node_modules/react-native/Libraries/Settings" 375 | React-RCTText: 376 | :path: "../node_modules/react-native/Libraries/Text" 377 | React-RCTVibration: 378 | :path: "../node_modules/react-native/Libraries/Vibration" 379 | React-runtimeexecutor: 380 | :path: "../node_modules/react-native/ReactCommon/runtimeexecutor" 381 | ReactCommon: 382 | :path: "../node_modules/react-native/ReactCommon" 383 | Yoga: 384 | :path: "../node_modules/react-native/ReactCommon/yoga" 385 | 386 | SPEC CHECKSUMS: 387 | boost: a7c83b31436843459a1961bfd74b96033dc77234 388 | DoubleConversion: 831926d9b8bf8166fd87886c4abab286c2422662 389 | FBLazyVector: e5569e42a1c79ca00521846c223173a57aca1fe1 390 | FBReactNativeSpec: fe08c1cd7e2e205718d77ad14b34957cce949b58 391 | fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9 392 | glog: 5337263514dd6f09803962437687240c5dc39aa4 393 | RCT-Folly: a21c126816d8025b547704b777a2ba552f3d9fa9 394 | RCTRequired: 4bf86c70714490bca4bf2696148638284622644b 395 | RCTTypeSafety: c475a7059eb77935fa53d2c17db299893f057d5d 396 | React: f64af14e3f2c50f6f2c91a5fd250e4ff1b3c3459 397 | React-callinvoker: b74e4ae80287780dcdf0cab262bcb581eeef56e7 398 | React-Core: 3eb7432bad96ff1d25aebc1defbae013fee2fd0e 399 | React-CoreModules: ad9e1fd5650e16666c57a08328df86fd7e480cb9 400 | React-cxxreact: 02633ff398cf7e91a2c1e12590d323c4a4b8668a 401 | React-jsi: 805c41a927d6499fb811772acb971467d9204633 402 | React-jsiexecutor: 94ce921e1d8ce7023366873ec371f3441383b396 403 | React-jsinspector: d0374f7509d407d2264168b6d0fad0b54e300b85 404 | React-logger: 933f80c97c633ee8965d609876848148e3fef438 405 | react-native-jsi-image: 5895636421e818523d4ca322f49b593620f37268 406 | React-perflogger: 93075d8931c32cd1fce8a98c15d2d5ccc4d891bd 407 | React-RCTActionSheet: 7d3041e6761b4f3044a37079ddcb156575fb6d89 408 | React-RCTAnimation: 743e88b55ac62511ae5c2e22803d4f503f2a3a13 409 | React-RCTBlob: bee3a2f98fa7fc25c957c8643494244f74bea0a0 410 | React-RCTImage: 19fc9e29b06cc38611c553494f8d3040bf78c24e 411 | React-RCTLinking: dc799503979c8c711126d66328e7ce8f25c2848f 412 | React-RCTNetwork: 417e4e34cf3c19eaa5fd4e9eb20180d662a799ce 413 | React-RCTSettings: 4df89417265af26501a7e0e9192a34d3d9848dff 414 | React-RCTText: f8a21c3499ab322326290fa9b701ae29aa093aa5 415 | React-RCTVibration: e3ffca672dd3772536cb844274094b0e2c31b187 416 | React-runtimeexecutor: dec32ee6f2e2a26e13e58152271535fadff5455a 417 | ReactCommon: 57b69f6383eafcbd7da625bfa6003810332313c4 418 | Yoga: e7dc4e71caba6472ff48ad7d234389b91dadc280 419 | 420 | PODFILE CHECKSUM: bbb8d21bf5a6e594d9d8a22a11278a7efea0b374 421 | 422 | COCOAPODS: 1.11.2 423 | -------------------------------------------------------------------------------- /example/ios/JsiImageExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 00E356F31AD99517003FC87E /* JsiImageExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* JsiImageExampleTests.m */; }; 11 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; 12 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 13 | 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 14 | 2D02E4BC1E0B4A80006451C7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; 15 | 2D02E4BD1E0B4A84006451C7 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 16 | 2D02E4BF1E0B4AB3006451C7 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 17 | 2DCD954D1E0B4F2C00145EB5 /* JsiImageExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* JsiImageExampleTests.m */; }; 18 | 4C39C56BAD484C67AA576FFA /* libPods-JsiImageExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CA3E69C5B9553B26FBA2DF04 /* libPods-JsiImageExample.a */; }; 19 | 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXContainerItemProxy section */ 23 | 00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = { 24 | isa = PBXContainerItemProxy; 25 | containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; 26 | proxyType = 1; 27 | remoteGlobalIDString = 13B07F861A680F5B00A75B9A; 28 | remoteInfo = JsiImageExample; 29 | }; 30 | 2D02E4911E0B4A5D006451C7 /* PBXContainerItemProxy */ = { 31 | isa = PBXContainerItemProxy; 32 | containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; 33 | proxyType = 1; 34 | remoteGlobalIDString = 2D02E47A1E0B4A5D006451C7; 35 | remoteInfo = "JsiImageExample-tvOS"; 36 | }; 37 | /* End PBXContainerItemProxy section */ 38 | 39 | /* Begin PBXFileReference section */ 40 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = ""; }; 41 | 00E356EE1AD99517003FC87E /* JsiImageExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = JsiImageExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 42 | 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 43 | 00E356F21AD99517003FC87E /* JsiImageExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JsiImageExampleTests.m; sourceTree = ""; }; 44 | 13B07F961A680F5B00A75B9A /* JsiImageExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JsiImageExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 45 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = JsiImageExample/AppDelegate.h; sourceTree = ""; }; 46 | 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = JsiImageExample/AppDelegate.m; sourceTree = ""; }; 47 | 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = JsiImageExample/Images.xcassets; sourceTree = ""; }; 48 | 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = JsiImageExample/Info.plist; sourceTree = ""; }; 49 | 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = JsiImageExample/main.m; sourceTree = ""; }; 50 | 2D02E47B1E0B4A5D006451C7 /* JsiImageExample-tvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "JsiImageExample-tvOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | 2D02E4901E0B4A5D006451C7 /* JsiImageExample-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "JsiImageExample-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | 47F7ED3B7971BE374F7B8635 /* Pods-JsiImageExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JsiImageExample.debug.xcconfig"; path = "Target Support Files/Pods-JsiImageExample/Pods-JsiImageExample.debug.xcconfig"; sourceTree = ""; }; 53 | 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = JsiImageExample/LaunchScreen.storyboard; sourceTree = ""; }; 54 | CA3E69C5B9553B26FBA2DF04 /* libPods-JsiImageExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-JsiImageExample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 55 | E00ACF0FDA8BF921659E2F9A /* Pods-JsiImageExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JsiImageExample.release.xcconfig"; path = "Target Support Files/Pods-JsiImageExample/Pods-JsiImageExample.release.xcconfig"; sourceTree = ""; }; 56 | ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; 57 | ED2971642150620600B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS12.0.sdk/System/Library/Frameworks/JavaScriptCore.framework; sourceTree = DEVELOPER_DIR; }; 58 | /* End PBXFileReference section */ 59 | 60 | /* Begin PBXFrameworksBuildPhase section */ 61 | 00E356EB1AD99517003FC87E /* Frameworks */ = { 62 | isa = PBXFrameworksBuildPhase; 63 | buildActionMask = 2147483647; 64 | files = ( 65 | ); 66 | runOnlyForDeploymentPostprocessing = 0; 67 | }; 68 | 13B07F8C1A680F5B00A75B9A /* Frameworks */ = { 69 | isa = PBXFrameworksBuildPhase; 70 | buildActionMask = 2147483647; 71 | files = ( 72 | 4C39C56BAD484C67AA576FFA /* libPods-JsiImageExample.a in Frameworks */, 73 | ); 74 | runOnlyForDeploymentPostprocessing = 0; 75 | }; 76 | 2D02E4781E0B4A5D006451C7 /* Frameworks */ = { 77 | isa = PBXFrameworksBuildPhase; 78 | buildActionMask = 2147483647; 79 | files = ( 80 | ); 81 | runOnlyForDeploymentPostprocessing = 0; 82 | }; 83 | 2D02E48D1E0B4A5D006451C7 /* Frameworks */ = { 84 | isa = PBXFrameworksBuildPhase; 85 | buildActionMask = 2147483647; 86 | files = ( 87 | ); 88 | runOnlyForDeploymentPostprocessing = 0; 89 | }; 90 | /* End PBXFrameworksBuildPhase section */ 91 | 92 | /* Begin PBXGroup section */ 93 | 00E356EF1AD99517003FC87E /* JsiImageExampleTests */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | 00E356F21AD99517003FC87E /* JsiImageExampleTests.m */, 97 | 00E356F01AD99517003FC87E /* Supporting Files */, 98 | ); 99 | path = JsiImageExampleTests; 100 | sourceTree = ""; 101 | }; 102 | 00E356F01AD99517003FC87E /* Supporting Files */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | 00E356F11AD99517003FC87E /* Info.plist */, 106 | ); 107 | name = "Supporting Files"; 108 | sourceTree = ""; 109 | }; 110 | 13B07FAE1A68108700A75B9A /* JsiImageExample */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */, 114 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */, 115 | 13B07FB01A68108700A75B9A /* AppDelegate.m */, 116 | 13B07FB51A68108700A75B9A /* Images.xcassets */, 117 | 13B07FB61A68108700A75B9A /* Info.plist */, 118 | 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */, 119 | 13B07FB71A68108700A75B9A /* main.m */, 120 | ); 121 | name = JsiImageExample; 122 | sourceTree = ""; 123 | }; 124 | 2D16E6871FA4F8E400B85C8A /* Frameworks */ = { 125 | isa = PBXGroup; 126 | children = ( 127 | ED297162215061F000B7C4FE /* JavaScriptCore.framework */, 128 | ED2971642150620600B7C4FE /* JavaScriptCore.framework */, 129 | CA3E69C5B9553B26FBA2DF04 /* libPods-JsiImageExample.a */, 130 | ); 131 | name = Frameworks; 132 | sourceTree = ""; 133 | }; 134 | 6B9684456A2045ADE5A6E47E /* Pods */ = { 135 | isa = PBXGroup; 136 | children = ( 137 | 47F7ED3B7971BE374F7B8635 /* Pods-JsiImageExample.debug.xcconfig */, 138 | E00ACF0FDA8BF921659E2F9A /* Pods-JsiImageExample.release.xcconfig */, 139 | ); 140 | path = Pods; 141 | sourceTree = ""; 142 | }; 143 | 832341AE1AAA6A7D00B99B32 /* Libraries */ = { 144 | isa = PBXGroup; 145 | children = ( 146 | ); 147 | name = Libraries; 148 | sourceTree = ""; 149 | }; 150 | 83CBB9F61A601CBA00E9B192 = { 151 | isa = PBXGroup; 152 | children = ( 153 | 13B07FAE1A68108700A75B9A /* JsiImageExample */, 154 | 832341AE1AAA6A7D00B99B32 /* Libraries */, 155 | 00E356EF1AD99517003FC87E /* JsiImageExampleTests */, 156 | 83CBBA001A601CBA00E9B192 /* Products */, 157 | 2D16E6871FA4F8E400B85C8A /* Frameworks */, 158 | 6B9684456A2045ADE5A6E47E /* Pods */, 159 | ); 160 | indentWidth = 2; 161 | sourceTree = ""; 162 | tabWidth = 2; 163 | usesTabs = 0; 164 | }; 165 | 83CBBA001A601CBA00E9B192 /* Products */ = { 166 | isa = PBXGroup; 167 | children = ( 168 | 13B07F961A680F5B00A75B9A /* JsiImageExample.app */, 169 | 00E356EE1AD99517003FC87E /* JsiImageExampleTests.xctest */, 170 | 2D02E47B1E0B4A5D006451C7 /* JsiImageExample-tvOS.app */, 171 | 2D02E4901E0B4A5D006451C7 /* JsiImageExample-tvOSTests.xctest */, 172 | ); 173 | name = Products; 174 | sourceTree = ""; 175 | }; 176 | /* End PBXGroup section */ 177 | 178 | /* Begin PBXNativeTarget section */ 179 | 00E356ED1AD99517003FC87E /* JsiImageExampleTests */ = { 180 | isa = PBXNativeTarget; 181 | buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "JsiImageExampleTests" */; 182 | buildPhases = ( 183 | 00E356EA1AD99517003FC87E /* Sources */, 184 | 00E356EB1AD99517003FC87E /* Frameworks */, 185 | 00E356EC1AD99517003FC87E /* Resources */, 186 | ); 187 | buildRules = ( 188 | ); 189 | dependencies = ( 190 | 00E356F51AD99517003FC87E /* PBXTargetDependency */, 191 | ); 192 | name = JsiImageExampleTests; 193 | productName = JsiImageExampleTests; 194 | productReference = 00E356EE1AD99517003FC87E /* JsiImageExampleTests.xctest */; 195 | productType = "com.apple.product-type.bundle.unit-test"; 196 | }; 197 | 13B07F861A680F5B00A75B9A /* JsiImageExample */ = { 198 | isa = PBXNativeTarget; 199 | buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "JsiImageExample" */; 200 | buildPhases = ( 201 | 4F0A6FC082772762E3E4C96C /* [CP] Check Pods Manifest.lock */, 202 | FD10A7F022414F080027D42C /* Start Packager */, 203 | 13B07F871A680F5B00A75B9A /* Sources */, 204 | 13B07F8C1A680F5B00A75B9A /* Frameworks */, 205 | 13B07F8E1A680F5B00A75B9A /* Resources */, 206 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, 207 | C1D60D28B925C94BD88E79D7 /* [CP] Copy Pods Resources */, 208 | ); 209 | buildRules = ( 210 | ); 211 | dependencies = ( 212 | ); 213 | name = JsiImageExample; 214 | productName = JsiImageExample; 215 | productReference = 13B07F961A680F5B00A75B9A /* JsiImageExample.app */; 216 | productType = "com.apple.product-type.application"; 217 | }; 218 | 2D02E47A1E0B4A5D006451C7 /* JsiImageExample-tvOS */ = { 219 | isa = PBXNativeTarget; 220 | buildConfigurationList = 2D02E4BA1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "JsiImageExample-tvOS" */; 221 | buildPhases = ( 222 | FD10A7F122414F3F0027D42C /* Start Packager */, 223 | 2D02E4771E0B4A5D006451C7 /* Sources */, 224 | 2D02E4781E0B4A5D006451C7 /* Frameworks */, 225 | 2D02E4791E0B4A5D006451C7 /* Resources */, 226 | 2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */, 227 | ); 228 | buildRules = ( 229 | ); 230 | dependencies = ( 231 | ); 232 | name = "JsiImageExample-tvOS"; 233 | productName = "JsiImageExample-tvOS"; 234 | productReference = 2D02E47B1E0B4A5D006451C7 /* JsiImageExample-tvOS.app */; 235 | productType = "com.apple.product-type.application"; 236 | }; 237 | 2D02E48F1E0B4A5D006451C7 /* JsiImageExample-tvOSTests */ = { 238 | isa = PBXNativeTarget; 239 | buildConfigurationList = 2D02E4BB1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "JsiImageExample-tvOSTests" */; 240 | buildPhases = ( 241 | 2D02E48C1E0B4A5D006451C7 /* Sources */, 242 | 2D02E48D1E0B4A5D006451C7 /* Frameworks */, 243 | 2D02E48E1E0B4A5D006451C7 /* Resources */, 244 | ); 245 | buildRules = ( 246 | ); 247 | dependencies = ( 248 | 2D02E4921E0B4A5D006451C7 /* PBXTargetDependency */, 249 | ); 250 | name = "JsiImageExample-tvOSTests"; 251 | productName = "JsiImageExample-tvOSTests"; 252 | productReference = 2D02E4901E0B4A5D006451C7 /* JsiImageExample-tvOSTests.xctest */; 253 | productType = "com.apple.product-type.bundle.unit-test"; 254 | }; 255 | /* End PBXNativeTarget section */ 256 | 257 | /* Begin PBXProject section */ 258 | 83CBB9F71A601CBA00E9B192 /* Project object */ = { 259 | isa = PBXProject; 260 | attributes = { 261 | LastUpgradeCheck = 1130; 262 | TargetAttributes = { 263 | 00E356ED1AD99517003FC87E = { 264 | CreatedOnToolsVersion = 6.2; 265 | TestTargetID = 13B07F861A680F5B00A75B9A; 266 | }; 267 | 13B07F861A680F5B00A75B9A = { 268 | DevelopmentTeam = CJW62Q77E7; 269 | LastSwiftMigration = 1120; 270 | }; 271 | 2D02E47A1E0B4A5D006451C7 = { 272 | CreatedOnToolsVersion = 8.2.1; 273 | ProvisioningStyle = Automatic; 274 | }; 275 | 2D02E48F1E0B4A5D006451C7 = { 276 | CreatedOnToolsVersion = 8.2.1; 277 | ProvisioningStyle = Automatic; 278 | TestTargetID = 2D02E47A1E0B4A5D006451C7; 279 | }; 280 | }; 281 | }; 282 | buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "JsiImageExample" */; 283 | compatibilityVersion = "Xcode 3.2"; 284 | developmentRegion = en; 285 | hasScannedForEncodings = 0; 286 | knownRegions = ( 287 | en, 288 | Base, 289 | ); 290 | mainGroup = 83CBB9F61A601CBA00E9B192; 291 | productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; 292 | projectDirPath = ""; 293 | projectRoot = ""; 294 | targets = ( 295 | 13B07F861A680F5B00A75B9A /* JsiImageExample */, 296 | 00E356ED1AD99517003FC87E /* JsiImageExampleTests */, 297 | 2D02E47A1E0B4A5D006451C7 /* JsiImageExample-tvOS */, 298 | 2D02E48F1E0B4A5D006451C7 /* JsiImageExample-tvOSTests */, 299 | ); 300 | }; 301 | /* End PBXProject section */ 302 | 303 | /* Begin PBXResourcesBuildPhase section */ 304 | 00E356EC1AD99517003FC87E /* Resources */ = { 305 | isa = PBXResourcesBuildPhase; 306 | buildActionMask = 2147483647; 307 | files = ( 308 | ); 309 | runOnlyForDeploymentPostprocessing = 0; 310 | }; 311 | 13B07F8E1A680F5B00A75B9A /* Resources */ = { 312 | isa = PBXResourcesBuildPhase; 313 | buildActionMask = 2147483647; 314 | files = ( 315 | 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */, 316 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, 317 | ); 318 | runOnlyForDeploymentPostprocessing = 0; 319 | }; 320 | 2D02E4791E0B4A5D006451C7 /* Resources */ = { 321 | isa = PBXResourcesBuildPhase; 322 | buildActionMask = 2147483647; 323 | files = ( 324 | 2D02E4BD1E0B4A84006451C7 /* Images.xcassets in Resources */, 325 | ); 326 | runOnlyForDeploymentPostprocessing = 0; 327 | }; 328 | 2D02E48E1E0B4A5D006451C7 /* Resources */ = { 329 | isa = PBXResourcesBuildPhase; 330 | buildActionMask = 2147483647; 331 | files = ( 332 | ); 333 | runOnlyForDeploymentPostprocessing = 0; 334 | }; 335 | /* End PBXResourcesBuildPhase section */ 336 | 337 | /* Begin PBXShellScriptBuildPhase section */ 338 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = { 339 | isa = PBXShellScriptBuildPhase; 340 | buildActionMask = 2147483647; 341 | files = ( 342 | ); 343 | inputPaths = ( 344 | ); 345 | name = "Bundle React Native code and images"; 346 | outputPaths = ( 347 | ); 348 | runOnlyForDeploymentPostprocessing = 0; 349 | shellPath = /bin/sh; 350 | shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh"; 351 | }; 352 | 2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */ = { 353 | isa = PBXShellScriptBuildPhase; 354 | buildActionMask = 2147483647; 355 | files = ( 356 | ); 357 | inputPaths = ( 358 | ); 359 | name = "Bundle React Native Code And Images"; 360 | outputPaths = ( 361 | ); 362 | runOnlyForDeploymentPostprocessing = 0; 363 | shellPath = /bin/sh; 364 | shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh"; 365 | }; 366 | 4F0A6FC082772762E3E4C96C /* [CP] Check Pods Manifest.lock */ = { 367 | isa = PBXShellScriptBuildPhase; 368 | buildActionMask = 2147483647; 369 | files = ( 370 | ); 371 | inputFileListPaths = ( 372 | ); 373 | inputPaths = ( 374 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 375 | "${PODS_ROOT}/Manifest.lock", 376 | ); 377 | name = "[CP] Check Pods Manifest.lock"; 378 | outputFileListPaths = ( 379 | ); 380 | outputPaths = ( 381 | "$(DERIVED_FILE_DIR)/Pods-JsiImageExample-checkManifestLockResult.txt", 382 | ); 383 | runOnlyForDeploymentPostprocessing = 0; 384 | shellPath = /bin/sh; 385 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 386 | showEnvVarsInLog = 0; 387 | }; 388 | C1D60D28B925C94BD88E79D7 /* [CP] Copy Pods Resources */ = { 389 | isa = PBXShellScriptBuildPhase; 390 | buildActionMask = 2147483647; 391 | files = ( 392 | ); 393 | inputPaths = ( 394 | "${PODS_ROOT}/Target Support Files/Pods-JsiImageExample/Pods-JsiImageExample-resources.sh", 395 | "${PODS_CONFIGURATION_BUILD_DIR}/React-Core/AccessibilityResources.bundle", 396 | ); 397 | name = "[CP] Copy Pods Resources"; 398 | outputPaths = ( 399 | "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AccessibilityResources.bundle", 400 | ); 401 | runOnlyForDeploymentPostprocessing = 0; 402 | shellPath = /bin/sh; 403 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-JsiImageExample/Pods-JsiImageExample-resources.sh\"\n"; 404 | showEnvVarsInLog = 0; 405 | }; 406 | FD10A7F022414F080027D42C /* Start Packager */ = { 407 | isa = PBXShellScriptBuildPhase; 408 | buildActionMask = 2147483647; 409 | files = ( 410 | ); 411 | inputFileListPaths = ( 412 | ); 413 | inputPaths = ( 414 | ); 415 | name = "Start Packager"; 416 | outputFileListPaths = ( 417 | ); 418 | outputPaths = ( 419 | ); 420 | runOnlyForDeploymentPostprocessing = 0; 421 | shellPath = /bin/sh; 422 | shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../node_modules/react-native/scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open \"$SRCROOT/../node_modules/react-native/scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi\n"; 423 | showEnvVarsInLog = 0; 424 | }; 425 | FD10A7F122414F3F0027D42C /* Start Packager */ = { 426 | isa = PBXShellScriptBuildPhase; 427 | buildActionMask = 2147483647; 428 | files = ( 429 | ); 430 | inputFileListPaths = ( 431 | ); 432 | inputPaths = ( 433 | ); 434 | name = "Start Packager"; 435 | outputFileListPaths = ( 436 | ); 437 | outputPaths = ( 438 | ); 439 | runOnlyForDeploymentPostprocessing = 0; 440 | shellPath = /bin/sh; 441 | shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../node_modules/react-native/scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open \"$SRCROOT/../node_modules/react-native/scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi\n"; 442 | showEnvVarsInLog = 0; 443 | }; 444 | /* End PBXShellScriptBuildPhase section */ 445 | 446 | /* Begin PBXSourcesBuildPhase section */ 447 | 00E356EA1AD99517003FC87E /* Sources */ = { 448 | isa = PBXSourcesBuildPhase; 449 | buildActionMask = 2147483647; 450 | files = ( 451 | 00E356F31AD99517003FC87E /* JsiImageExampleTests.m in Sources */, 452 | ); 453 | runOnlyForDeploymentPostprocessing = 0; 454 | }; 455 | 13B07F871A680F5B00A75B9A /* Sources */ = { 456 | isa = PBXSourcesBuildPhase; 457 | buildActionMask = 2147483647; 458 | files = ( 459 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */, 460 | 13B07FC11A68108700A75B9A /* main.m in Sources */, 461 | ); 462 | runOnlyForDeploymentPostprocessing = 0; 463 | }; 464 | 2D02E4771E0B4A5D006451C7 /* Sources */ = { 465 | isa = PBXSourcesBuildPhase; 466 | buildActionMask = 2147483647; 467 | files = ( 468 | 2D02E4BF1E0B4AB3006451C7 /* main.m in Sources */, 469 | 2D02E4BC1E0B4A80006451C7 /* AppDelegate.m in Sources */, 470 | ); 471 | runOnlyForDeploymentPostprocessing = 0; 472 | }; 473 | 2D02E48C1E0B4A5D006451C7 /* Sources */ = { 474 | isa = PBXSourcesBuildPhase; 475 | buildActionMask = 2147483647; 476 | files = ( 477 | 2DCD954D1E0B4F2C00145EB5 /* JsiImageExampleTests.m in Sources */, 478 | ); 479 | runOnlyForDeploymentPostprocessing = 0; 480 | }; 481 | /* End PBXSourcesBuildPhase section */ 482 | 483 | /* Begin PBXTargetDependency section */ 484 | 00E356F51AD99517003FC87E /* PBXTargetDependency */ = { 485 | isa = PBXTargetDependency; 486 | target = 13B07F861A680F5B00A75B9A /* JsiImageExample */; 487 | targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */; 488 | }; 489 | 2D02E4921E0B4A5D006451C7 /* PBXTargetDependency */ = { 490 | isa = PBXTargetDependency; 491 | target = 2D02E47A1E0B4A5D006451C7 /* JsiImageExample-tvOS */; 492 | targetProxy = 2D02E4911E0B4A5D006451C7 /* PBXContainerItemProxy */; 493 | }; 494 | /* End PBXTargetDependency section */ 495 | 496 | /* Begin XCBuildConfiguration section */ 497 | 00E356F61AD99517003FC87E /* Debug */ = { 498 | isa = XCBuildConfiguration; 499 | buildSettings = { 500 | BUNDLE_LOADER = "$(TEST_HOST)"; 501 | GCC_PREPROCESSOR_DEFINITIONS = ( 502 | "DEBUG=1", 503 | "$(inherited)", 504 | ); 505 | INFOPLIST_FILE = JsiImageExampleTests/Info.plist; 506 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 507 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 508 | OTHER_LDFLAGS = ( 509 | "-ObjC", 510 | "-lc++", 511 | "$(inherited)", 512 | ); 513 | PRODUCT_BUNDLE_IDENTIFIER = com.example.reactnativejsiimage; 514 | PRODUCT_NAME = "$(TARGET_NAME)"; 515 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/JsiImageExample.app/JsiImageExample"; 516 | }; 517 | name = Debug; 518 | }; 519 | 00E356F71AD99517003FC87E /* Release */ = { 520 | isa = XCBuildConfiguration; 521 | buildSettings = { 522 | BUNDLE_LOADER = "$(TEST_HOST)"; 523 | COPY_PHASE_STRIP = NO; 524 | INFOPLIST_FILE = JsiImageExampleTests/Info.plist; 525 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 526 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 527 | OTHER_LDFLAGS = ( 528 | "-ObjC", 529 | "-lc++", 530 | "$(inherited)", 531 | ); 532 | PRODUCT_BUNDLE_IDENTIFIER = com.example.reactnativejsiimage; 533 | PRODUCT_NAME = "$(TARGET_NAME)"; 534 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/JsiImageExample.app/JsiImageExample"; 535 | }; 536 | name = Release; 537 | }; 538 | 13B07F941A680F5B00A75B9A /* Debug */ = { 539 | isa = XCBuildConfiguration; 540 | baseConfigurationReference = 47F7ED3B7971BE374F7B8635 /* Pods-JsiImageExample.debug.xcconfig */; 541 | buildSettings = { 542 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 543 | CLANG_ENABLE_MODULES = YES; 544 | CURRENT_PROJECT_VERSION = 1; 545 | DEVELOPMENT_TEAM = CJW62Q77E7; 546 | ENABLE_BITCODE = NO; 547 | INFOPLIST_FILE = JsiImageExample/Info.plist; 548 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 549 | OTHER_LDFLAGS = ( 550 | "$(inherited)", 551 | "-ObjC", 552 | "-lc++", 553 | ); 554 | PRODUCT_BUNDLE_IDENTIFIER = com.example.reactnativejsiimage; 555 | PRODUCT_NAME = JsiImageExample; 556 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 557 | SWIFT_VERSION = 5.0; 558 | VERSIONING_SYSTEM = "apple-generic"; 559 | }; 560 | name = Debug; 561 | }; 562 | 13B07F951A680F5B00A75B9A /* Release */ = { 563 | isa = XCBuildConfiguration; 564 | baseConfigurationReference = E00ACF0FDA8BF921659E2F9A /* Pods-JsiImageExample.release.xcconfig */; 565 | buildSettings = { 566 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 567 | CLANG_ENABLE_MODULES = YES; 568 | CURRENT_PROJECT_VERSION = 1; 569 | DEVELOPMENT_TEAM = CJW62Q77E7; 570 | INFOPLIST_FILE = JsiImageExample/Info.plist; 571 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 572 | OTHER_LDFLAGS = ( 573 | "$(inherited)", 574 | "-ObjC", 575 | "-lc++", 576 | ); 577 | PRODUCT_BUNDLE_IDENTIFIER = com.example.reactnativejsiimage; 578 | PRODUCT_NAME = JsiImageExample; 579 | SWIFT_VERSION = 5.0; 580 | VERSIONING_SYSTEM = "apple-generic"; 581 | }; 582 | name = Release; 583 | }; 584 | 2D02E4971E0B4A5E006451C7 /* Debug */ = { 585 | isa = XCBuildConfiguration; 586 | buildSettings = { 587 | ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; 588 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 589 | CLANG_ANALYZER_NONNULL = YES; 590 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 591 | CLANG_WARN_INFINITE_RECURSION = YES; 592 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 593 | DEBUG_INFORMATION_FORMAT = dwarf; 594 | ENABLE_TESTABILITY = YES; 595 | GCC_NO_COMMON_BLOCKS = YES; 596 | INFOPLIST_FILE = "JsiImageExample-tvOS/Info.plist"; 597 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 598 | OTHER_LDFLAGS = ( 599 | "$(inherited)", 600 | "-ObjC", 601 | "-lc++", 602 | ); 603 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.JsiImageExample-tvOS"; 604 | PRODUCT_NAME = "$(TARGET_NAME)"; 605 | SDKROOT = appletvos; 606 | TARGETED_DEVICE_FAMILY = 3; 607 | TVOS_DEPLOYMENT_TARGET = 10.0; 608 | }; 609 | name = Debug; 610 | }; 611 | 2D02E4981E0B4A5E006451C7 /* Release */ = { 612 | isa = XCBuildConfiguration; 613 | buildSettings = { 614 | ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; 615 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 616 | CLANG_ANALYZER_NONNULL = YES; 617 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 618 | CLANG_WARN_INFINITE_RECURSION = YES; 619 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 620 | COPY_PHASE_STRIP = NO; 621 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 622 | GCC_NO_COMMON_BLOCKS = YES; 623 | INFOPLIST_FILE = "JsiImageExample-tvOS/Info.plist"; 624 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 625 | OTHER_LDFLAGS = ( 626 | "$(inherited)", 627 | "-ObjC", 628 | "-lc++", 629 | ); 630 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.JsiImageExample-tvOS"; 631 | PRODUCT_NAME = "$(TARGET_NAME)"; 632 | SDKROOT = appletvos; 633 | TARGETED_DEVICE_FAMILY = 3; 634 | TVOS_DEPLOYMENT_TARGET = 10.0; 635 | }; 636 | name = Release; 637 | }; 638 | 2D02E4991E0B4A5E006451C7 /* Debug */ = { 639 | isa = XCBuildConfiguration; 640 | buildSettings = { 641 | BUNDLE_LOADER = "$(TEST_HOST)"; 642 | CLANG_ANALYZER_NONNULL = YES; 643 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 644 | CLANG_WARN_INFINITE_RECURSION = YES; 645 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 646 | DEBUG_INFORMATION_FORMAT = dwarf; 647 | ENABLE_TESTABILITY = YES; 648 | GCC_NO_COMMON_BLOCKS = YES; 649 | INFOPLIST_FILE = "JsiImageExample-tvOSTests/Info.plist"; 650 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 651 | OTHER_LDFLAGS = ( 652 | "$(inherited)", 653 | "-ObjC", 654 | "-lc++", 655 | ); 656 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.JsiImageExample-tvOSTests"; 657 | PRODUCT_NAME = "$(TARGET_NAME)"; 658 | SDKROOT = appletvos; 659 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/JsiImageExample-tvOS.app/JsiImageExample-tvOS"; 660 | TVOS_DEPLOYMENT_TARGET = 10.1; 661 | }; 662 | name = Debug; 663 | }; 664 | 2D02E49A1E0B4A5E006451C7 /* Release */ = { 665 | isa = XCBuildConfiguration; 666 | buildSettings = { 667 | BUNDLE_LOADER = "$(TEST_HOST)"; 668 | CLANG_ANALYZER_NONNULL = YES; 669 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 670 | CLANG_WARN_INFINITE_RECURSION = YES; 671 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 672 | COPY_PHASE_STRIP = NO; 673 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 674 | GCC_NO_COMMON_BLOCKS = YES; 675 | INFOPLIST_FILE = "JsiImageExample-tvOSTests/Info.plist"; 676 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 677 | OTHER_LDFLAGS = ( 678 | "$(inherited)", 679 | "-ObjC", 680 | "-lc++", 681 | ); 682 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.JsiImageExample-tvOSTests"; 683 | PRODUCT_NAME = "$(TARGET_NAME)"; 684 | SDKROOT = appletvos; 685 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/JsiImageExample-tvOS.app/JsiImageExample-tvOS"; 686 | TVOS_DEPLOYMENT_TARGET = 10.1; 687 | }; 688 | name = Release; 689 | }; 690 | 83CBBA201A601CBA00E9B192 /* Debug */ = { 691 | isa = XCBuildConfiguration; 692 | buildSettings = { 693 | ALWAYS_SEARCH_USER_PATHS = NO; 694 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 695 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 696 | CLANG_CXX_LIBRARY = "libc++"; 697 | CLANG_ENABLE_MODULES = YES; 698 | CLANG_ENABLE_OBJC_ARC = YES; 699 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 700 | CLANG_WARN_BOOL_CONVERSION = YES; 701 | CLANG_WARN_COMMA = YES; 702 | CLANG_WARN_CONSTANT_CONVERSION = YES; 703 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 704 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 705 | CLANG_WARN_EMPTY_BODY = YES; 706 | CLANG_WARN_ENUM_CONVERSION = YES; 707 | CLANG_WARN_INFINITE_RECURSION = YES; 708 | CLANG_WARN_INT_CONVERSION = YES; 709 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 710 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 711 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 712 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 713 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 714 | CLANG_WARN_STRICT_PROTOTYPES = YES; 715 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 716 | CLANG_WARN_UNREACHABLE_CODE = YES; 717 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 718 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 719 | COPY_PHASE_STRIP = NO; 720 | ENABLE_STRICT_OBJC_MSGSEND = YES; 721 | ENABLE_TESTABILITY = YES; 722 | "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "arm64 "; 723 | GCC_C_LANGUAGE_STANDARD = gnu99; 724 | GCC_DYNAMIC_NO_PIC = NO; 725 | GCC_NO_COMMON_BLOCKS = YES; 726 | GCC_OPTIMIZATION_LEVEL = 0; 727 | GCC_PREPROCESSOR_DEFINITIONS = ( 728 | "DEBUG=1", 729 | "$(inherited)", 730 | ); 731 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 732 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 733 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 734 | GCC_WARN_UNDECLARED_SELECTOR = YES; 735 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 736 | GCC_WARN_UNUSED_FUNCTION = YES; 737 | GCC_WARN_UNUSED_VARIABLE = YES; 738 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 739 | LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)"; 740 | LIBRARY_SEARCH_PATHS = ( 741 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", 742 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"", 743 | "\"$(inherited)\"", 744 | ); 745 | MTL_ENABLE_DEBUG_INFO = YES; 746 | ONLY_ACTIVE_ARCH = YES; 747 | SDKROOT = iphoneos; 748 | }; 749 | name = Debug; 750 | }; 751 | 83CBBA211A601CBA00E9B192 /* Release */ = { 752 | isa = XCBuildConfiguration; 753 | buildSettings = { 754 | ALWAYS_SEARCH_USER_PATHS = NO; 755 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 756 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 757 | CLANG_CXX_LIBRARY = "libc++"; 758 | CLANG_ENABLE_MODULES = YES; 759 | CLANG_ENABLE_OBJC_ARC = YES; 760 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 761 | CLANG_WARN_BOOL_CONVERSION = YES; 762 | CLANG_WARN_COMMA = YES; 763 | CLANG_WARN_CONSTANT_CONVERSION = YES; 764 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 765 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 766 | CLANG_WARN_EMPTY_BODY = YES; 767 | CLANG_WARN_ENUM_CONVERSION = YES; 768 | CLANG_WARN_INFINITE_RECURSION = YES; 769 | CLANG_WARN_INT_CONVERSION = YES; 770 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 771 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 772 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 773 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 774 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 775 | CLANG_WARN_STRICT_PROTOTYPES = YES; 776 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 777 | CLANG_WARN_UNREACHABLE_CODE = YES; 778 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 779 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 780 | COPY_PHASE_STRIP = YES; 781 | ENABLE_NS_ASSERTIONS = NO; 782 | ENABLE_STRICT_OBJC_MSGSEND = YES; 783 | "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "arm64 "; 784 | GCC_C_LANGUAGE_STANDARD = gnu99; 785 | GCC_NO_COMMON_BLOCKS = YES; 786 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 787 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 788 | GCC_WARN_UNDECLARED_SELECTOR = YES; 789 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 790 | GCC_WARN_UNUSED_FUNCTION = YES; 791 | GCC_WARN_UNUSED_VARIABLE = YES; 792 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 793 | LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)"; 794 | LIBRARY_SEARCH_PATHS = ( 795 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", 796 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"", 797 | "\"$(inherited)\"", 798 | ); 799 | MTL_ENABLE_DEBUG_INFO = NO; 800 | SDKROOT = iphoneos; 801 | VALIDATE_PRODUCT = YES; 802 | }; 803 | name = Release; 804 | }; 805 | /* End XCBuildConfiguration section */ 806 | 807 | /* Begin XCConfigurationList section */ 808 | 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "JsiImageExampleTests" */ = { 809 | isa = XCConfigurationList; 810 | buildConfigurations = ( 811 | 00E356F61AD99517003FC87E /* Debug */, 812 | 00E356F71AD99517003FC87E /* Release */, 813 | ); 814 | defaultConfigurationIsVisible = 0; 815 | defaultConfigurationName = Release; 816 | }; 817 | 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "JsiImageExample" */ = { 818 | isa = XCConfigurationList; 819 | buildConfigurations = ( 820 | 13B07F941A680F5B00A75B9A /* Debug */, 821 | 13B07F951A680F5B00A75B9A /* Release */, 822 | ); 823 | defaultConfigurationIsVisible = 0; 824 | defaultConfigurationName = Release; 825 | }; 826 | 2D02E4BA1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "JsiImageExample-tvOS" */ = { 827 | isa = XCConfigurationList; 828 | buildConfigurations = ( 829 | 2D02E4971E0B4A5E006451C7 /* Debug */, 830 | 2D02E4981E0B4A5E006451C7 /* Release */, 831 | ); 832 | defaultConfigurationIsVisible = 0; 833 | defaultConfigurationName = Release; 834 | }; 835 | 2D02E4BB1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "JsiImageExample-tvOSTests" */ = { 836 | isa = XCConfigurationList; 837 | buildConfigurations = ( 838 | 2D02E4991E0B4A5E006451C7 /* Debug */, 839 | 2D02E49A1E0B4A5E006451C7 /* Release */, 840 | ); 841 | defaultConfigurationIsVisible = 0; 842 | defaultConfigurationName = Release; 843 | }; 844 | 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "JsiImageExample" */ = { 845 | isa = XCConfigurationList; 846 | buildConfigurations = ( 847 | 83CBBA201A601CBA00E9B192 /* Debug */, 848 | 83CBBA211A601CBA00E9B192 /* Release */, 849 | ); 850 | defaultConfigurationIsVisible = 0; 851 | defaultConfigurationName = Release; 852 | }; 853 | /* End XCConfigurationList section */ 854 | }; 855 | rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; 856 | } 857 | --------------------------------------------------------------------------------