Last active
April 19, 2017 16:34
-
-
Save damon-kreft/bef8a1593428b513d01865ca2b4d951d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import ReactDOM from 'react-dom'; | |
let instance = null; | |
export const getTop = () => { | |
return instance.getTop(); | |
} | |
export default class InjectPoint { | |
constructor() { | |
super(); | |
instance = this; | |
} | |
render() { | |
return <div ref="inject">{this.props.children}</div>; | |
} | |
getTop() { | |
const domElement = ReactDOM.findDOMNode(this.refs.inject); | |
return domElement.sammink // cant remember how to get the position of a DOM element | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment