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

feat: allow tab bar customization #83

Merged
merged 3 commits into from
Feb 4, 2021

Conversation

tcorreiaubi
Copy link
Contributor

@tcorreiaubi tcorreiaubi commented Feb 1, 2021

Hey, this is based mostly on the approach that react-native-tab-view takes about styling their tab bar, the idea is to allow customization without having to refactor/copy the existent bar.

I had to increase the package version because of the following error coming from interpolateColor
software-mansion/react-native-reanimated#1401

Let me know if this changes make sense

Closes #82

@PedroBern
Copy link
Owner

hi @tcorreiaubi thanks for the PR, the changes do make sense. However, expo is officially supporting only rc.0. The rc.1 and rc2 have native code changes that expo didn't follow up yet.

So we need to avoid using intepolateColor for the moment 😞 .

You can keep it open and wait for official support or you can come up with a different solution (Probably interpolating the opacity as the current implementation).

@tcorreiaubi
Copy link
Contributor Author

tcorreiaubi commented Feb 1, 2021

@PedroBern I was actually just looking at it, the interpolateColor behavior ended up looking really not good as expected, I guess a simple condition rendering either 1 color or another will do it for the moment, I will update the pull request

@tcorreiaubi tcorreiaubi force-pushed the feat-tab-bar-customize branch from 6257047 to 40a071c Compare February 1, 2021 18:22
@tcorreiaubi
Copy link
Contributor Author

@PedroBern fixed, I'm also working in implementing a minimum collapsible header height, will make the pull request tomorrow.
And after that if I can get sometime to work on it, I will help on the testing, I believe it makes sense to we can easily add more functionality

@alexpchin
Copy link
Contributor

alexpchin commented Feb 1, 2021

@tcorreiaubi @PedroBern I was actually working on pretty much the same PR today... In my project, I have implemented intepolateColor (I'm not on expo) but then I realised also I needed a color value to pass to my focused custom TabItemComponent because I am using FontAwesome and custom badges for notifications. (FontAwesomeIcons do not work with react-native-reanimated. FortAwesome/react-native-fontawesome#53)

I finally solved it by using '@react-native-community/masked-view' with an animated background under the icon.

Copy link
Owner

@PedroBern PedroBern left a comment

Choose a reason for hiding this comment

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

Everything looks good, just some minor changes

Also, not sure why the yarn.lock changes, what's the difference?

src/MaterialTabBar/TabItem.tsx Outdated Show resolved Hide resolved
src/MaterialTabBar/TabItem.tsx Outdated Show resolved Hide resolved
@PedroBern
Copy link
Owner

I finally solved it by using '@react-native-community/masked-view' with an animated background under the icon.

@alexpchin clever solution.

@tcorreiaubi tcorreiaubi force-pushed the feat-tab-bar-customize branch from 40a071c to 5eb7708 Compare February 2, 2021 08:55
@tcorreiaubi
Copy link
Contributor Author

@PedroBern Fixed, I think it can be merged

@PedroBern
Copy link
Owner

@tcorreiaubi nice work 👍

Need to solve some conflicts, you can copy the example you wrote in the readme and add it as a docstring to the tabbar. Will need to remove the /* */ inside the children.

And delete the prop table, it will be auto-generated.

Then, run yarn docs

@tcorreiaubi tcorreiaubi force-pushed the feat-tab-bar-customize branch from 5eb7708 to f97527c Compare February 3, 2021 10:46
@tcorreiaubi
Copy link
Contributor Author

@PedroBern Done, let me know if something is missing

README.md Show resolved Hide resolved
@PedroBern PedroBern self-requested a review February 4, 2021 11:14
@PedroBern PedroBern merged commit fe4ac3c into PedroBern:main Feb 4, 2021
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.

TabBar Item Label style required
4 participants