Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jrmyio opened this issue Oct 13, 2016 · 2 comments · Fixed by #184
Closed

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

jrmyio opened this issue Oct 13, 2016 · 2 comments · Fixed by #184

Comments

@jrmyio
Copy link

jrmyio commented Oct 13, 2016

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?

@eddywashere
Copy link
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).

TheSharpieOne added a commit to TheSharpieOne/reactstrap that referenced this issue Oct 17, 2016
Fixes reactstrap#174
Add `tetherRef` to TetherContent which works similarly to `ref`
@TheSharpieOne
Copy link
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.

eddywashere pushed a commit that referenced this issue Oct 18, 2016
* feat(tether): add ability to get tether ref

Fixes #174
Add `tetherRef` to TetherContent which works similarly to `ref`

* pass additional props to the inner div
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants