package com.blaze.rtnblazesdk.base import com.facebook.react.uimanager.LayoutShadowNode import com.facebook.yoga.YogaMeasureFunction import com.facebook.yoga.YogaMeasureMode import com.facebook.yoga.YogaMeasureOutput import com.facebook.yoga.YogaNode class BlazeWidgetViewShadowNode : LayoutShadowNode(), YogaMeasureFunction { private var measuredHeight = 0 override fun setLocalData(data: Any?) { super.setLocalData(data) val newHeight = data as Int //only height data is expected here if (newHeight == measuredHeight) return // We bail out if it hasn't changed. measuredHeight = newHeight dirty() //trigger shadow node measuring pass below } override fun measure( node: YogaNode?, width: Float, widthMode: YogaMeasureMode?, height: Float, heightMode: YogaMeasureMode? ): Long { return YogaMeasureOutput.make(0, measuredHeight) } init { setMeasureFunction(this) } }