react-native-yolo 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +29 -0
  3. package/Yolo.podspec +31 -0
  4. package/android/CMakeLists.txt +32 -0
  5. package/android/build.gradle +148 -0
  6. package/android/fix-prefab.gradle +51 -0
  7. package/android/gradle.properties +5 -0
  8. package/android/src/main/AndroidManifest.xml +2 -0
  9. package/android/src/main/cpp/cpp-adapter.cpp +9 -0
  10. package/android/src/main/java/com/yolo/HybridYolo.kt +12 -0
  11. package/android/src/main/java/com/yolo/YoloPackage.kt +20 -0
  12. package/ios/Bridge.h +8 -0
  13. package/ios/HybridYolo.swift +14 -0
  14. package/lib/commonjs/index.js +9 -0
  15. package/lib/commonjs/index.js.map +1 -0
  16. package/lib/commonjs/package.json +1 -0
  17. package/lib/commonjs/specs/yolo.nitro.js +6 -0
  18. package/lib/commonjs/specs/yolo.nitro.js.map +1 -0
  19. package/lib/module/index.js +5 -0
  20. package/lib/module/index.js.map +1 -0
  21. package/lib/module/specs/yolo.nitro.js +4 -0
  22. package/lib/module/specs/yolo.nitro.js.map +1 -0
  23. package/lib/typescript/src/index.d.ts +3 -0
  24. package/lib/typescript/src/index.d.ts.map +1 -0
  25. package/lib/typescript/src/specs/yolo.nitro.d.ts +9 -0
  26. package/lib/typescript/src/specs/yolo.nitro.d.ts.map +1 -0
  27. package/nitro.json +30 -0
  28. package/nitrogen/generated/.gitattributes +1 -0
  29. package/nitrogen/generated/android/Yolo+autolinking.cmake +81 -0
  30. package/nitrogen/generated/android/Yolo+autolinking.gradle +27 -0
  31. package/nitrogen/generated/android/YoloOnLoad.cpp +54 -0
  32. package/nitrogen/generated/android/YoloOnLoad.hpp +34 -0
  33. package/nitrogen/generated/android/c++/JHybridYoloSpec.cpp +58 -0
  34. package/nitrogen/generated/android/c++/JHybridYoloSpec.hpp +64 -0
  35. package/nitrogen/generated/android/kotlin/com/margelo/nitro/yolo/HybridYoloSpec.kt +58 -0
  36. package/nitrogen/generated/android/kotlin/com/margelo/nitro/yolo/YoloOnLoad.kt +35 -0
  37. package/nitrogen/generated/ios/Yolo+autolinking.rb +62 -0
  38. package/nitrogen/generated/ios/Yolo-Swift-Cxx-Bridge.cpp +33 -0
  39. package/nitrogen/generated/ios/Yolo-Swift-Cxx-Bridge.hpp +51 -0
  40. package/nitrogen/generated/ios/Yolo-Swift-Cxx-Umbrella.hpp +43 -0
  41. package/nitrogen/generated/ios/YoloAutolinking.mm +33 -0
  42. package/nitrogen/generated/ios/YoloAutolinking.swift +26 -0
  43. package/nitrogen/generated/ios/c++/HybridYoloSpecSwift.cpp +11 -0
  44. package/nitrogen/generated/ios/c++/HybridYoloSpecSwift.hpp +90 -0
  45. package/nitrogen/generated/ios/swift/HybridYoloSpec.swift +56 -0
  46. package/nitrogen/generated/ios/swift/HybridYoloSpec_cxx.swift +150 -0
  47. package/nitrogen/generated/shared/c++/HybridYoloSpec.cpp +22 -0
  48. package/nitrogen/generated/shared/c++/HybridYoloSpec.hpp +63 -0
  49. package/package.json +122 -0
  50. package/src/index.ts +5 -0
  51. package/src/specs/yolo.nitro.ts +6 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Khaoula-Ghalimi
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.
package/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # react-native-yolo
2
+
3
+ react-native-yolo is a react native package built with Nitro
4
+
5
+ [![Version](https://img.shields.io/npm/v/react-native-yolo.svg)](https://www.npmjs.com/package/react-native-yolo)
6
+ [![Downloads](https://img.shields.io/npm/dm/react-native-yolo.svg)](https://www.npmjs.com/package/react-native-yolo)
7
+ [![License](https://img.shields.io/npm/l/react-native-yolo.svg)](https://github.com/patrickkabwe/react-native-yolo/LICENSE)
8
+
9
+ ## Requirements
10
+
11
+ - React Native v0.76.0 or higher
12
+ - Node 18.0.0 or higher
13
+
14
+ > [!IMPORTANT]
15
+ > To Support `Nitro Views` you need to install React Native version v0.78.0 or higher.
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ npm install react-native-yolo react-native-nitro-modules
21
+ ```
22
+
23
+ ## Credits
24
+
25
+ Bootstrapped with [create-nitro-module](https://github.com/patrickkabwe/create-nitro-module).
26
+
27
+ ## Contributing
28
+
29
+ Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
package/Yolo.podspec ADDED
@@ -0,0 +1,31 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = "Yolo"
7
+ s.version = package["version"]
8
+ s.summary = package["description"]
9
+ s.homepage = package["homepage"]
10
+ s.license = package["license"]
11
+ s.authors = package["author"]
12
+
13
+ s.platforms = { :ios => min_ios_version_supported, :visionos => 1.0 }
14
+ s.source = { :git => "https://github.com/khaoula-ghalimi/react-native-yolo.git", :tag => "#{s.version}" }
15
+
16
+ s.source_files = [
17
+ # Implementation (Swift)
18
+ "ios/**/*.{swift}",
19
+ # Autolinking/Registration (Objective-C++)
20
+ "ios/**/*.{m,mm}",
21
+ # Implementation (C++ objects)
22
+ "cpp/**/*.{hpp,cpp}",
23
+ ]
24
+
25
+ load 'nitrogen/generated/ios/Yolo+autolinking.rb'
26
+ add_nitrogen_files(s)
27
+
28
+ s.dependency 'React-jsi'
29
+ s.dependency 'React-callinvoker'
30
+ install_modules_dependencies(s)
31
+ end
@@ -0,0 +1,32 @@
1
+ project(Yolo)
2
+ cmake_minimum_required(VERSION 3.9.0)
3
+
4
+ set (PACKAGE_NAME Yolo)
5
+ set (CMAKE_VERBOSE_MAKEFILE ON)
6
+ set (CMAKE_CXX_STANDARD 20)
7
+
8
+ # Enable Raw Props parsing in react-native (for Nitro Views)
9
+ add_compile_options(-DRN_SERIALIZABLE_STATE=1)
10
+
11
+ # Define C++ library and add all sources
12
+ add_library(${PACKAGE_NAME} SHARED
13
+ src/main/cpp/cpp-adapter.cpp
14
+ )
15
+
16
+ # Add Nitrogen specs :)
17
+ include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/Yolo+autolinking.cmake)
18
+
19
+ # Set up local includes
20
+ include_directories(
21
+ "src/main/cpp"
22
+ "../cpp"
23
+ )
24
+
25
+ find_library(LOG_LIB log)
26
+
27
+ # Link all libraries together
28
+ target_link_libraries(
29
+ ${PACKAGE_NAME}
30
+ ${LOG_LIB}
31
+ android # <-- Android core
32
+ )
@@ -0,0 +1,148 @@
1
+ buildscript {
2
+ repositories {
3
+ google()
4
+ mavenCentral()
5
+ }
6
+
7
+ dependencies {
8
+ classpath "com.android.tools.build:gradle:8.8.0"
9
+ }
10
+ }
11
+
12
+ def reactNativeArchitectures() {
13
+ def value = rootProject.getProperties().get("reactNativeArchitectures")
14
+ return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
15
+ }
16
+
17
+ def isNewArchitectureEnabled() {
18
+ return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
19
+ }
20
+
21
+ apply plugin: "com.android.library"
22
+ apply plugin: 'org.jetbrains.kotlin.android'
23
+ apply from: '../nitrogen/generated/android/Yolo+autolinking.gradle'
24
+ apply from: "./fix-prefab.gradle"
25
+
26
+ if (isNewArchitectureEnabled()) {
27
+ apply plugin: "com.facebook.react"
28
+ }
29
+
30
+ def getExtOrDefault(name) {
31
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["Yolo_" + name]
32
+ }
33
+
34
+ def getExtOrIntegerDefault(name) {
35
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["Yolo_" + name]).toInteger()
36
+ }
37
+
38
+ android {
39
+ namespace "com.yolo"
40
+
41
+ ndkVersion getExtOrDefault("ndkVersion")
42
+ compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
43
+
44
+ defaultConfig {
45
+ minSdkVersion getExtOrIntegerDefault("minSdkVersion")
46
+ targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
47
+ buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
48
+
49
+ externalNativeBuild {
50
+ cmake {
51
+ cppFlags "-frtti -fexceptions -Wall -Wextra -fstack-protector-all"
52
+ arguments "-DANDROID_STL=c++_shared", "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON"
53
+ abiFilters (*reactNativeArchitectures())
54
+
55
+ buildTypes {
56
+ debug {
57
+ cppFlags "-O1 -g"
58
+ }
59
+ release {
60
+ cppFlags "-O2"
61
+ }
62
+ }
63
+ }
64
+ }
65
+ }
66
+
67
+ externalNativeBuild {
68
+ cmake {
69
+ path "CMakeLists.txt"
70
+ }
71
+ }
72
+
73
+ packagingOptions {
74
+ excludes = [
75
+ "META-INF",
76
+ "META-INF/**",
77
+ "**/libc++_shared.so",
78
+ "**/libfbjni.so",
79
+ "**/libjsi.so",
80
+ "**/libfolly_json.so",
81
+ "**/libfolly_runtime.so",
82
+ "**/libglog.so",
83
+ "**/libhermes.so",
84
+ "**/libhermes-executor-debug.so",
85
+ "**/libhermes_executor.so",
86
+ "**/libreactnative.so",
87
+ "**/libreactnativejni.so",
88
+ "**/libturbomodulejsijni.so",
89
+ "**/libreact_nativemodule_core.so",
90
+ "**/libjscexecutor.so"
91
+ ]
92
+ }
93
+
94
+ buildFeatures {
95
+ buildConfig true
96
+ prefab true
97
+ }
98
+
99
+ buildTypes {
100
+ release {
101
+ minifyEnabled false
102
+ }
103
+ }
104
+
105
+ lintOptions {
106
+ disable "GradleCompatible"
107
+ }
108
+
109
+ compileOptions {
110
+ sourceCompatibility JavaVersion.VERSION_1_8
111
+ targetCompatibility JavaVersion.VERSION_1_8
112
+ }
113
+
114
+ sourceSets {
115
+ main {
116
+ if (isNewArchitectureEnabled()) {
117
+ java.srcDirs += [
118
+ // React Codegen files
119
+ "${project.buildDir}/generated/source/codegen/java"
120
+ ]
121
+ }
122
+ }
123
+ }
124
+ }
125
+
126
+ repositories {
127
+ mavenCentral()
128
+ google()
129
+ }
130
+
131
+
132
+ dependencies {
133
+ // For < 0.71, this will be from the local maven repo
134
+ // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
135
+ //noinspection GradleDynamicVersion
136
+ implementation "com.facebook.react:react-native:+"
137
+
138
+ // Add a dependency on NitroModules
139
+ implementation project(":react-native-nitro-modules")
140
+ }
141
+
142
+ if (isNewArchitectureEnabled()) {
143
+ react {
144
+ jsRootDir = file("../src/")
145
+ libraryName = "Yolo"
146
+ codegenJavaPackageName = "com.yolo"
147
+ }
148
+ }
@@ -0,0 +1,51 @@
1
+ tasks.configureEach { task ->
2
+ // Make sure that we generate our prefab publication file only after having built the native library
3
+ // so that not a header publication file, but a full configuration publication will be generated, which
4
+ // will include the .so file
5
+
6
+ def prefabConfigurePattern = ~/^prefab(.+)ConfigurePackage$/
7
+ def matcher = task.name =~ prefabConfigurePattern
8
+ if (matcher.matches()) {
9
+ def variantName = matcher[0][1]
10
+ task.outputs.upToDateWhen { false }
11
+ task.dependsOn("externalNativeBuild${variantName}")
12
+ }
13
+ }
14
+
15
+ afterEvaluate {
16
+ def abis = reactNativeArchitectures()
17
+ rootProject.allprojects.each { proj ->
18
+ if (proj === rootProject) return
19
+
20
+ def dependsOnThisLib = proj.configurations.findAll { it.canBeResolved }.any { config ->
21
+ config.dependencies.any { dep ->
22
+ dep.group == project.group && dep.name == project.name
23
+ }
24
+ }
25
+ if (!dependsOnThisLib && proj != project) return
26
+
27
+ if (!proj.plugins.hasPlugin('com.android.application') && !proj.plugins.hasPlugin('com.android.library')) {
28
+ return
29
+ }
30
+
31
+ def variants = proj.android.hasProperty('applicationVariants') ? proj.android.applicationVariants : proj.android.libraryVariants
32
+ // Touch the prefab_config.json files to ensure that in ExternalNativeJsonGenerator.kt we will re-trigger the prefab CLI to
33
+ // generate a libnameConfig.cmake file that will contain our native library (.so).
34
+ // See this condition: https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:build-system/gradle-core/src/main/java/com/android/build/gradle/tasks/ExternalNativeJsonGenerator.kt;l=207-219?q=createPrefabBuildSystemGlue
35
+ variants.all { variant ->
36
+ def variantName = variant.name
37
+ abis.each { abi ->
38
+ def searchDir = new File(proj.projectDir, ".cxx/${variantName}")
39
+ if (!searchDir.exists()) return
40
+ def matches = []
41
+ searchDir.eachDir { randomDir ->
42
+ def prefabFile = new File(randomDir, "${abi}/prefab_config.json")
43
+ if (prefabFile.exists()) matches << prefabFile
44
+ }
45
+ matches.each { prefabConfig ->
46
+ prefabConfig.setLastModified(System.currentTimeMillis())
47
+ }
48
+ }
49
+ }
50
+ }
51
+ }
@@ -0,0 +1,5 @@
1
+ Yolo_kotlinVersion=2.1.20
2
+ Yolo_minSdkVersion=23
3
+ Yolo_targetSdkVersion=35
4
+ Yolo_compileSdkVersion=34
5
+ Yolo_ndkVersion=27.1.12297006
@@ -0,0 +1,2 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ </manifest>
@@ -0,0 +1,9 @@
1
+ #include <jni.h>
2
+ #include <fbjni/fbjni.h>
3
+ #include "YoloOnLoad.hpp"
4
+
5
+ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
6
+ return facebook::jni::initialize(vm, []() {
7
+ margelo::nitro::yolo::registerAllNatives();
8
+ });
9
+ }
@@ -0,0 +1,12 @@
1
+ package com.yolo
2
+
3
+ import com.margelo.nitro.yolo.HybridYoloSpec
4
+
5
+ class HybridYolo: HybridYoloSpec() {
6
+ override fun sum(num1: Double, num2: Double): Double {
7
+ return num1 + num2
8
+ }
9
+ override fun subtract(num1: Double, num2: Double): Double {
10
+ return num1 - num2
11
+ }
12
+ }
@@ -0,0 +1,20 @@
1
+ package com.yolo;
2
+
3
+ import com.facebook.react.bridge.NativeModule;
4
+ import com.facebook.react.bridge.ReactApplicationContext;
5
+ import com.facebook.react.module.model.ReactModuleInfoProvider;
6
+ import com.facebook.react.BaseReactPackage;
7
+ import com.margelo.nitro.yolo.YoloOnLoad;
8
+
9
+
10
+ public class YoloPackage : BaseReactPackage() {
11
+ override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? = null
12
+
13
+ override fun getReactModuleInfoProvider(): ReactModuleInfoProvider = ReactModuleInfoProvider { emptyMap() }
14
+
15
+ companion object {
16
+ init {
17
+ YoloOnLoad.initializeNative();
18
+ }
19
+ }
20
+ }
package/ios/Bridge.h ADDED
@@ -0,0 +1,8 @@
1
+ //
2
+ // Bridge.h
3
+ // yolo
4
+ //
5
+ // Created by Khaoula-Ghalimi on 17/06/2026
6
+ //
7
+
8
+ #pragma once
@@ -0,0 +1,14 @@
1
+ //
2
+ // HybridYolo.swift
3
+ // Pods
4
+ //
5
+ // Created by Khaoula-Ghalimi on 17/06/2026.
6
+ //
7
+
8
+ import Foundation
9
+
10
+ class HybridYolo: HybridYoloSpec {
11
+ func sum(num1: Double, num2: Double) throws -> Double {
12
+ return num1 + num2
13
+ }
14
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Yolo = void 0;
7
+ var _reactNativeNitroModules = require("react-native-nitro-modules");
8
+ const Yolo = exports.Yolo = _reactNativeNitroModules.NitroModules.createHybridObject('Yolo');
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNativeNitroModules","require","Yolo","exports","NitroModules","createHybridObject"],"sourceRoot":"..\\..\\src","sources":["index.ts"],"mappings":";;;;;;AAAA,IAAAA,wBAAA,GAAAC,OAAA;AAGO,MAAMC,IAAI,GAAAC,OAAA,CAAAD,IAAA,GACfE,qCAAY,CAACC,kBAAkB,CAAW,MAAM,CAAC","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=yolo.nitro.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"..\\..\\..\\src","sources":["specs/yolo.nitro.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ import { NitroModules } from 'react-native-nitro-modules';
4
+ export const Yolo = NitroModules.createHybridObject('Yolo');
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NitroModules","Yolo","createHybridObject"],"sourceRoot":"..\\..\\src","sources":["index.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,4BAA4B;AAGzD,OAAO,MAAMC,IAAI,GACfD,YAAY,CAACE,kBAAkB,CAAW,MAAM,CAAC","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export {};
4
+ //# sourceMappingURL=yolo.nitro.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"..\\..\\..\\src","sources":["specs/yolo.nitro.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,3 @@
1
+ import type { Yolo as YoloSpec } from './specs/yolo.nitro';
2
+ export declare const Yolo: YoloSpec;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAE1D,eAAO,MAAM,IAAI,UACkC,CAAA"}
@@ -0,0 +1,9 @@
1
+ import type { HybridObject } from 'react-native-nitro-modules';
2
+ export interface Yolo extends HybridObject<{
3
+ ios: 'swift';
4
+ android: 'kotlin';
5
+ }> {
6
+ sum(num1: number, num2: number): number;
7
+ subtract(num1: number, num2: number): number;
8
+ }
9
+ //# sourceMappingURL=yolo.nitro.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"yolo.nitro.d.ts","sourceRoot":"","sources":["../../../../src/specs/yolo.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAE9D,MAAM,WAAW,IAAK,SAAQ,YAAY,CAAC;IAAE,GAAG,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,QAAQ,CAAA;CAAE,CAAC;IAC7E,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;CAC7C"}
package/nitro.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "$schema": "https://nitro.margelo.com/nitro.schema.json",
3
+ "cxxNamespace": [
4
+ "yolo"
5
+ ],
6
+ "ios": {
7
+ "iosModuleName": "Yolo"
8
+ },
9
+ "android": {
10
+ "androidNamespace": [
11
+ "yolo"
12
+ ],
13
+ "androidCxxLibName": "Yolo"
14
+ },
15
+ "autolinking": {
16
+ "Yolo": {
17
+ "ios": {
18
+ "language": "swift",
19
+ "implementationClassName": "HybridYolo"
20
+ },
21
+ "android": {
22
+ "language": "kotlin",
23
+ "implementationClassName": "HybridYolo"
24
+ }
25
+ }
26
+ },
27
+ "ignorePaths": [
28
+ "**/node_modules"
29
+ ]
30
+ }
@@ -0,0 +1 @@
1
+ ** linguist-generated=true
@@ -0,0 +1,81 @@
1
+ #
2
+ # Yolo+autolinking.cmake
3
+ # This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ # https://github.com/mrousavy/nitro
5
+ # Copyright © Marc Rousavy @ Margelo
6
+ #
7
+
8
+ # This is a CMake file that adds all files generated by Nitrogen
9
+ # to the current CMake project.
10
+ #
11
+ # To use it, add this to your CMakeLists.txt:
12
+ # ```cmake
13
+ # include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/Yolo+autolinking.cmake)
14
+ # ```
15
+
16
+ # Define a flag to check if we are building properly
17
+ add_definitions(-DBUILDING_YOLO_WITH_GENERATED_CMAKE_PROJECT)
18
+
19
+ # Enable Raw Props parsing in react-native (for Nitro Views)
20
+ add_definitions(-DRN_SERIALIZABLE_STATE)
21
+
22
+ # Add all headers that were generated by Nitrogen
23
+ include_directories(
24
+ "../nitrogen/generated/shared/c++"
25
+ "../nitrogen/generated/android/c++"
26
+ "../nitrogen/generated/android/"
27
+ )
28
+
29
+ # Add all .cpp sources that were generated by Nitrogen
30
+ target_sources(
31
+ # CMake project name (Android C++ library name)
32
+ Yolo PRIVATE
33
+ # Autolinking Setup
34
+ ../nitrogen/generated/android/YoloOnLoad.cpp
35
+ # Shared Nitrogen C++ sources
36
+ ../nitrogen/generated/shared/c++/HybridYoloSpec.cpp
37
+ # Android-specific Nitrogen C++ sources
38
+ ../nitrogen/generated/android/c++/JHybridYoloSpec.cpp
39
+ )
40
+
41
+ # From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake
42
+ # Used in node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake
43
+ target_compile_definitions(
44
+ Yolo PRIVATE
45
+ -DFOLLY_NO_CONFIG=1
46
+ -DFOLLY_HAVE_CLOCK_GETTIME=1
47
+ -DFOLLY_USE_LIBCPP=1
48
+ -DFOLLY_CFG_NO_COROUTINES=1
49
+ -DFOLLY_MOBILE=1
50
+ -DFOLLY_HAVE_RECVMMSG=1
51
+ -DFOLLY_HAVE_PTHREAD=1
52
+ # Once we target android-23 above, we can comment
53
+ # the following line. NDK uses GNU style stderror_r() after API 23.
54
+ -DFOLLY_HAVE_XSI_STRERROR_R=1
55
+ )
56
+
57
+ # Add all libraries required by the generated specs
58
+ find_package(fbjni REQUIRED) # <-- Used for communication between Java <-> C++
59
+ find_package(ReactAndroid REQUIRED) # <-- Used to set up React Native bindings (e.g. CallInvoker/TurboModule)
60
+ find_package(react-native-nitro-modules REQUIRED) # <-- Used to create all HybridObjects and use the Nitro core library
61
+
62
+ # Link all libraries together
63
+ target_link_libraries(
64
+ Yolo
65
+ fbjni::fbjni # <-- Facebook C++ JNI helpers
66
+ ReactAndroid::jsi # <-- RN: JSI
67
+ react-native-nitro-modules::NitroModules # <-- NitroModules Core :)
68
+ )
69
+
70
+ # Link react-native (different prefab between RN 0.75 and RN 0.76)
71
+ if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
72
+ target_link_libraries(
73
+ Yolo
74
+ ReactAndroid::reactnative # <-- RN: Native Modules umbrella prefab
75
+ )
76
+ else()
77
+ target_link_libraries(
78
+ Yolo
79
+ ReactAndroid::react_nativemodule_core # <-- RN: TurboModules Core
80
+ )
81
+ endif()
@@ -0,0 +1,27 @@
1
+ ///
2
+ /// Yolo+autolinking.gradle
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ /// This is a Gradle file that adds all files generated by Nitrogen
9
+ /// to the current Gradle project.
10
+ ///
11
+ /// To use it, add this to your build.gradle:
12
+ /// ```gradle
13
+ /// apply from: '../nitrogen/generated/android/Yolo+autolinking.gradle'
14
+ /// ```
15
+
16
+ logger.warn("[NitroModules] 🔥 Yolo is boosted by nitro!")
17
+
18
+ android {
19
+ sourceSets {
20
+ main {
21
+ java.srcDirs += [
22
+ // Nitrogen files
23
+ "${project.projectDir}/../nitrogen/generated/android/kotlin"
24
+ ]
25
+ }
26
+ }
27
+ }
@@ -0,0 +1,54 @@
1
+ ///
2
+ /// YoloOnLoad.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #ifndef BUILDING_YOLO_WITH_GENERATED_CMAKE_PROJECT
9
+ #error YoloOnLoad.cpp is not being built with the autogenerated CMakeLists.txt project. Is a different CMakeLists.txt building this?
10
+ #endif
11
+
12
+ #include "YoloOnLoad.hpp"
13
+
14
+ #include <jni.h>
15
+ #include <fbjni/fbjni.h>
16
+ #include <NitroModules/HybridObjectRegistry.hpp>
17
+
18
+ #include "JHybridYoloSpec.hpp"
19
+ #include <NitroModules/DefaultConstructableObject.hpp>
20
+
21
+ namespace margelo::nitro::yolo {
22
+
23
+ int initialize(JavaVM* vm) {
24
+ return facebook::jni::initialize(vm, []() {
25
+ ::margelo::nitro::yolo::registerAllNatives();
26
+ });
27
+ }
28
+
29
+ struct JHybridYoloSpecImpl: public jni::JavaClass<JHybridYoloSpecImpl, JHybridYoloSpec::JavaPart> {
30
+ static constexpr auto kJavaDescriptor = "Lcom/yolo/HybridYolo;";
31
+ static std::shared_ptr<JHybridYoloSpec> create() {
32
+ static const auto constructorFn = javaClassStatic()->getConstructor<JHybridYoloSpecImpl::javaobject()>();
33
+ jni::local_ref<JHybridYoloSpec::JavaPart> javaPart = javaClassStatic()->newObject(constructorFn);
34
+ return javaPart->getJHybridYoloSpec();
35
+ }
36
+ };
37
+
38
+ void registerAllNatives() {
39
+ using namespace margelo::nitro;
40
+ using namespace margelo::nitro::yolo;
41
+
42
+ // Register native JNI methods
43
+ margelo::nitro::yolo::JHybridYoloSpec::CxxPart::registerNatives();
44
+
45
+ // Register Nitro Hybrid Objects
46
+ HybridObjectRegistry::registerHybridObjectConstructor(
47
+ "Yolo",
48
+ []() -> std::shared_ptr<HybridObject> {
49
+ return JHybridYoloSpecImpl::create();
50
+ }
51
+ );
52
+ }
53
+
54
+ } // namespace margelo::nitro::yolo