Commit Graph
91 Commits
Author SHA1 Message Date
Marc Rousavy 675f511a8d chore: release 0.26.4 2025-07-18 12:18:52 +02:00
Marc Rousavy 4f4bd828cb chore: release 0.26.3 2025-06-30 18:07:02 +02:00
Marc Rousavy f4baff8e54 chore: release 0.26.2 2025-06-06 14:19:29 +02:00
Marc Rousavy 98fd4703c4 chore: release 0.26.1 2025-06-05 14:37:47 +02:00
Marc Rousavy 312f8a2aed chore: release 0.26.0 2025-06-05 10:22:55 +02:00
Marc Rousavy 02c7c75377 chore: release 0.25.2 2025-03-19 21:39:47 +09:00
Marc Rousavy f39246332c chore: release 0.25.1 2025-03-10 12:36:30 +01:00
Marc Rousavy 2336120832 chore: release 0.25.0 2025-03-06 15:40:17 +01:00
Marc Rousavy a6a9472b5b chore: release 0.24.1 2025-02-24 17:05:11 +01:00
Marc Rousavy 1361e29d81 chore: release 0.24.0 2025-02-24 15:42:03 +01:00
Marc Rousavy 29cfa85198 chore: Allow comparing BorrowingReference<T> to nullptr 2025-02-23 16:46:04 +01:00
Marc RousavyandGitHub 9adb7df925 perf: Remove OwningLock<T> (#567)
* perf: Remove `OwningLock<T>`

* fix: Fix Java Class name
2025-02-23 16:33:53 +01:00
Marc RousavyandGitHub 4d7cf329dd fix: Log proper generic T types when throwing exceptions (#566)
* fix: Log proper `BorrowingReference<T>` type in error handler

* fix: Log types for even more cases
2025-02-23 16:30:16 +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 Rousavy 9cb081820e chore: release 0.23.0 2025-02-21 16:32:15 +01:00
Marc RousavyandGitHub 28f9c4acd6 feat: Nitro Views!!!!!!!!! 🥳 (#512)
* feat: Upgrade to react-native 0.78

* Bump target SDK to 35

* fix: Remove if guards for RN 78 version check

* fix: Use proper type to fix build for RN78

* feat: Create View Screen

* feat: Add Views logo

* feat: Actually render the view

* feat: It extends ViewProps

* feat: Style it better

* Blue light :)

* fix: Separate border and shadow

* fix: Set Folly flags

* fix: Fix build for Android by tweaking state getter

* WOOOHOOO IT WORKS ON ANDROID!!!!!!

* background color in android?

* chore: Rename to `isBlue`

* Update ViewScreen.tsx

* fix: `isX` for boolean getters

* fix: Also register view component in J View

* Revert "fix: `isX` for boolean getters"

This reverts commit 1ce5f31e06697f9c1dd0731c5903f0ae9797299b.

* feat: Pass environment to setter names

* fix: Fix stupid kotlin props being prefixed differently

* Update HybridTestView.kt

* feat: Add `beforeUpdate()` and `afterUpdate()` to Android

* indent

* feat: Unmount custom view when navigating away

* perf: Only override `adopt()` on Android

* perf: Make state updater `internal`

* add button to start/stop updating props

* Add infinite mount example

* chore: Rebuild lockfiles

* Update HybridTestViewSpec_cxx.swift

* feat: Upgrade to 78 stable

* lockfiles

* fix: Update RN Screens and Safe Area Context

* fix: Upgrade to RN Screens 4.9.0-beta.0 (for RN 78 support)
2025-02-19 21:01:26 +01:00
Marc Rousavy 92256f0fa1 chore: Release 0.22.1 2025-02-06 15:21:13 -08:00
Marc RousavyandGitHub 68e324f192 fix: Fix cxxreact module import (#525) 2025-02-06 15:19:39 -08:00
Marc RousavyandGitHub 6998588b70 chore: Rename BorrowingReference<T> -> WeakReference<T>, and OwningReference<T> -> BorrowingReference<T> (#523)
* chore: Rename `BorrowingReference<T>` -> `WeakReference<T>`, and `OwningReference<T>` -> `BorrowingReference<T>`

* chore: Remove unused flag

* chore: Lint

* fix: remove unnecessary nullptr compare
2025-02-03 18:30:04 +01:00
Marc RousavyandGitHub 1d6f8c30c8 perf: Make OwningReference/BorrowingReference only allocate memory block once and remove locking (#522)
* perf: Make `OwningReference`/`BorrowingReference` only allocate a large block once

* fix: Fix usage

* style

* fix: Docs

* perf: Remove mutex locking from reference types entirely!
2025-02-03 18:19:29 +01:00
Marc Rousavy 6308017e64 chore: release 0.22.0 2025-02-03 14:54:03 +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 33871840a9 feat: Create HybridView code generator base (#494)
* feat: Create `HybridView` Swift and Kotlin base

* fix: HybridView

* feat: Add `HybridView.ts` to nitrogen

* feat: Add necessary changes to nitrogen

* fix: Actually resolve type to find base types (HybridView -> HybridObject)

* feat: Generate TestView.nitro.ts 🎉

* fix: Fix hybrid view base accidentally

* fix: Pass `HybridData` to super

* fix: Finally fix `HybridView` recursion

* fix: Make `HybridView` the protocol's base instead

* Always inherit HybridObject

* run nitrogen

* feat: Create props file

* Name it component

* fix: Indent

* Add warn for RN 78 requirement

* move into `views`

* Create `.mm` file as well

* Add super.load

* fix: Fix namespace

* fix: indent

* fix it?

* Update NitroDefines.hpp

* fix: Make `/views/` private header

* Add filter func and some docs

* feat: More docs

* sort

* feat: Also create Android part

* feat: Implement actual prop parsing

* ah fix

* fix: Runtime type

* fix: Add `hashString(string_view)` equivalent

* fix: Add string_view and string overloads

* fix: indent shadownode

* whoops

* fix: Wrap in state

* comments

* fix: Fix throw when RN isnt present

* fix: Fix `Any?` type

* fix: Includes

* feat: Autolink it and implement it..?

* fix: Load native part of `NitroImage` in shared OnLoad.kt file

* fix: Actually add view-manager to Package

* fix: Rename to Hybrid* prefix

* fix: Use the `*OnLoad` init func now

* fix: Remove duplicate JNI registrations
2025-01-15 20:18:15 +01:00
Marc RousavyandGitHub b387586142 fix: Rename TypeInfo.hpp to NitroTypeInfo.hpp (#498)
* fix: Replace `TypeInfo.hpp` with `NitroTypeInfo.hpp`

* fix: Format

* Update NitroTypeInfo.hpp
2025-01-15 18:57:31 +01:00
Marc Rousavy 347fa02a7d chore: release 0.21.0 2025-01-09 19:44:01 +01:00
Marc Rousavy 72076b2b64 chore: release 0.20.1 2024-12-22 14:00:09 +01:00
Marc Rousavy c72e23de4a chore: release 0.20.0 2024-12-20 12:56:47 +01:00
Marc RousavyandGitHub 196fc9d0e0 perf: Mark all types that are used only in std::shared_ptr<T> as SWIFT_NONCOPYABLE (#435)
* fix: Mark all types that are used only in `std::shared_ptr<T>` as `SWIFT_UNSAFE_REFERENCE`

* Update AnyMap.hpp

* fix: Add `SWIFT_PRIVATE`

* fix: Use `SWIFT_NONCOPYABLE` instead!! THAT WORKS
2024-12-20 10:11:25 +01:00
Marc RousavyandGitHub e6928c060f test: Add test where a callback is called multiple times (#432)
* test: Add test where a callback is called multiple times

* chore: Format

* fix: Fix types (int double)

* fix: fix loops

* Update HybridTestObjectKotlin.kt

* fix: Fix apple's breaking change for type infos
2024-12-19 11:15:54 +01:00
Marc Rousavy 82ccff24bc chore: release 0.19.0 2024-12-18 16:59:06 +01:00
Marc Rousavy 10e24b0b3d chore: release 0.18.2 2024-12-05 15:03:56 +01:00
Marc RousavyandGitHub 04e73d8c1d feat: Add native NITRO_VERSION to C++ codebase and warn if it's out of sync (#398)
* feat: Add `NITRO_VERSION` to NitroDefines.hpp and update it post bump

* feat: Log warning if nitro versions don't match
2024-12-05 15:01:37 +01:00
Marc RousavyandGitHub 584e38b7c7 feat: Allow using Error as type (#376)
* feat: Allow using `Error` as type

* feat: Add `throwError(error)` func to test object

* feat: Test `throwError(error)`

* Update getTests.ts

* fix: Fix bridging `std::exception_ptr` to Swift `Error`

* fix: Fix `__rejecter` still using `std.exception_ptr`

* fix: Fix Java `JThrowable` conversion

* fix: Update error message

* fix: Fix `__ndk1` prefix on Android

* fix: Make `reject` just forward to `exception_ptr`
2024-11-29 15:57:22 +01:00
Marc RousavyandGitHub b069fb69a8 fix: Fix Promise rejections not having a message by using std::exception_ptr to avoid C++ object slicing (#369)
* fix: Use `std::exception_ptr` to preserve message

* fix: Catch exception

* fix: Fix `JSIConverter`

* Update AssertPromiseState.hpp

* Ok kinda fix?

* ugh

* fix again

* Update JSIConverter+Promise.hpp

* chore: Rename `_result` to `_state`

* feat: Allow comparing message

* fix: Fix `RuntimeError.description`

* feat: Test all of those error messages as well
2024-11-22 21:14:00 +01:00
Marc RousavyandGitHub 0747e099b7 fix: Fix ref counting with recursive mutex (#368)
* fix: Fix ref counting with recursive mutex

* Xcode
2024-11-22 19:42:38 +01:00
Marc RousavyandGitHub ed24de61f0 fix: Catch cases where a Promise<T> could potentially be rseolved twice (#362)
* fix: Catch cases where a `Promise<T>` could potentially be rseolved twice

* Update AssertPromiseState.hpp
2024-11-20 22:08:58 +01:00
Marc RousavyandGitHub 7afac07a83 fix: Fix NONNULL function pointers (#250)
* fix: Fix `NONNULL` function pointers

* Revert "fix: Fix `NONNULL` function pointers"

This reverts commit 5a3acb46d0.

* fix: Replace `NONNULL` with `_Nonnull` compiler keyword

* fix: Format
2024-10-22 11:52:03 +02:00
Marc RousavyandGitHub 6803be8cd9 fix: Add _Nonnull modifier to void* types for Swift (#231) 2024-10-15 20:39:45 +02:00
Marc RousavyandGitHub 2f24d281ad feat: Prettify Prototype names (#229)
* feat: Prettify Prototype names

* perf: Make it fast in release as well.

* Update TypeInfo.hpp

* fix: Remove unnecessary method now

* perf: Make namespace removal `::` faster

* Update TypeInfo.hpp
2024-10-15 19:48:34 +02:00
Marc Rousavy 89a5995dd9 fix: Explicitly check against NDEBUG on Android 2024-09-17 15:14:58 +02:00
Marc RousavyandGitHub 03e1a716cf fix: Fix NITRO_DEBUG debug/release preprocessor directive (#132)
* fix: Use `NITRO_DEBUG` flag to predictably run debug/release code

* feat: Add `NitroModules.buildType`

* fix: Style `debug` label
2024-09-16 16:18:05 +02:00
Marc RousavyandGitHub 661bea4cec feat: Add dispose() to HybridObject (and registerRawHybridMethod(...)) (#82)
* fix: Fix `SwiftClosure` not reading `void*` properly - use `Unmanaged<T>` again

* feat: Add a `dispose()` method to `HybridObject`

* feat: Split `registerRawHybridMethod` out of `registerHybridMethod`

* fix: Throw better error for when `NativeState` is nullptr

* Better debug info

* `FunctionType` -> `FunctionKind`

* fix: Either dynamically get name, or statically through typeinfo.
2024-08-29 16:51:11 +02:00
Marc RousavyandGitHub e7b9f412eb fix: Rewrite Logger to use platform NSLog / __android_log_print (#54)
* fix: Fix wrong include..?

* fix: Reimplement NitroLogger as a platform-specific logger

* fix: Copy args, and use proper tag

* fix: Fix sprintf crash because of wrong format argument

* fix: Fix Logger usage on iOS
2024-08-20 16:20:44 +02:00
Marc Rousavy f4ef4b7665 fix: Fix raw JSI functions and add test to example module 2024-08-20 12:13:55 +02:00
Marc RousavyandGitHub 065736dc2e feat: Base for Kotlin modules (#45)
* feat: Base for Kotlin modules

* fix: Properly make sure Nitro C++ is initialized

* Update JNIOnLoad.java

* feat: Set up `initHybrid()` in JHybridObject

* chore: Fix a bunch of linter issues

* fix: Fix fbjni codegen

* Update JHybridObject.hpp

* fix: Make `initHybrid()` JVM static

* feat: Make `mHybridData` private member of each in inheritance chain

* Generate specs

* feat: Set up proper inheritance graph in FBJNI using virtual inheritance `HybridObject` (#46)

* feat: Try to set up proper inheritance in FBJNI

* Virtual inheritance

* Update JHybridImageFactorySpec.cpp

* It works...

* feat: Virtual base

* Update HybridTestObject.hpp

* Update CMakeLists.txt

* Update JHybridObject.hpp

* Virtual dtor

* Dynamic cast to NativeState 🤔

* Virtual proper

* feat: Generate as virtual base?

* chore: Change to `updateNative`

* feat: Cannot default-construct HybridObject

* fix: Use `dynamic` pointer cast for `HybridContext` because `HybridObject` is now a virtual base

* Update README.md
2024-08-19 12:40:44 +02:00
Marc RousavyandGitHub 0dd63227d8 fix: Fix Swift umbrella header includes (#19)
* feat: Try bridge more Swift

* Make all Promises `async` in swift

* Rename `Promise` to `JSPromise`

* Update JSPromise.hpp

* Update JSICache.cpp

* fix import

* fix: Init props

* fix: Remove AnyMap and ArrayBuffer apis for now

* fix import

* no more async? idk

* feat: Convert `std::optional<T>` to `swift::Optional<T>`

* Remove all funcs except hello

* fix: Generate Swift Umbrella header

* fix: Organize

* fix: Hardcode forward-decl

* feat: Properly generate umbrella header from known types

* fix: Fix indentation

* order

* feat: Try bridging some primitives over...

* Update NitroDefines.hpp

* Update Property.ts

* fallthrough looks better

* better error

* fix: Fix wrong enum `maxLength`

* feat: Try `CarSwift` experiment

* Revert "feat: Try `CarSwift` experiment"

This reverts commit 7794f38271.
2024-08-12 14:18:13 +02:00
Marc RousavyandGitHub c101faf948 feat: Cache toObject(...) using jsi::WeakObject and correctly set externalExternalMemoryPressure (#13)
* feat: Cache `toObject(...)` using `jsi::WeakObject` and set `externalMemoryPressure` properly

* feat: Support caching different JSI types - strongly typed
2024-08-08 12:28:33 +02:00
Marc Rousavy 882054e587 feat: Support JSIConverter<AnyMap>::canConvert (+ AnyValue and unordered_map<string, T>) 2024-08-07 13:56:10 +02:00
Marc Rousavy 0b7e2b5561 fix: Fix JSICache<T> being recreated each time because of C++ template specialization 2024-08-06 01:37:08 +02:00