This repository has been archived in favour of official solution. Thanks to great efforts from the core team this temporary repository is no longer necessary.
Probably you will not need this template, since fabric is responsible for whole synchronous measurements under the hood. But in some cases, your native component would like to update its frames in synchronous way. Right now, codegen does not support generating a new state based on typescript implementation, hence custom state implementation must be added manually. Linking custom cpp can be tricky, so together with @cortinico we prepared a showcase, so you can reuse this approach in your library. This example has been built on top of bob-builder
More context you can find here
- run codegen
./gradlew generateCodegenArtifactsFromSchema
in android folder - copy everything under
build/generated/source/codegen/jni/react/renderer/components/yourlib
into cpp folder - pass
interfaceOnly
flag - run codegen once again
- implement cpp state
Here you can see how to make it:
link. Instead of AndroidMkPath
, please add CMakePath
to react-native.config.js
Replace s.source_files = "ios/**/*.{h,m,mm}"
with s.source_files = "ios/**/*.{h,m,mm}", "cpp/**/*.{h,cpp}"
inside yourLib.podspec
file and change imports inside .mm
file