diff --git a/src/App.tsx b/src/App.tsx index a66e53d6..da2b1ff6 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -40,17 +40,15 @@ const App: React.FC = () => { log('log', 'App', 'rendering App') const [localCorrupt, setLocalCorrupt] = useState() + const appStateEffect = useCallback(() => { + Notifications.setBadgeCountAsync(0) + Notifications.dismissAllNotificationsAsync() + }, []) useEffect(() => { - AppState.addEventListener('change', () => { - Notifications.setBadgeCountAsync(0) - Notifications.dismissAllNotificationsAsync() - }) + AppState.addEventListener('change', appStateEffect) return () => { - AppState.removeEventListener('change', () => { - Notifications.setBadgeCountAsync(0) - Notifications.dismissAllNotificationsAsync() - }) + AppState.removeEventListener('change', appStateEffect) } }, []) diff --git a/src/screens/Tabs/Me/Push.tsx b/src/screens/Tabs/Me/Push.tsx index a421b74f..7ccd53c9 100644 --- a/src/screens/Tabs/Me/Push.tsx +++ b/src/screens/Tabs/Me/Push.tsx @@ -30,9 +30,9 @@ const ScreenMeSettingsPush: React.FC = () => { } useEffect(() => { checkPush() - AppState.addEventListener('change', () => checkPush()) + AppState.addEventListener('change', checkPush) return () => { - AppState.removeEventListener('change', () => checkPush()) + AppState.removeEventListener('change', checkPush) } }, []) diff --git a/src/screens/Tabs/Shared/Account/Information/Stats.tsx b/src/screens/Tabs/Shared/Account/Information/Stats.tsx index 8ad58f01..504c3fb1 100644 --- a/src/screens/Tabs/Shared/Account/Information/Stats.tsx +++ b/src/screens/Tabs/Shared/Account/Information/Stats.tsx @@ -26,7 +26,7 @@ const AccountInformationStats: React.FC = ({ account, myInfo }) => { { analytics('account_stats_toots_press', { @@ -48,7 +48,7 @@ const AccountInformationStats: React.FC = ({ account, myInfo }) => { { analytics('account_stats_following_press', {