Skip to content

Added tooltip prop to ActionButton.Item#3

Open
Ajackster wants to merge 2 commits into
geremih:masterfrom
Ajackster:AddTooltip
Open

Added tooltip prop to ActionButton.Item#3
Ajackster wants to merge 2 commits into
geremih:masterfrom
Ajackster:AddTooltip

Conversation

@Ajackster

@Ajackster Ajackster commented Jan 30, 2017

Copy link
Copy Markdown

This pull request adds tooltips to the ActionButtonItem component. It calculates the position of each action button and either places it to the left, right or on top of the action button item.

Here are pictures of what the tooltip looks like with an even and odd set of ActionButtonItems.

screen shot 2017-01-30 at 1 50 27 pm

screen shot 2017-01-30 at 1 50 04 pm

@geremih Would you be interested in adding this to your project?

@geremih

geremih commented Feb 5, 2017

Copy link
Copy Markdown
Owner

Thanks @Ajackster! I have added some comments to be addressed before I can merge. Also, can you document your change in the Readme?

@Ajackster

Copy link
Copy Markdown
Author

Hey @geremih I'm not sure what comments you are talking about. Happy to fix or improve anything though!

Comment thread ActionButton.js

return (
React.Children.map(this.props.children, (button, index) => {
const length = this.props.children.length;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is also a position prop for ActionButton. Shouldn't this also cover the case in which the button is aligned to either of the sides?

@geremih geremih Feb 10, 2017

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ajackster that's what I meant. So if the button is positioned to the right, no button item should have the tooltip to the left side,? So in that case, one way to do that would be const middle = (index == length -1) and the rest are aligned to the right. I saw that in the new screenshot you posted, all tooltips are at the top of the button item. Is that something you would prefer using, instead of aligning the tooltip with respect to the index?

@Ajackster

Copy link
Copy Markdown
Author

@geremih Hm I'm not too sure what the position prop actually does. I tried passing it down to the action button items and wasn't seeing the same result. I think the position prop is actually used for the placement of the actual ActionButton component, not necessarily the placement of the ActionButtonItems.

position="center"

screen shot 2017-02-09 at 9 05 03 pm

position="left"

screen shot 2017-02-09 at 9 05 42 pm

@joncursi

Copy link
Copy Markdown

Would love to see this added. However, I think the tooltip text will also need a tooltipStyle prop to go with it to style the backdrop of the text and the text color. Or allow the user to supply a custom component rather than limiting them to a string.

@Ajackster

Ajackster commented Mar 22, 2017

Copy link
Copy Markdown
Author

@AbhishekBiswal Haven't had the time to finish this yet, I've been very busy. I plan to finish this very soon.

@AbhishekBiswal

Copy link
Copy Markdown

@Ajackster any work-in-progress branch I can pull this from? I'm trying to implement this:

Screenshot

@Monte9

Monte9 commented Jun 20, 2017

Copy link
Copy Markdown

@Ajackster I tried this PR out and I have some feedback if you don't mind.

  1. For some weird reason, the tooltip doesn't show up on Android. Any idea why?
  2. The tooltips don't align properly when you right position the ActionButton. See attached screenshot.

screen shot 2017-06-19 at 9 41 20 pm

@rknell

rknell commented Aug 3, 2017

Copy link
Copy Markdown

I think the key might be to place it up slightly higher than the button rather than the middle. This is what the My fitness Pal app does:

screenshot_20170803-164036

@rknell rknell left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately doesn't work for right alignment:
simulator screen shot 3 aug 2017 8 15 56 pm

Plus there is a weird issue on email as pictured

Good work, just not ready for production. Looking at the My Fitness Pal screenshot above I wouldn't be surprised if they were using this project!

@Monte9

Monte9 commented Aug 3, 2017

Copy link
Copy Markdown

@rknell do you know if my fitness pal is written in React Native?

@rknell

rknell commented Aug 3, 2017 via email

Copy link
Copy Markdown

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants