{"action":"created","issue":{"url":"https://api.github.com/repos/chirag04/react-native-tooltip/issues/16","repository_url":"https://api.github.com/repos/chirag04/react-native-tooltip","labels_url":"https://api.github.com/repos/chirag04/react-native-tooltip/issues/16/labels{/name}","comments_url":"https://api.github.com/repos/chirag04/react-native-tooltip/issues/16/comments","events_url":"https://api.github.com/repos/chirag04/react-native-tooltip/issues/16/events","html_url":"https://github.com/chirag04/react-native-tooltip/pull/16","id":159139767,"number":16,"title":"introduce a new method to show tooltip with coordinates","user":{"login":"Arthraim","id":133202,"avatar_url":"https://avatars.githubusercontent.com/u/133202?v=3","gravatar_id":"","url":"https://api.github.com/users/Arthraim","html_url":"https://github.com/Arthraim","followers_url":"https://api.github.com/users/Arthraim/followers","following_url":"https://api.github.com/users/Arthraim/following{/other_user}","gists_url":"https://api.github.com/users/Arthraim/gists{/gist_id}","starred_url":"https://api.github.com/users/Arthraim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Arthraim/subscriptions","organizations_url":"https://api.github.com/users/Arthraim/orgs","repos_url":"https://api.github.com/users/Arthraim/repos","events_url":"https://api.github.com/users/Arthraim/events{/privacy}","received_events_url":"https://api.github.com/users/Arthraim/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-06-08T11:20:19Z","updated_at":"2016-06-08T13:48:12Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/chirag04/react-native-tooltip/pulls/16","html_url":"https://github.com/chirag04/react-native-tooltip/pull/16","diff_url":"https://github.com/chirag04/react-native-tooltip/pull/16.diff","patch_url":"https://github.com/chirag04/react-native-tooltip/pull/16.patch"},"body":"Hi @chirag04 \r\n\r\nI'm facing a very tricky problem when I'm using tooltip with redux. I have to call `show` method during `componentDidUpdate` stage, but by the time, container view of tooltip would still be in the wrong position. So I add a method to put the container to right place before it gets rendered.\r\n\r\nMore specifically, I form my view like this\r\n```\r\n        <WebView>\r\n            <View pointerEvents=\"none\" style={ {\r\n                position: 'absolute',\r\n                top: this.props.targetPosition.clickY,\r\n                left: this.props.targetPosition.clickX,\r\n                width: 1,\r\n                height: 1,\r\n              } }>\r\n              <ToolTip\r\n                ref=\"theToolTip\"\r\n                actions={ this.props.toolTipActions }\r\n                underlayColor='transparent'\r\n                disabled={ true }\r\n                style={ styles.toolTip } />\r\n            </View>\r\n        </WebView>\r\n```\r\nSo the flow is, \r\n-> someone clicks `WebView`, it tells component where to show the tooltip \r\n-> reducer changes coordinates in states, also map to props\r\n-> `componentDidUpdate` state: WebView gets new coordinates, call `showMenu`\r\n-> re-render, apply the new coordinates to the `View`\r\n\r\nWhat's tricky is when it's in the stage of `componentDidUpdate`, `View` has not re-rended yet, so the tooltip shows from old coordinates. Also there's no callback to allow me to do anything (like calling `showMenu`) after view got re-rendered.\r\n\r\nSo I expose a new method here to show the tooltip with coordinate, called `showFromRect`, and I change the container to where it should be. Of course when app runs into render stage it will update the coordinate of the container again, but as long as we passed same coordinates before that, it will remain same position.\r\n\r\nMight be too specific, hope someone else would want this too :)"},"comment":{"url":"https://api.github.com/repos/chirag04/react-native-tooltip/issues/comments/224594001","html_url":"https://github.com/chirag04/react-native-tooltip/pull/16#issuecomment-224594001","issue_url":"https://api.github.com/repos/chirag04/react-native-tooltip/issues/16","id":224594001,"user":{"login":"Arthraim","id":133202,"avatar_url":"https://avatars.githubusercontent.com/u/133202?v=3","gravatar_id":"","url":"https://api.github.com/users/Arthraim","html_url":"https://github.com/Arthraim","followers_url":"https://api.github.com/users/Arthraim/followers","following_url":"https://api.github.com/users/Arthraim/following{/other_user}","gists_url":"https://api.github.com/users/Arthraim/gists{/gist_id}","starred_url":"https://api.github.com/users/Arthraim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Arthraim/subscriptions","organizations_url":"https://api.github.com/users/Arthraim/orgs","repos_url":"https://api.github.com/users/Arthraim/repos","events_url":"https://api.github.com/users/Arthraim/events{/privacy}","received_events_url":"https://api.github.com/users/Arthraim/received_events","type":"User","site_admin":false},"created_at":"2016-06-08T13:48:11Z","updated_at":"2016-06-08T13:48:11Z","body":"@chirag04 work a charm! never know I can access new ordinates in `onLayout`. Thanks for you help and patience. I think the PR could be closed as well."}}
{"actor":{"display_login":"Arthraim"}}