React-native-router-flux: Support `showIcon` property for Scene Tabs

Created on 19 Feb 2018  路  2Comments  路  Source: aksonov/react-native-router-flux

__EDIT:__ Turns out applying the showIcon prop works for me with the underlying version of react-navigation that I have, I'm not sure what was going on with this before but I can't reproduce now so I'm going to close.

Version

  • react-native-router-flux v4.0.0-beta25
  • react-native v0.51

Expected behaviour

showIcon property should exist for tabbed scenes, just like showLabel does. React Navigation supports this feature: (see code here).

I think this might just be a matter of passing through the showIcon prop (I'm not sure if it only passes through some whitelisted properties from <Scene> to the underlying React Navigation calls)

If you leave icon as it's default (undefined) it will still inherit the icon props from any parent scene (in my case I have nested <Tabs>). If you create a 'no-op' component (() => null) to use as the icon it will still render the container for the icon which effects the container size and label positioning. So in order to have icon-less tabs we'd need this feature supported.

All 2 comments

My hunch is that we just need to let showIcon pass through to the createTabBarOptions() function in navigationStore.js

See here: https://github.com/aksonov/react-native-router-flux/blob/master/src/navigationStore.js#L110

I will see if this works and put together a PR if so.

The showIcon prop on the TabBar component is only supported in newer versions of react navigation. Currently in router flux there is no way to hide the icons (that I can find at least). I've tried using a 'null component' (() => null) or undefined as my icon prop, but all of the padding and containers are still added which still leaves an empty space where the icon would be (it still renders the <TabBarIcon> component).

My workaround for now is to copy TabBarBottom from the latest release of react-navigation and use it as a custom component.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

llgoer picture llgoer  路  3Comments

wootwoot1234 picture wootwoot1234  路  3Comments

sarovin picture sarovin  路  3Comments

vinayr picture vinayr  路  3Comments

jgibbons picture jgibbons  路  3Comments