Skip to content

How to use useRef #9

Open
Open

Description

@Bryant-Anjos

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

Activity

  1. MoOx commented on Oct 15, 2021

    @MoOx
    Member

    ref={inputRef->Ref.value}

  2. Bryant-Anjos commented on Nov 20, 2021

    @Bryant-Anjos
    Author

    I've try it but still doesn't work. 😢

    image

  3. MoOx commented on Dec 6, 2021

    @MoOx
    Member

    Maybe paper bindings are not up to date? poke @DCKT

  4. reopened this on Dec 6, 2021
  5. Bryant-Anjos commented on Dec 7, 2021

    @Bryant-Anjos
    Author

    @MoOx I was using the latest version of rescript-react-native/paper

  6. MoOx commented on Dec 8, 2021

    @MoOx
    Member

    I was assuming that the bindings are not up to date with rescript-react-native, not that you were not using the correct version.

  7. MoOx commented on May 27, 2022

    @MoOx
    Member

    @kevin-klein can you help here as you are a user of this bindings ? Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions