Skip to content

fix: React Native 0.83+ CRTP codegen compatibility#138

Open
yocontra wants to merge 1 commit intocallstackincubator:masterfrom
yocontra:fix/rn-083-crtp-codegen
Open

fix: React Native 0.83+ CRTP codegen compatibility#138
yocontra wants to merge 1 commit intocallstackincubator:masterfrom
yocontra:fix/rn-083-crtp-codegen

Conversation

@yocontra
Copy link
Copy Markdown

@yocontra yocontra commented Mar 7, 2026

Summary

  • React Native 0.83 switched TurboModule codegen from virtual inheritance to CRTP (Curiously Recurring Template Pattern). This updates the C++ native module to use the new base class NativePolygenCxxSpec<ReactNativePolygen> instead of NativePolygenCxxSpecJSI, and removes override keywords since CRTP uses static dispatch rather than virtual dispatch.
  • Adds the required page_size argument (65536) to wasm_rt_allocate_memory for wabt 1.0.39 compatibility.

Changes

ReactNativePolygen.h

  • Base class changed from NativePolygenCxxSpecJSI to NativePolygenCxxSpec<ReactNativePolygen>
  • Removed override keyword from all method declarations (CRTP uses static dispatch)

ReactNativePolygen.cpp

  • Constructor initializer updated from NativePolygenCxxSpecJSI to NativePolygenCxxSpec

WebAssembly/Memory.h

  • Added page_size argument (65536) to wasm_rt_allocate_memory call for wabt 1.0.39 API compatibility

Test plan

  • Build with React Native 0.83+ and verify TurboModule loads correctly
  • Verify WASM module instantiation and memory allocation still works
  • Confirm backward compatibility with older wabt versions

React Native 0.83 switched TurboModule codegen from virtual inheritance
to CRTP (Curiously Recurring Template Pattern). This changes the base
class from `NativePolygenCxxSpecJSI` to `NativePolygenCxxSpec<ReactNativePolygen>`
and removes `override` keywords from method declarations, since CRTP
uses static dispatch rather than virtual dispatch.

Also adds the required `page_size` argument (65536) to
`wasm_rt_allocate_memory` for wabt 1.0.39 compatibility.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant