How to access the RIVE component layout data(e.g width, height) in ReactNative runtime.

Background

I’m using RIVE ReactNative runtime in my App, and I’m using data bind for read / write to control the satemachine in RN runtime. At a high-level, my RIVE file is a 400×700 artboard with some grahic component within it.


Problem

In my RN App, I was trying to get the layouts (x, y, width and height) of one component (a simple rectangle), since I want to use the coordinates , so that in my App I can create an overlay that matches the size of the rectangle size in RIVE to implement some functionality.

Things I tried
Initially, I tried create databind to bind the target rectangle’s computed transform (relative to artboard) and path property, and access them in RN, however, I noticed these properties are still the same value as it’s in the Editor, despite being rendered in a wider 440 × 900 view.

Then I thought this might because the RIVE is scaling the graphics automatically based on the view size (I have set it to Fit.FitWidth). Hence, I went to calculate the scale factor by 440 (view size, where RIVE is FitWIdth) / 400 (original artboard size). And then apply it to the rectangular layouts read from databind. However, the result is still very off, which seems to suggest the way I was trying to derive the layout in view from RIVE data is wrong. I have also tried to bind the artboard’s size and x&y, but when I read it in RN runtime, it’s fixed 400×700, regardless how I change the FIT value.

Question

Basically I wanted to check if there’s way to get the target rect’s (or any rive component) layouts in the view space when it’s rendered as RN component.

  • Is there an API that’s exposing this data in Runtime or there’s property that I can use databind to expose?

  • If not directly, is there a way to derive how the graphics are scaled in terms of x/y axis, so I can use that to calculate the space based on the data bind values?

  • Is there other way to get the layouts for RIVE components when its being rendered in RN?

I have tried look up the layouts tutorials and searched online, but couldn’t find any lead yet, any help would be appreciated!