Commit Graph
69 Commits
Author SHA1 Message Date
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
Marc Rousavy 87eae31207 feat: Move to templates 2024-08-02 21:45:48 +02:00
Marc Rousavy a522f09327 fix: Put template<...> on a separate line 2024-08-02 12:37:03 +02:00
Marc Rousavy 1ca53519c5 chore: Format code 2024-08-02 00:10:17 +02:00
Marc Rousavy c66064aa1f fix: Use atomic_size_t to prevent race conditions in OwningReference 2024-08-01 17:13:09 +02:00
Marc Rousavy ee41df2d99 fix: lock _mutex when lock()ing or comparing OwningReference 2024-08-01 17:09:28 +02:00
Marc Rousavy 50507b693a fix: Fix imports 2024-07-31 17:41:25 +02:00
Marc Rousavy 9d69ba04ab chore: Run clang format 2024-07-31 17:39:56 +02:00
Marc Rousavy a104481e11 feat: Prettify a few edge cases in getFriendlyTypename() :) 2024-07-31 17:29:03 +02:00
Marc Rousavy f0844b047f feat: Properly check variant type at runtime 2024-07-31 17:19:39 +02:00
Marc Rousavy 404b125b8f fix: Kinda builds? 2024-07-30 13:31:22 +02:00
Marc Rousavy 3e0279a71f feat: Create JSICacheReference for safer cache access 2024-07-30 11:41:01 +02:00
Marc Rousavy 45d5342b92 feat: Use OwningLock<T> in function callbacks 2024-07-30 11:10:38 +02:00
Marc Rousavy fc4eb15a4e feat: Create OwningLock to lock mutex 2024-07-30 10:50:47 +02:00
Marc Rousavy 705efdc717 fix: Throw mutex on all pointer operations 2024-07-30 10:50:21 +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 a0c7caa2a8 fix: Properly get memory size including own cache map size 2024-07-23 01:34:44 +02:00
Marc Rousavy 4257dedf64 Fix TYPEID 2024-07-22 16:31:33 +02:00
Marc Rousavy 5efd374115 Clean up ios 2024-07-18 14:18:42 +02:00
Marc Rousavy 6b15467af8 Some final declarations 2024-07-18 01:30:33 +02:00
Marc Rousavy 88d286450c Update OwningReference.hpp 2024-07-18 01:28:08 +02:00
Marc Rousavy 803c7bfbf9 feat: Implement == for OwningReference 2024-07-18 01:25:37 +02:00