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