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
* 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
_tasks is a std::queue (backed by std::deque), not thread-safe.
Reading empty() outside the lock while worker threads call pop() and
run() itself calls push() is an unsynchronized access — a data race
caught by TSan. Move the check inside the existing lock scope and call
addThread() after releasing (since addThread() also takes _queueMutex).
Co-authored-by: Miklós Fazekas <boga@MBPM5P.local>
Co-authored-by: Marc Rousavy <me@mrousavy.com>
* fix(core): synchronize C++ `Promise<T>` state-inspection accessors
`resolve()`/`reject()` write `_state` under `_mutex`, but `isPending`/
`isResolved`/`isRejected`/`getResult`/`getError` read it lock-free.
`JSIConverter<shared_ptr<Promise<T>>>::toJSI` runs those reads on the JS thread
the instant a hybrid method returns, racing an off-JS-thread `resolve()`
(`Promise::async` / `Promise.parallel` / a main-thread resolve). Data race on the
`std::variant _state`, flagged by ThreadSanitizer.
Make `_mutex` mutable and acquire it in the inspection accessors. The lock-free
bodies move to private overloads that take a `unique_lock` (the caller proves it
holds the lock), so `getResult()`/`isPending()`-style call sites stay intact
without recursive self-locking. `resolve`/`reject` set the state and drain the
listeners under a single lock via `takeResolvedListeners(lock)`/
`takeRejectedListeners(lock)`, then fire them outside the lock; the `NITRO_DEBUG`
state assert runs just before the lock. Same treatment for `Promise<void>`.
* refactor(core): address review feedback on Promise synchronization
- Remove takeResolvedListenersAndClearAllListeners / takeRejectedListenersAndClearAllListeners helpers; inline as std::move + clearAllListeners
- Restore readable if/else structure in addOnXxxListener, using lock.unlock() before invoking the callback instead of nested RAII blocks with early returns
- Capture result pointer inside the lock in resolve() to avoid a second lock acquisition
* refactor(core): drop listeners outside lock by moving instead of clearing
* Update packages/react-native-nitro-modules/cpp/core/Promise.hpp
Co-authored-by: Marc Rousavy <me@mrousavy.com>
* refactor(core): remove redundant inline comments from listener methods
* fix(core): fix rebase artifact in resolve(const TResult&) — remove duplicate declaration and stale clearAllListeners
* refactor(core): remove remaining inline comment from addOnRejectedListener
* refactor(core): restore inline comments in addOnXxxListener per reviewer
---------
Co-authored-by: Miklós Fazekas <boga@MBPM5P.local>
Co-authored-by: Marc Rousavy <me@mrousavy.com>
* fix: Rename `initialize()` to `registerNatives()` to be more aligned with fbjni
* Add `fbjni` include
* Mark `initialize()` as deprecated
* rename `registerNatives()` to `registerAllNatives()`