Commit Graph
301 Commits
Author SHA1 Message Date
Marc Rousavy 312f8a2aed chore: release 0.26.0 2025-06-05 10:22:55 +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 Rousavy 02c7c75377 chore: release 0.25.2 2025-03-19 21:39:47 +09:00
Jacek PudyszandGitHub 94a702e480 fix: revert Object.freeze (#612) 2025-03-19 21:37:40 +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 RousavyandGitHub ca86d9d296 feat: Freeze objects in debug (#602) 2025-03-06 15:12:04 +01:00
Marc RousavyandGitHub 13e9977e9a fix: Make ArrayBuffer::copy(..) methods const (#596) 2025-03-03 16:12:11 +01:00
Marc RousavyandGitHub b9ce7462a3 fix: Add additional nullptr check to make_shared_from_jni function (#584)
* fix: Add additional nullptr check to `make_shared_from_jni` function

* fix: Allow move `&&` and forward

* Update JNISharedPtr.hpp

* fix: Add copy ctor

* fix: Avoid `emplace` if there can be duplicates

* Update JNISharedPtr.hpp

* fix: Don't call `release()` on global_ref!

* fix: Use `const &` to keep it lvalue

* Also check `cthis()`
2025-02-24 18:09:50 +01:00
Marc Rousavy 4733b4e4ea perf: Use .find(..) for cache lookups 2025-02-24 17:15:20 +01:00
Marc Rousavy a6a9472b5b chore: release 0.24.1 2025-02-24 17:05:11 +01:00
Marc RousavyandGitHub 995646890b chore: Remove deprecated Promise::addOnResolvedListenerCopy(…) (#576) 2025-02-24 15:42:47 +01:00
Marc RousavyandGitHub 7f54e269e9 chore: Remove deprecated ArrayBuffer::makeBuffer(...) (#575) 2025-02-24 15:42:39 +01:00
Marc RousavyandGitHub 43c959bb68 chore: Remove deprecated std::future<...> (#573) 2025-02-24 15:42:21 +01:00
Marc Rousavy 1361e29d81 chore: release 0.24.0 2025-02-24 15:42:03 +01:00
Marc RousavyandGitHub 2e579922bf fix: Fix implicit size_t conversion (#572) 2025-02-24 15:34:55 +01:00
Marc RousavyandGitHub 0c5e716ab1 fix: Fix a case where a nullptr BorrowingReference<T> could be accessed (#568)
* fix: Fix a case where a `nullptr` `BorrowingReference<T>` could be accessed

* Update HybridObjectPrototype.cpp

* chore: Replace `jsi::Runtime*` with `jsi::Runtime&` in `JSArrayBuffer`

* Update ArrayBuffer.cpp
2025-02-23 17:16:50 +01:00
Marc Rousavy 4aabce671e chore: Ignore warning for Android error workaround 2025-02-23 17:16:35 +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 5e063414fc chore: Disable -Wexceptions warning on Android specific block (#549) 2025-02-19 21:01:49 +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
Tommy NguyenandGitHub bff32c0755 fix: Fix crash when no modules are registered (#536) 2025-02-12 12:30:56 -08:00
Marc Rousavy 892799e8ef chore: Simpler 2025-02-12 12:24:56 -08:00
Marc Rousavy 48b17d148e Revert "fix: Generate @JvmName prop for Kotlin methods (#534)"
This reverts commit 897b5c6f8c.
2025-02-12 12:24:17 -08:00
Marc RousavyandGitHub 897b5c6f8c fix: Generate @JvmName prop for Kotlin methods (#534)
* fix: Generate `@JvmName` prop for Kotlin methods

* fix: Promise

* Update Promise.hpp

* ignore jvmname annotation bug

* fix: Move it down
2025-02-10 14:07:00 -08: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 d8d08e09eb chore: Some renames (#524) 2025-02-03 18:48:21 +01: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 d62dbfbed8 feat: Update memorySize when a HybridObject makes a round-trip (#510)
* feat: Update `memorySize` when a HybridObject makes a round-trip

* feat: Add `NitroModules.updateMemorySize(..)` to imperatively update mem size

* feat: Add test for `NitroModules.updateMemorySize`

* feat: Add some more tests for `NitroModules.*`

* feat: Add even more tests

* fix: Use `jsi::Object`

* fix: use `getObject`

* fix: Register `updateMemorySize()`

* Update HybridNitroModulesProxy.cpp
2025-01-22 15:00:01 +01:00
Marc RousavyandGitHub 98575fd5d2 fix: Log all hybrid object names as joined string to help user (#508)
* fix: Log all hybrid object names as joined string to help user

* fix: Avoid `std::string` call

* fix: Include

* Rename something

* perf: even more
2025-01-22 14:59:51 +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 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 Rousavy 347fa02a7d chore: release 0.21.0 2025-01-09 19:44:01 +01:00
Marc RousavyandGitHub a06c7d44af feat: Add new ArrayBuffer APIs (copy(), wrap(), allocate(), toData()) (#463)
* feat: Add `ArrayBuffer::copyBuffer(..)` API

* feat: Add `wrap` API for Kotlin

* feat: Add `ArrayBuffer.copy(data:)`

* perf: Copy Data a bit more effectively

* fix: Rename a bunch of things

* docs: Add creating docs

* feat: Add `ArrayBufferHolder.toData()`

* feat: Add `ArrayBuffer::copy(std::vector&)`

* perf: Change type of `.data` to `uint8_t*` to avoid upcast

* feat: Add `copyIfNeeded` flag

* Update array-buffers.md
2025-01-07 16:35:59 +01:00
Marc Rousavy 72076b2b64 chore: release 0.20.1 2024-12-22 14:00:09 +01:00
Marc RousavyandGitHub f21c79a1b4 perf: Make JS callbacks lock-free (#446) 2024-12-22 13:53:30 +01:00
Marc RousavyandGitHub 2ebff1b4a5 fix: Reject Promise with timeout if it gets destroyed (#444)
* fix: Reject Promise with timeout if it gets destroyed

If a Promise gets destroyed without ever being resolved or rejected, it goes stale.

This PR fixes this and rejects a Promise with a timeout error if it gets destructed and is still pending

* Add promise typename

* Reject swift promise as well

* Update Promise.hpp

* fix: Build

* Update Dispatcher.cpp

* fix: Also reject `JPromise` if it gets destroyed
2024-12-22 13:53:24 +01:00
Marc RousavyandGitHub 67ee05dc52 chore: Remove unused arg names (#443)
* chore: Remove unused arg names

* More

* chore: Even more

* rename _
2024-12-20 16:00:37 +01:00
Marc Rousavy c72e23de4a chore: release 0.20.0 2024-12-20 12:56:47 +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