Binding to a react component that uses react refs and using the ref


#1

Hey all,

I’m trying to access a ref in a library that I’m binding to and am struggling to understand how to grab ahold of it.

I want to use this: https://github.com/sbycrosz/react-native-credit-card-input#setvalues

I think I’m stuck because I don’t understand the proper way to write a binding to ref prop?

EDIT: Posted this too soon, figured it out!


#2

Do you want to share how you did it? :slight_smile:


#3

Yeah, I actually just followed https://reasonml.github.io/reason-react/docs/en/react-ref but had to make sure to bind the ref prop to be of type

Js.nullable(ReasonReact.reactRef) => ref(Js.nullable(ReasonReact.reactRef))