Skip to content

No way to access tether object to trigger a manual position() #174

Closed

Description

@jrmyio

There is currently no way for a Tooltip to trigger a manual "position()" to re-position the tooltip.

One way would be to add a ref on the tether object and make a function getTetherInstance on the Tooltip.

    getTetherInstance(){
        if (this.tetherContent && this.tetherContent._tether){
            return this.tetherContent._tether;
        }
        return null;
    }

    <TetherContent
         ref={(ref) => this.tetherContent = ref}
    >

What do you think?

Activity

  1. eddywashere commented on Oct 13, 2016

    @eddywashere
    Member

    👍 I think it's worth exposing the raw tether instance. It would also be good to have a convenience method for updating position (sounds common enough).

  2. added a commit that references this issue on Oct 17, 2016
    9e4b7f8
  3. TheSharpieOne commented on Oct 17, 2016

    @TheSharpieOne
    Member

    I don't believe it is possible to override the ref functionality allow it to return something else. A proposed solution is to add tetherRef... which is a ref to get the tether instance as created by TetherContent. Tooltip and Popover have also been extended to pass the prop along so you can use tetherRef on them to get access to the tether instance. This allows you to perform the position() call. Note, that much like the native ref functionality, tetherRef will be called both when an instance is created (providing the instance in the call), as well as when it is destroyed (passing null). Then means, you should perform a null check before trying to access it.

  4. added a commit that references this issue on Oct 18, 2016
    6be1a67
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions