Skip to content

Unable to refresh badge count on tab icon #338

@tehong

Description

@tehong

Hi, Thanks for the excellent router, so far I preferred yours than the RN one. I've been trying to do a badge count on one of my tab icon. I'm passing the badgeCount in the following way:

<Schema name="tab" type="switch" icon={TabIcon} />

<Route name="feed" schema="tab" title="My Feed" initial={!global.isPerfTabOn} defaultRoute="feedScreen" selectedImageSrc={feedImageSrc_selected} unselectedImageSrc={feedImageSrc_unselected} badgeCount={this.state.badgeCount} navigationBarStyle={styles.header} titleStyle={styles.title} renderRightButton={() => this.renderRightButton()} renderBackButton={() => this.renderBackButton()} >

I can set the this.state.badgeCount to a > 0 value during the initial mount of the tab bar icon and that default badge count shows up within the TabIcon. However, when I tried to use setState({badgeCount: xxxx}) in my main component, the tab icon doesn't refresh the this.props.badgeCount and still had the old value for that route tab. How can I pass a prop to my TabIcon via the "route" tab besides initial mount of the TabIcon?

I basically want something like "this.props.selected" prop in the TabIcon. It looks like you're using the react-native-tabs to implement the tab bar, do I have to modify the your TabBar.js to do this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions