React-native-navigation: [ENHANCEMENT] Support custom components for Bottom Tabs

Created on 31 Aug 2020  路  11Comments  路  Source: wix/react-native-navigation

Problem

Currently the BottomTabs TabBar can only render Icons and Text (labels) which are rendered using the native TabBar implementations. If I wanted to implement something like this:

or this:

It would simply not be possible. A very wacky workaround would be to create an overlay the same time the bottom tabs are rendered, which is exactly positioned over the bottom Tabs. This has many issues though:

  • Requires a lot of code (especially to manage appearance/disappearance in root replacements, bottomTabs visibility changes, e.g.)
  • Doesn't work with Modals (goes above)
  • Has issues with transparency (shadows, button pressed animations such as scale, opacity, ..)
  • Doesn't work with bottom tabs animations (e.g. visible -> not visible slide animation)

Solution

A clean solution would be a component prop in the bottomTab API.

Example usage:

bottomTab: {
    component: () => <MyAddButton/>,
},

or

bottomTab: {
    component: {
        name: 'MyAddButton'
    },
},
acceptediscussion

Most helpful comment

This is not stale

All 11 comments

I wonder if thats compatible with the motto of rnn to use native components for navigation. Maybe it would be better allowing users to override any native rnn components with their own instead of adding solutions that don't exist in the native framework.

@danilobuerger Well the topBar also supports adding custom components via overlays which work pretty well with animations, I'd imagine the bottomTab to support the same. I'm not sure if stuff that overflows causes any issues tho 馃

I mean a good start would be to at least implement events for bottomTabShow and bottomTabsHide to enable implementing an overlay yourself. We have the same design challenge and solving it would have been much easier when these events would be available to trigger synchronised appearance and disappearance with bottom tabs of custom overlays.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest version and report back. Thank you for your contributions.

This is not stale

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest version and report back. Thank you for your contributions.

This is not stale
and we all waiting for this

@stereodenis instead of waiting you could implement it and submit a PR?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest version and report back. Thank you for your contributions.

this is not stale

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tiennguyen9988 picture tiennguyen9988  路  31Comments

perrosnk picture perrosnk  路  36Comments

diennguyentien picture diennguyentien  路  59Comments

Stalder picture Stalder  路  35Comments

maurovisintin picture maurovisintin  路  101Comments