61 Commits
Author SHA1 Message Date
Marc RousavyandGitHub 05f2089ed2 perf: cover deferred worker promises and native-owned buffers (#1607)
* perf: cover deferred native Promises and native-owned buffer bounce

* fix(ios): expose ThreadPool in the NitroModules framework
2026-09-07 12:59:12 +02:00
Marc RousavyandGitHub e1ca888b3d chore: Move repo references from mrousavy to margelo org (#1542)
Nitro now lives at github.com/margelo/nitro. This updates every
reference to the old `mrousavy/nitro` location:

- `package.json` `repository`/`bugs` for all 5 packages + root
- All 4 podspecs (`s.source`)
- Issue templates ("search similar issues" links)
- Docusaurus `organizationName` + navbar/footer/JSON-LD `codeRepository`
- Docs prose links
- nitrogen CLI banner and the generated-file header comment
  (`helpers.ts`), plus all 275 regenerated files
- `nitrogen init` clones the template from `margelo/nitro`

Also updates links to sibling repos that moved to `margelo` too
(`react-native-vision-camera`, `react-native-mmkv`,
`react-native-fast-tflite`), and aligns the iOS example bundle ID
with Android's (`com.mrousavy.nitro.example` ->
`com.margelo.nitro.example`).

Intentionally unchanged: `author` fields, personal links
(mrousavy.com/Twitter/YouTube/Sponsors, `FUNDING.yml`), and links to
repos still under `mrousavy` (`NitroBenchmarks`,
`react-native-nitro-image`, `react-native-data-scanner`).
2026-08-29 11:45:02 +02:00
Marc RousavyandGitHub 996c7ed992 fix: Rename CachedProp to ReactProp, re-add legacy CachedProp as deprecated (#1517)
The v0.37.0 View props rewrite changed `CachedProp<T>`'s API (immutable
shared entry, `get()`/`isProvided()`/`hasSameValue()`), which broke
modules whose specs were generated by nitrogen <= 0.36.x - their generated
code uses the old mutable API (`.value`, `.isDirty`, 3-arg
`fromRawValue(runtime, value, oldProp)`) and no longer compiled against
the new core.

- Rename the new implementation to `ReactProp<T>` (cpp/views/ReactProp.hpp),
  and fold its now-single-use private helpers into `fromRawValue`
- Re-add `CachedProp<T>` exactly as it shipped in v0.36.5, marked
  [[deprecated]], so old generated specs compile again (with a warning)
- Update nitrogen to emit `ReactProp` and re-generate nitro-test specs
2026-08-20 18:33:05 +02:00
Marc RousavyandGitHub 551749f430 fix: Preserve classic View prop parsing across React Native versions (#1507) 2026-08-20 11:50:54 +02:00
Marc RousavyandGitHub f6048076cb feat: Move Props into Nitro Modules core via C++ template (#1487)
* feat: Move `Props` into Nitro Modules core via C++ template

* Update Podfile.lock

* Generate props in user code again

* Use CachedProp constructor

* include properly

* Update IsFunctionProp.hpp

* refactor

* simplify
2026-08-20 10:50:14 +02:00
Marc RousavyandGitHub 670f4654f5 feat: Move react::ComponentDescriptor into Nitro Modules core via C++ template (#1486)
* feat: Add base files

* use type

* clean header

* Update ViewComponentDescriptor.hpp

* Use it!

* fix build error

* comments

* Update JSIRawPropsParser.hpp

* remove raw prop parser ig

* fix: remove deleted header from podspec
2026-08-20 10:50:14 +02:00
Tomasz ŻelawskiandGitHub 793266283e feat: Add macOS support (via :osx podspec target) (#1280) 2026-04-02 18:00:10 +02:00
Marc RousavyandGitHub 0cd8eeaac8 fix: Remove a bunch of deprecated APIs (#1245) 2026-03-04 14:02:21 +01:00
Marc RousavyandGitHub 2eb56b1b3a docs: Fix it's -> its (#1125) 2025-12-23 12:55:57 +01:00
Marc RousavyandGitHub c94263763d perf: Cache jsi::PropNameIDs (makes Nitro 30% faster) (#1114)
* feat: Create `PropNameID` Cache

* Impl PropNameID

* fix: Use `const jsi::PropNameID&` instead of `BorrowingReference`

* perf: Use `PropNameIDCache` everywhere internally

* fix: Make use of `PropNameIDCache` in custom user defined structs

* fix: Use `PropNameIDCache` for Hybrid Views too

* fix: `jsi::Runtime` deref

* fix: Allow `JSICache` to use itself by caching itself first

* fix: Remove `allowCache` flag

* perf: Avoid `BorrowingReference<T>` copy and use `const T&`

* perf: Use `PropNameIDCache` inside `defineProperty(...)`

* docs: Add docs
2025-12-18 21:36:27 +01:00
Marc RousavyandGitHub 0c4306cbd7 feat: Add explicit null type (#1032)
* feat: Add explicit `null` type

* Handle the cases

* Use NullType instead of `std::monostate`

* null is now variant! nice

* fix: Add missing imports

* fix: Fix podspec

* whoops now its fixed

* we're getting there...

* it builds on Android!

* fix: Add monostate back

* fix: Fix JNull lookup

* fix: Fix Swift build

* feat: Add tests for `null` type

* remove `UndefinedType`

* Now iOS builds???

* Nulls docs

* fix: Build with Xcode 26.1

* Revert "fix: Build with Xcode 26.1"

This reverts commit 41d1efea7a.
2025-11-10 22:31:22 +01:00
Marc RousavyandGitHub 428583b335 fix: Fix all-empty/optional structs being wrongfully detected in variants (#934)
* fix: Fix all-empty/optional plain objects being wrongfully detected in Variant

* fix: Only use `toString()` if it is actually implemented as it's own property

* feat: Add test for this variant issue
2025-10-10 12:50:12 +02:00
Marc RousavyandGitHub 03e4c5098c perf: Allow fast path for primitively copyable arrays (#867)
* perf: Allow fast path for primitively copyable arrays

* feat: Better fast copy to Swift

* idk if this makes a difference tbh

* More readable

* fix: Use `std::span` to make it safer

* fix: Allow fast path for simple `memcpy`

* Update NitroTest-Swift-Cxx-Bridge.hpp

* feat: Move to `FastVectorCopy`

* fix: Just check if `needsSpecialHandling`

* chore: Lint C++

* fix: Name prefixes

* fix: Replace `reserve` with alloc
2025-09-24 12:22:08 +02:00
Marc RousavyandGitHub 5feff97085 fix: Fix build on RN 0.79 or lower (#825) 2025-08-31 13:29:00 +02:00
Marc Rousavy 5968c29e23 fix: Add AnyMapHolder to package again (deprecated) 2025-08-04 14:57:14 +02:00
Hanno J. GödeckeandGitHub e713443955 fix: Don't apply Folly flags after RN 0.80 (#737) 2025-07-15 16:35:59 +02:00
Marc RousavyandGitHub b7ffea58e4 fix: Rename ArrayBufferHolder -> ArrayBuffer and AnyMapHolder -> AnyMap (#732)
* fix: Rename `ArrayBufferHolder` -> `ArrayBuffer` and `AnyMapHolder` -> `AnyMap`

* pods

* rename move

* perf: Make final

* fix: Replace usage in Nitrogen & make backwards compatible

* Update AnyMapUtils.hpp

* fix: Fix minor c++ usage

* fix: Format

* fix: Make it backwards compatible.
2025-07-14 16:18:21 +02:00
Marc RousavyandGitHub 6234dd25de feat: Add Date type (#678)
* feat: Add support for `Date` types

* feat: Add Swift example

* Update Podfile.lock

* Use java.time.Instant

* fix: Fix bugs

* fix: Now it builds

* Update getTests.ts

* fix: Fix `Date.valueOf(..)` not using `this`

* Lint

* Simplify

* fix: Use Double

* Parse Swift Date

* fix: Use `double` now

* Use `margelo.nitro.chrono_time`

* feat: Add `Date` to docs

* ci: Remove pods cache

* Revert "ci: Remove pods cache"

This reverts commit b1c47f4fe0.

* Update Podfile.lock

* Update Podfile.lock

* fix: Fix JInstant methods on Kotlin

They're called differently.

* feat: Improve the tests a bit

* valueOf -> getTime
2025-06-04 15:29:50 +02:00
Marc RousavyandGitHub 341d6c8986 chore: Remove deprecated HybridContext (#577) 2025-02-24 15:43:00 +01:00
Marc RousavyandGitHub 4d07b2a1d5 feat: Create Sync<T> to pass fully synchronous JS callbacks (#564)
* feat: Create `Sync<T>`

* Return

* Make it return number

* feat: Add `isSync` check...

* check

* Impl

* feat: Add `JSCallback`

* perf: Store `Dispatcher` in cache if really missed

* I think it builds now

* fix memory

* fix: Use `isAsync`

* Rename

* fix: Impl `callHybridFunction` again

* fix: Avoid forward decl

* Docs

* feat: Cache `regex` in `NitroTypeInfo`

* Update NitroTypeInfo.cpp

* perf: Make `Dispatcher` a `weak_ptr`

* Some formating

* fix: Fix styling in Benchmarks

* feat: Test if callbackSync returns same number

* fix: Fix warning in `toString()`

* Update Sync.ts

* perf: Allow `std::forward<...>`
2025-02-23 15:59:01 +01:00
Marc RousavyandGitHub 35a4efb6a0 chore: Import react-native version from ReactNativeVersion.h (#505)
* feat: Import react-native version from `ReactNativeVersion.h`

* fix: Use NitroDefines import

* chore: Use actual types
2025-01-21 15:22:48 +01:00
Marc RousavyandGitHub baed798c3e feat: Create React Native ViewManager (+ Props + State) for HybridViews (#500) 2025-01-20 16:40:15 +01:00
Marc RousavyandGitHub bbbeeaf6b8 feat: Specify RN version as compiler flag (#490)
* feat: Specify RN version in iOS

* Set RN version

* docs

* fix: Adjust scripts and add bootstrap

* fix: Fix react-native path again

* feat: Add `REACT_NATIVE_VERSION` flag to gradle

* fix: Use `tasks.register` to avoid reconfiguration

* fix: Use `project.layout.buildDirectory` instead of `project.buildDir`

* fix: arguments with comma

* fix: Use `buildDir` again

* fix: Pass `YES`

* feat: Add CMake C++ flags now

* fix: Indicate default overridden `HybridObject` constructor

* perf: Make `equals()` a bit faster
2025-01-13 14:13:00 +01:00
Marc RousavyandGitHub 00e9db4087 perf: Create PromiseHolder<T> (#439)
* feat: Create `PromiseHolder<T>`

* fix: Fix PromiseHolder

* partial fix

* It works now

* fix: Make `_mutex` a value

* Move ctor

* perf: Move functions

* Add back deprecated func

* more explicit
2024-12-20 11:12:08 +01:00
Marc RousavyandGitHub 5b3fa6c1d0 feat: Implement Swift errors 🥳 (#430)
* chore: Use C++ 23

* feat: Add `ResultWrappingType`

* feat: Add C++ `ResultWrappingType` bridge

* feat: Use C++ result wrapper

* feat: Use `std::expected` for Swift return types

* Bump to 23

* Downgrade to C++ 20 again

* fix: Use `Result<T>` instead of expected

* fix: Return even if void

* fix: Explicitly say type

* extra line for debugging

* fix: Fix double args

* fix: Bridge directly to C++ target for return values

* feat: THROW SWIFT ERROR WOOHOOO

* feat: Make it work

* feat: Add test that uses `Result<complex type>` and throws before

* Update getTests.ts

* Update HybridTestObjectKotlin.kt

* extra line

* perf: Use `assert` for `value()`

* docs: Remove error swift limitation as it now works
2024-12-18 16:51:54 +01:00
Marc RousavyandGitHub 0d7323d396 fix: Fix build when using use_frameworks (#379)
* fix: Fix build when using `use_frameworks`

* Update Podfile.lock

* fix: Declare dependency on `React-jsi` and `React-callinvoker`

* fix: Add `folly_compiler_flags`

* fix: Add `GCC_PREPROCESSOR_DEFINITIONS` again because we need to disable folly config

* fix: Remove unused compiler_flags

* Update Podfile.lock
2024-12-02 13:47:18 +01:00
Krzysztof MochandGitHub 36cf8ee72c feat: Add macOS and tvOS support (#372) 2024-11-25 14:31:42 +01:00
Marc RousavyandGitHub 6da4f98904 feat: Support awaiting JS Promise in Kotlin and Swift (#355)
* feat: Support passing `Promise` to Kotlin

* feat: Add `onResolvedListener`

* feat: Add `.then`, `.catch` and `.await` to Promise!

* feat: Use `await`

* feat: Use `Throwable` instead of `String` for error on Android

* Update Promise.kt

* chore: Remove unused `reject(string)` function now

* Update Promise.hpp

* Update Promise.hpp

* feat: Implement `awaitPromise(..)` on iOS

* feat: Add `RuntimeError` and `.toCpp` to Swift

* fix: Fix duplicate symbol in `RuntimeError`

* feat: Add `ErrorType`

* feat: Add `const&` funcs to `Promise` for Swift

* feat: Add `dependencies` to SwiftCxxBridge

* fix: `error` type

* feat: Add `RuntimeError.from(std.exception)`

* feat: Add `getFunctionCopy()` to `SwiftClosure`

* fix: Account for `Promise<void>` resolver

* fix: Fix `UnsafeMutableRawPointer` being nullable (wrong type)

* nitrogen

* clean

* Update HybridTestObjectSwiftKotlinSpecCxx.swift

* feat: Add actual Promise listeners!!

* fix: Add `addOnResolvedListenerCopy` func for some cases

* chore: Format

* fix: Make `getFunctionCopy()` const

* feat: Support `Promise<void>` from JS!

* feat: Add `awaitAndGet` and `awaitAndGetComplex` promise tests

* feat: Test both new functions

* Slap a good ol' `mutex` on `Promise`

* fix: Fix `Promise<void>` never resolving because args count was `1` (`undefined`)

* fix: Fix Android wrong return type

* Update HybridTestObjectCpp.cpp
2024-11-19 18:06:31 +01:00
Marc RousavyandGitHub 110dcbf29d feat: Use new, faster, simpler Promise<T> in Nitrogen (#349)
* fix: Add `Promise.hpp` to podspec

* feat: Use new `Promise<T>` type for C++ and Swift

just a minor bug left

* chore: Format

* fix: Fix nitrogen to use old `future` for function return types FOR NOW

* feat: Use new `Promise<T>` on Kotlin!

* chore: Remove unused `PromiseHolder` now

* chore: Format
2024-11-19 02:21:21 +01:00
Krzysztof MochandGitHub 328a6e1251 feat: Add visionOS support (#323)
* feat: Add visionOS support

* chore: Update package.json keywords
2024-11-12 17:04:16 +01:00
Marc RousavyandGitHub aae46cb8c5 chore: Adjust Pod/Gradle message (#288)
* chore: Rename Pod/Gradle message

* chore: Put flame infront
2024-11-05 20:43:36 +01:00
Marc RousavyandGitHub b9bfb24e2e fix: Enable DEFINES_MODULE for stricter modular headers (#235)
* fix: Enable `DEFINES_MODULE` for stricter modular headers

* fix: Also set `DEFINES_MODULE` for all generated specs

e.g. NitroImage
2024-10-16 11:28:24 +02:00
Marc RousavyandGitHub dc8f8668f4 feat: Make Nitro itself a Nitro Module and add old-architecture support 🔥 (#175)
* feat: Create `HybridNitroModulesProxy`

* feat: Create `InstallNitro`

* docs: Create `entry-point.md` docs

* fix: Create `JSIConverter<HostObject>` (for BoxedHybridObject)

* Update NitroModulesProxy.ts

* feat: Refactor JS for new module

* feat: Refactor JS again

* feat: Create iOS TurboModule that installs Nitro

* feat: Implement `install()` for old arch (iOS)

* chore: Format

* feat: Implement TurboModule `install()` on Android

* fix: Use `CallInvokerHolderImpl`

* feat: Add CI that tests the build for old architecture

* fix: Fix iOS CI

* fix: Fix CI

* fix: Exclude RN `.so` libraries (like `libjsi.so`) from `packagingOptions`
2024-10-07 15:47:31 +02:00
Marc RousavyandGitHub 992c709caf feat: Safely wrap a Swift closure in a C++ accessible SwiftClosure struct and allow parameters bi-directionally (#81)
* feat: Safely wrap a Swift closure in a `SwiftClosure` struct callable from C++

* Unsafely unwrap (`!`)

* fix: Fix visibility modifiers

* fix: Rename `ClosureWrapper` -> `SwiftClosure`

* Update SwiftClosure.hpp

* Update SwiftClosure.hpp

* Create `SwiftFunction` base

* regen

* feat: Properly create `std::function` from Swift closure

* fix: Forward params I think

* Update SwiftCxxBridgedType.ts

* feat: Use static function pointer to allow for C++ types

* fix: Only do this for Swift

* Update SwiftCxxBridgedType.ts

* fix: Properly unwrap using `Unmanaged`

* fix: Fix Swift compiler crash by moving function to `std::shared_ptr` before capturing it

* feat: Properly share func before capturing it

* Update SwiftCxxTypeHelper.ts
2024-08-29 15:21:25 +02:00
Marc Rousavy 67ad63781f chore: Rename repo to nitro 2024-08-20 23:54:35 +02:00
Marc RousavyandGitHub dbadcc2151 feat: Create AnyMapHolder for Swift (#56)
* feat: Create `AnyMapHolder` for Swift

* feat: Bridge other types

* fix: Fix types

* feat: Make all public

* fix: Remove Arrays because of the Swift compiler bug

* feat: Create `AnyMapHolder`

* fix: Rename record `someMap` to `someRecord`

* feat: Use `someMap`

* fix: Fix "22 duplicate symbols" by making the funcs inline

* Update README.md
2024-08-20 23:16:55 +02:00
Marc RousavyandGitHub 2c277fe6f0 feat: Support Promise<T> in Swift (#43)
* fix: Rename `wrap(wrappingDataWithoutCopy)`

* Update ArrayBufferHolder.swift

* Update ArrayBufferHolder.swift

* feat: Move to `utils/`

* feat: Create `Promise` base

* feat: Make `Promise` templated

* Delete HybridContext.cpp

* feat: Create `Promise<T>` in Swift

* Update Promise.swift

* feat: Add docs

* feat: Create `PromiseHolder`

* feat: Create

* `ArrayBuffer` ctors

* Create `PromiseHolder`

* feat: Convert from and to `PromiseHolder<T>`?

* fix: Remove wrong `Promise` declaration

* Update JSIConverter+Promise.hpp

* Update HybridSwiftKotlinTestObject.swift

* Update NitroModules.podspec
2024-08-15 18:30:43 +02:00
Marc RousavyandGitHub c31936286d feat: Support ArrayBuffer in Swift 🥳 (#37)
* feat: Support `ArrayBuffer` in Swift

* feat: Create `ArrayBufferHolder` that holds a `std::shared_ptr<ArrayBuffer>`

* fix: Fix `void*` cast in Swift

* feat: Create `.allocate(..)` helper init

* fix: Fix `initializeToZero`

* feat: Add `createNewBuffer`

* fix: regenerate missing specs

* fix: Move import to iOS only, on Android we dont have that

* chore: Format
2024-08-14 19:34:31 +02:00
Marc Rousavy 7f2ccbec0b fix: Move HybridContext.hpp to iOS 2024-08-05 17:44:40 +02:00
Marc Rousavy da52559049 fix: Fix some headers 2024-08-05 17:31:09 +02:00
Marc Rousavy 87eae31207 feat: Move to templates 2024-08-02 21:45:48 +02:00
Marc Rousavy 55b11ecd5a Expose a few more headers 2024-07-29 12:05:04 +02:00
Marc Rousavy 786f2e9f13 fix: Use shared NitroDefines 2024-07-29 12:03:06 +02:00
Marc Rousavy cbfba72218 fix: Remove ForeignArrayBuffer 2024-07-26 14:21:12 +02:00
Marc Rousavy 3f1cb16b31 Try to create ForeignArrayBuffer in swift 2024-07-25 18:04:45 +02:00
Marc Rousavy a4b45d1753 Revert "feat: Create Data based ArrayBuffer for Swift"
This reverts commit b310478a8d.
2024-07-25 17:33:20 +02:00
Marc Rousavy b310478a8d feat: Create Data based ArrayBuffer for Swift 2024-07-25 17:24:13 +02:00
Marc Rousavy 97b8f659a1 Define ArrayBuffer.hpp 2024-07-22 23:46:11 +02:00
Marc Rousavy c7338e3beb Remove cxxPart 2024-07-22 23:20:31 +02:00
Marc Rousavy 7c7c5ac6eb feat: Support functions! 2024-07-22 22:16:44 +02:00