Answer the question
In order to leave comments, you need to log in
How to set badge count in react-navigation?
I decided to add a badge for the icon in the bottom-navigation.
Found the right module installed. Everything is working.
Such question as to me now to transfer value to it?
In my case, I have a rest that works as soon as you enter the application.
How do I pass data.length to it?
The code is like this :
App.js <- Here I have a StackNavigator
Alarm: {
screen: Alarm,
navigationOptions: { tabBarIcon: AlarmTabIcon }
},
const AlarmTabIcon = ({ tintColor }) => (
<View
style={{
flexDirection: "row",
alignItems: "center",
justifyContent: "center"
}}
>
<IconBadge
MainElement={<Ionicons name="ios-alert" size={26} color={tintColor} />}
BadgeElement={
<Text style={{ color: "#FFFFFF", fontSize: 8 }}>
{ Сюда нужно передавать значение }
</Text>
}
IconBadgeStyle={{ width: 14, height: 14, backgroundColor: "#4B1E70" }}
/>
</View>
);
Answer the question
In order to leave comments, you need to log in
I did this: I downloaded info on badges, wrote them to the store (redux), then each component of the icon connected to the store and got the data from there.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question