Feature Request/Enhancement
Yoga allows us to override this method:
/*
* Measures the node (and node content, probably recursively) with
* given constrains and relying on possible layout.
* Default implementation returns zero size.
*/
virtual Size measureContent(const LayoutContext &layoutContext, const LayoutConstraints &layoutConstraints) const;
This requires you to also override ConcreteViewShadowNode::BaseTraits() and add these two traits:
react::ShadowNodeTraits HybridCameraViewNode::BaseTraits() {
auto traits = ConcreteViewShadowNode::BaseTraits();
traits.set(react::ShadowNodeTraits::LeafYogaNode);
traits.set(react::ShadowNodeTraits::MeasurableYogaNode);
return traits;
}
We can override this in Nitro, and implement it in a static Swift/Kotlin method that receives the props. Something like this:
class HybridCameraView: HybridCameraViewSpec {
// ...
static func measureContent(props: CameraProps,
layoutContext: LayoutContext,
layoutConstraints: LayoutConstraints) -> Size {
return Size(width: 100, height: 50)
}
}
Are there any existing workarounds?
Patching the generated files in Yoga and doing that yourself
Additional information
Feature Request/Enhancement
Yoga allows us to override this method:
This requires you to also override
ConcreteViewShadowNode::BaseTraits()and add these two traits:We can override this in Nitro, and implement it in a static Swift/Kotlin method that receives the props. Something like this:
Are there any existing workarounds?
Patching the generated files in Yoga and doing that yourself
Additional information