Unverified Commit 691bf1ef authored by Gerzon Z's avatar Gerzon Z Committed by GitHub
Browse files

Chore: Migrate react-navigation to TypeScript (#3480)



Co-authored-by: default avatarAlexAlexandre <alexalexandrejr@gmail.com>
parent 4af97f19
......@@ -14,6 +14,7 @@ import ActivityIndicator from '../../containers/ActivityIndicator';
import { getUserSelector } from '../../selectors/login';
import sharedStyles from '../Styles';
import { OPTIONS } from './options';
import { ProfileStackParamList } from '../../stacks/types';
const styles = StyleSheet.create({
pickerText: {
......@@ -34,7 +35,7 @@ interface IUserNotificationPreferencesViewState {
}
interface IUserNotificationPreferencesViewProps {
navigation: StackNavigationProp<any, 'UserNotificationPreferencesView'>;
navigation: StackNavigationProp<ProfileStackParamList, 'UserNotificationPrefView'>;
theme: string;
user: {
id: string;
......
......@@ -11,9 +11,10 @@ import * as List from '../../containers/List';
import { SWITCH_TRACK_COLOR } from '../../constants/colors';
import { getUserSelector } from '../../selectors/login';
import RocketChat from '../../lib/rocketchat';
import { ProfileStackParamList } from '../../stacks/types';
interface IUserPreferencesViewProps {
navigation: StackNavigationProp<any, 'UserPreferencesView'>;
navigation: StackNavigationProp<ProfileStackParamList, 'UserPreferencesView'>;
}
const UserPreferencesView = ({ navigation }: IUserPreferencesViewProps): JSX.Element => {
......@@ -26,7 +27,7 @@ const UserPreferencesView = ({ navigation }: IUserPreferencesViewProps): JSX.Ele
});
}, []);
const navigateToScreen = (screen: string) => {
const navigateToScreen = (screen: keyof ProfileStackParamList) => {
logEvent(events.UP_GO_USER_NOTIFICATION_PREF);
navigation.navigate(screen);
};
......
......@@ -26,7 +26,11 @@ const styles = StyleSheet.create({
}
});
class WithoutServerView extends React.Component<any, any> {
interface IWithoutServerViewProps {
theme: string;
}
class WithoutServerView extends React.Component<IWithoutServerViewProps> {
static navigationOptions = () => ({
title: 'Rocket.Chat',
headerLeft: () => <HeaderButton.CancelModal onPress={ShareExtension.close} testID='share-extension-close' />
......
......@@ -2,7 +2,9 @@ import React from 'react';
import { Text, View } from 'react-native';
import { StackNavigationProp, StackNavigationOptions } from '@react-navigation/stack';
import { connect } from 'react-redux';
import { CompositeNavigationProp } from '@react-navigation/core';
import { OutsideModalParamList, OutsideParamList } from '../../stacks/types';
import I18n from '../../i18n';
import Button from '../../containers/Button';
import { themes } from '../../constants/colors';
......@@ -13,8 +15,10 @@ import ServerAvatar from './ServerAvatar';
import styles from './styles';
interface IWorkSpaceProp {
// TODO: waiting for the RootStackParamList https://reactnavigation.org/docs/typescript/#type-checking-screens
navigation: StackNavigationProp<any, 'WorkspaceView'>;
navigation: CompositeNavigationProp<
StackNavigationProp<OutsideParamList, 'WorkspaceView'>,
StackNavigationProp<OutsideModalParamList>
>;
theme: string;
Site_Name: string;
Site_Url: string;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment