File tree Expand file tree Collapse file tree 1 file changed +0
-23
lines changed
example/src/components/App Expand file tree Collapse file tree 1 file changed +0
-23
lines changed Original file line number Diff line number Diff line change 11import { createBottomTabNavigator } from '@react-navigation/bottom-tabs' ;
2- import { useState , useEffect } from 'react' ;
3-
4- import { Iterable } from '@iterable/react-native-sdk' ;
52
63import { colors , Route } from '../../constants' ;
74import type { MainScreenParamList } from '../../types' ;
@@ -17,27 +14,10 @@ const Tab = createBottomTabNavigator<MainScreenParamList>();
1714export const Main = ( ) => {
1815 const {
1916 isInboxTab,
20- isLoggedIn,
21- loginInProgress,
2217 returnToInboxTrigger,
2318 setIsInboxTab,
2419 setReturnToInboxTrigger,
25- userId,
2620 } = useIterableApp ( ) ;
27- const [ unreadMessageCount , setUnreadMessageCount ] = useState < number > ( 0 ) ;
28-
29- useEffect ( ( ) => {
30- if ( loginInProgress ) return ;
31- if ( isLoggedIn ) {
32- Iterable . inAppManager
33- . getMessages ( )
34- . then ( ( messages ) => setUnreadMessageCount ( messages . length ) )
35- . catch ( ( error ) => console . error ( 'Failed to get messages:' , error ) ) ;
36- } else {
37- // Reset unread message count when user logs out
38- setUnreadMessageCount ( 0 ) ;
39- }
40- } , [ isLoggedIn , loginInProgress , userId ] ) ;
4121
4222 return (
4323 < >
@@ -55,9 +35,6 @@ export const Main = () => {
5535 < Tab . Screen
5636 name = { Route . Inbox }
5737 component = { Inbox }
58- options = {
59- unreadMessageCount ? { tabBarBadge : unreadMessageCount } : { }
60- }
6138 listeners = { ( ) => ( {
6239 tabPress : ( ) => {
6340 if ( isInboxTab ) {
You can’t perform that action at this time.
0 commit comments