Skip to content

Commit 66a5d10

Browse files
authored
Merge pull request #622 from Iterable/MOB-10608-indicator-is-showing-one-unread-message-when-inbox
[MOB-10608] indicator-is-showing-one-unread-message-when-inbox
2 parents daf6ae6 + 031690c commit 66a5d10

File tree

3 files changed

+4
-25
lines changed

3 files changed

+4
-25
lines changed

example/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,10 @@ There are two ways to fix this:
199199
sdk.dir=/path/to/Android/SDK # EG: sdk.dir=/Users/My.Name/Library/Android/sdk
200200
```
201201

202+
## Error: `bundler: failed to load command: pod`
203+
Run `bundle install` in the _example app directory_. You can also try running
204+
it in _ios_ in the _example app directory_.
205+
202206
## Other
203207
If things are not working and you are stumped as to why, try running the
204208
following in the _example app directory_:

example/src/components/App/App.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { createNativeStackNavigator } from '@react-navigation/native-stack';
2-
import { Iterable } from '@iterable/react-native-sdk';
32

43
import { Route } from '../../constants/routes';
54
import { useIterableApp } from '../../hooks/useIterableApp';
@@ -10,7 +9,6 @@ import type { RootStackParamList } from '../../types';
109
const Stack = createNativeStackNavigator<RootStackParamList>();
1110

1211
export const App = () => {
13-
console.log('Iterable.version', Iterable.getVersionFromPackageJson());
1412
const { isLoggedIn } = useIterableApp();
1513

1614
return (

example/src/components/App/Main.tsx

-23
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
2-
import { useState, useEffect } from 'react';
3-
4-
import { Iterable } from '@iterable/react-native-sdk';
52

63
import { colors, Route } from '../../constants';
74
import type { MainScreenParamList } from '../../types';
@@ -17,27 +14,10 @@ const Tab = createBottomTabNavigator<MainScreenParamList>();
1714
export 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) {

0 commit comments

Comments
 (0)