I want to change tab bar icon when getting notifications.
* */
this.messageListener = firebase.messaging().onMessage(async message => {
//process data message
console.log(JSON.stringify(message));
const isNewActivyty = await AsyncStorage.setItem('isNewActivity', 'true');
});
this is my onMessage code.
When I get any message, I want to change tab bar icon. Such as instagram notification.
As you can see above, I was trying to use AsyncStorge to store this information but it seemed not working.
Feed: {
screen: Feed,
navigationOptions: {
tabBarIcon: ({tintColor}) => <FeedIcon color={tintColor} />,
tabBarOnPress: async props => {
await props.defaultHandler();
},
title: I18n.t('feed'),
},
},
Activity: {
screen: Activity,
navigationOptions: {
tabBarIcon: ({tintColor, focused}) => (
<ActivityIcon color={tintColor} />
),
tabBarOnPress: async props => {
await props.defaultHandler();
},
title: I18n.t('activity'),
},
},
Above code this my createBottomTabNavigator.
How can I change that tabBarIcon dynamically?
Thanks!