paper icon indicating copy to clipboard operation
paper copied to clipboard

How to use useRef

Open Bryant-Anjos opened this issue 3 years ago • 6 comments

The problem

When trying using useRef in a Paper.TextInput the rescript throws This has type: React.ref<Js.Nullable.t<'a>> Somewhere wanted: Js.Nullable.t<'b> => unit

How to reproduce

Steps to reproduce:

  1. Define a ref with useRef:
let inputRef = React.useRef(Js.Nullable.null)
  1. Use the ref in a TextInput component:
<Paper.TextInput
  ref=inputRef
  mode=#outlined
/>

Expected behavior

Expect to compiler compile to use the ref

Actual behavior

The compiler throws: This has type: React.ref<Js.Nullable.t<'a>> Somewhere wanted: Js.Nullable.t<'b> => unit

image

Environment

PopOS 20.04 expo 40.0 react 17.0.1 react native 0.63.4 rescript 9.1.4 rescript-react-native 0.64.3 react-native-paper 4.4.1 @rescript-react-native/paper 3.0.6

Bryant-Anjos avatar Oct 15 '21 13:10 Bryant-Anjos