Fixing useNavigation typescript warning.
This commit is contained in:
@@ -1,19 +1,20 @@
|
|||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { useNavigation } from '@react-navigation/native';
|
import { useNavigation, NavigationProp } from '@react-navigation/native';
|
||||||
import { useVoiceClient } from '../context/VoiceClientContext';
|
import { useVoiceClient } from '../context/VoiceClientContext';
|
||||||
|
|
||||||
|
export type RootStackParamList = {
|
||||||
|
Meeting: undefined;
|
||||||
|
Prejoin: undefined;
|
||||||
|
};
|
||||||
|
|
||||||
export const useVoiceClientNavigation = () => {
|
export const useVoiceClientNavigation = () => {
|
||||||
const navigation = useNavigation();
|
const navigation = useNavigation<NavigationProp<RootStackParamList>>();
|
||||||
const { inCall } = useVoiceClient();
|
const { inCall } = useVoiceClient();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (inCall) {
|
if (inCall) {
|
||||||
// TODO, refactor this
|
|
||||||
// @ts-ignore
|
|
||||||
navigation.navigate('Meeting');
|
navigation.navigate('Meeting');
|
||||||
} else {
|
} else {
|
||||||
// TODO, refactor this
|
|
||||||
// @ts-ignore
|
|
||||||
navigation.navigate('Prejoin');
|
navigation.navigate('Prejoin');
|
||||||
}
|
}
|
||||||
}, [inCall, navigation]);
|
}, [inCall, navigation]);
|
||||||
|
|||||||
Reference in New Issue
Block a user