chore: fix init

This commit is contained in:
GleidsonDaniel 2024-02-20 17:57:48 -03:00
parent 8efb6a1b8c
commit f19b16072d
1 changed files with 6 additions and 7 deletions

View File

@ -1,5 +1,6 @@
import { useFocusEffect } from '@react-navigation/native';
import { StackNavigationProp } from '@react-navigation/stack';
import React, { useEffect } from 'react';
import React, { useCallback, useEffect } from 'react';
import { useDispatch } from 'react-redux';
import { initTroubleshootingNotification } from '../../actions/troubleshootingNotification';
@ -7,7 +8,6 @@ import * as List from '../../containers/List';
import SafeAreaView from '../../containers/SafeAreaView';
import StatusBar from '../../containers/StatusBar';
import I18n from '../../i18n';
import { useAppSelector } from '../../lib/hooks';
import { SettingsStackParamList } from '../../stacks/types';
import CommunityEditionPushQuota from './components/CommunityEditionPushQuota';
import DeviceNotificationSettings from './components/DeviceNotificationSettings';
@ -20,13 +20,12 @@ interface IPushTroubleshootViewProps {
const PushTroubleshootView = ({ navigation }: IPushTroubleshootViewProps): JSX.Element => {
const dispatch = useDispatch();
const foreground = useAppSelector(state => state.app.foreground);
useEffect(() => {
if (foreground) {
useFocusEffect(
useCallback(() => {
dispatch(initTroubleshootingNotification());
}
}, [dispatch, foreground]);
}, [])
);
useEffect(() => {
navigation.setOptions({