Skip to content

Added tooltip prop to ActionButton.Item #3

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Ajackster
Copy link

@Ajackster Ajackster commented Jan 30, 2017

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
Copy link
Owner

geremih commented Feb 5, 2017

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
Author

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

@@ -181,6 +181,9 @@ export default class ActionButton extends Component {

return (
React.Children.map(this.props.children, (button, index) => {
const length = this.props.children.length;
Copy link
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?

Copy link
Owner

@geremih geremih Feb 10, 2017

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
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

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
Copy link
Author

Ajackster commented Mar 22, 2017

@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

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

Screenshot

@Monte9
Copy link

Monte9 commented Jun 20, 2017

@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
Copy link

rknell commented Aug 3, 2017

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

Copy link

@rknell rknell left a comment

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
Copy link

Monte9 commented Aug 3, 2017

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

@rknell
Copy link

rknell commented Aug 3, 2017 via email

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