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
...@@ -3,6 +3,7 @@ import { NavigationContainer } from '@react-navigation/native'; ...@@ -3,6 +3,7 @@ import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack'; import { createStackNavigator } from '@react-navigation/stack';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { SetUsernameStackParamList, StackParamList } from './navigationTypes';
import Navigation from './lib/Navigation'; import Navigation from './lib/Navigation';
import { defaultHeader, getActiveRouteName, navigationTheme } from './utils/navigation'; import { defaultHeader, getActiveRouteName, navigationTheme } from './utils/navigation';
import { ROOT_INSIDE, ROOT_LOADING, ROOT_OUTSIDE, ROOT_SET_USERNAME } from './actions/app'; import { ROOT_INSIDE, ROOT_LOADING, ROOT_OUTSIDE, ROOT_SET_USERNAME } from './actions/app';
...@@ -17,7 +18,7 @@ import { ThemeContext } from './theme'; ...@@ -17,7 +18,7 @@ import { ThemeContext } from './theme';
import { setCurrentScreen } from './utils/log'; import { setCurrentScreen } from './utils/log';
// SetUsernameStack // SetUsernameStack
const SetUsername = createStackNavigator(); const SetUsername = createStackNavigator<SetUsernameStackParamList>();
const SetUsernameStack = () => ( const SetUsernameStack = () => (
<SetUsername.Navigator screenOptions={defaultHeader}> <SetUsername.Navigator screenOptions={defaultHeader}>
<SetUsername.Screen name='SetUsernameView' component={SetUsernameView} /> <SetUsername.Screen name='SetUsernameView' component={SetUsernameView} />
...@@ -25,7 +26,7 @@ const SetUsernameStack = () => ( ...@@ -25,7 +26,7 @@ const SetUsernameStack = () => (
); );
// App // App
const Stack = createStackNavigator(); const Stack = createStackNavigator<StackParamList>();
const App = React.memo(({ root, isMasterDetail }: { root: string; isMasterDetail: boolean }) => { const App = React.memo(({ root, isMasterDetail }: { root: string; isMasterDetail: boolean }) => {
if (!root) { if (!root) {
return null; return null;
......
...@@ -17,7 +17,7 @@ export const useActionSheet = () => useContext(context); ...@@ -17,7 +17,7 @@ export const useActionSheet = () => useContext(context);
const { Provider, Consumer } = context; const { Provider, Consumer } = context;
export const withActionSheet = <P extends object>(Component: React.ComponentType<P>) => export const withActionSheet = (Component: any): any =>
forwardRef((props: any, ref: ForwardedRef<any>) => ( forwardRef((props: any, ref: ForwardedRef<any>) => (
<Consumer>{(contexts: any) => <Component {...props} {...contexts} ref={ref} />}</Consumer> <Consumer>{(contexts: any) => <Component {...props} {...contexts} ref={ref} />}</Consumer>
)); ));
......
...@@ -31,7 +31,7 @@ interface IEmojiPickerProps { ...@@ -31,7 +31,7 @@ interface IEmojiPickerProps {
customEmojis?: any; customEmojis?: any;
style: object; style: object;
theme?: string; theme?: string;
onEmojiSelected?: Function; onEmojiSelected?: ((emoji: any) => void) | ((keyboardId: any, params?: any) => void);
tabEmojiStyle?: object; tabEmojiStyle?: object;
} }
...@@ -201,4 +201,5 @@ const mapStateToProps = (state: any) => ({ ...@@ -201,4 +201,5 @@ const mapStateToProps = (state: any) => ({
customEmojis: state.customEmojis customEmojis: state.customEmojis
}); });
export default connect(mapStateToProps)(withTheme(EmojiPicker)); // TODO - remove this as any, at the new PR to fix the HOC erros
export default connect(mapStateToProps)(withTheme(EmojiPicker)) as any;
...@@ -423,4 +423,4 @@ const mapStateToProps = (state: any) => ({ ...@@ -423,4 +423,4 @@ const mapStateToProps = (state: any) => ({
services: state.login.services services: state.login.services
}); });
export default connect(mapStateToProps)(withTheme(LoginServices)); export default connect(mapStateToProps)(withTheme(LoginServices)) as any;
...@@ -13,7 +13,7 @@ interface IMessageBoxEmojiKeyboard { ...@@ -13,7 +13,7 @@ interface IMessageBoxEmojiKeyboard {
} }
export default class EmojiKeyboard extends React.PureComponent<IMessageBoxEmojiKeyboard, any> { export default class EmojiKeyboard extends React.PureComponent<IMessageBoxEmojiKeyboard, any> {
private readonly baseUrl: any; private readonly baseUrl: string;
constructor(props: IMessageBoxEmojiKeyboard) { constructor(props: IMessageBoxEmojiKeyboard) {
super(props); super(props);
......
...@@ -1124,4 +1124,4 @@ const dispatchToProps = { ...@@ -1124,4 +1124,4 @@ const dispatchToProps = {
typing: (rid: any, status: any) => userTypingAction(rid, status) typing: (rid: any, status: any) => userTypingAction(rid, status)
}; };
// @ts-ignore // @ts-ignore
export default connect(mapStateToProps, dispatchToProps, null, { forwardRef: true })(withActionSheet(MessageBox)); export default connect(mapStateToProps, dispatchToProps, null, { forwardRef: true })(withActionSheet(MessageBox)) as any;
import React from 'react'; import React from 'react';
import { StyleSheet, Text, View } from 'react-native'; import { StyleSheet, Text, TextInputProps, View } from 'react-native';
import Touchable from 'react-native-platform-touchable'; import Touchable from 'react-native-platform-touchable';
import TextInput from '../presentation/TextInput'; import TextInput from '../presentation/TextInput';
...@@ -45,7 +45,7 @@ const styles = StyleSheet.create({ ...@@ -45,7 +45,7 @@ const styles = StyleSheet.create({
}); });
interface ISearchBox { interface ISearchBox {
onChangeText: () => void; onChangeText: TextInputProps['onChangeText'];
onSubmitEditing: () => void; onSubmitEditing: () => void;
hasCancel: boolean; hasCancel: boolean;
onCancelPress: Function; onCancelPress: Function;
......
export interface IAttachment {
title: string;
type: string;
description: string;
title_link?: string;
image_url?: string;
image_type?: string;
video_url?: string;
video_type?: string;
}
export interface IMessage {
msg: string;
}
export interface IRocketChatRecord {
id: string;
updatedAt: Date;
}
import { IRocketChatRecord } from './IRocketChatRecord';
export enum RoomType {
GROUP = 'p',
DIRECT = 'd',
CHANNEL = 'c',
OMNICHANNEL = 'l',
THREAD = 'thread'
}
export interface IRoom extends IRocketChatRecord {
rid: string;
t: RoomType;
name: string;
fname: string;
prid?: string;
tmid?: string;
topic?: string;
teamMain?: boolean;
teamId?: string;
encrypted?: boolean;
visitor?: boolean;
autoTranslateLanguage?: boolean;
autoTranslate?: boolean;
observe?: Function;
usedCannedResponse: string;
}
export interface IServer {
name: string;
iconURL: string;
useRealName: boolean;
FileUpload_MediaTypeWhiteList: string;
FileUpload_MaxFileSize: number;
roomsUpdatedAt: Date;
version: string;
lastLocalAuthenticatedSession: Date;
autoLock: boolean;
autoLockTime: number | null;
biometry: boolean | null;
uniqueID: string;
enterpriseModules: string;
E2E_Enable: boolean;
}
...@@ -22,7 +22,7 @@ export interface IDimensionsContextProps { ...@@ -22,7 +22,7 @@ export interface IDimensionsContextProps {
export const DimensionsContext = React.createContext<Partial<IDimensionsContextProps>>(Dimensions.get('window')); export const DimensionsContext = React.createContext<Partial<IDimensionsContextProps>>(Dimensions.get('window'));
export function withDimensions(Component: any) { export function withDimensions(Component: any): any {
const DimensionsComponent = (props: any) => ( const DimensionsComponent = (props: any) => (
<DimensionsContext.Consumer>{contexts => <Component {...props} {...contexts} />}</DimensionsContext.Consumer> <DimensionsContext.Consumer>{contexts => <Component {...props} {...contexts} />}</DimensionsContext.Consumer>
); );
......
...@@ -161,4 +161,5 @@ const mapStateToProps = state => ({ ...@@ -161,4 +161,5 @@ const mapStateToProps = state => ({
showAvatar: state.sortPreferences.showAvatar, showAvatar: state.sortPreferences.showAvatar,
displayMode: state.sortPreferences.displayMode displayMode: state.sortPreferences.displayMode
}); });
export default connect(mapStateToProps)(withDimensions(withTheme(QueueListView))); export default connect(mapStateToProps)(withDimensions(withTheme(QueueListView)));
...@@ -24,7 +24,7 @@ import { selectServerFailure } from '../actions/server'; ...@@ -24,7 +24,7 @@ import { selectServerFailure } from '../actions/server';
import { useSsl } from '../utils/url'; import { useSsl } from '../utils/url';
import EventEmitter from '../utils/events'; import EventEmitter from '../utils/events';
import { updatePermission } from '../actions/permissions'; import { updatePermission } from '../actions/permissions';
import { TEAM_TYPE } from '../definition/ITeam'; import { TEAM_TYPE } from '../definitions/ITeam';
import { updateSettings } from '../actions/settings'; import { updateSettings } from '../actions/settings';
import { compareServerVersion, methods } from './utils'; import { compareServerVersion, methods } from './utils';
import reduxStore from './createStore'; import reduxStore from './createStore';
......
import { NavigatorScreenParams } from '@react-navigation/core';
import { IRoom } from './definitions/IRoom';
import { IServer } from './definitions/IServer';
import { IAttachment } from './definitions/IAttachment';
import { MasterDetailInsideStackParamList } from './stacks/MasterDetailStack/types';
import { OutsideParamList, InsideStackParamList } from './stacks/types';
export type SetUsernameStackParamList = {
SetUsernameView: {
title: string;
};
};
export type StackParamList = {
AuthLoading: undefined;
OutsideStack: NavigatorScreenParams<OutsideParamList>;
InsideStack: NavigatorScreenParams<InsideStackParamList>;
MasterDetailStack: NavigatorScreenParams<MasterDetailInsideStackParamList>;
SetUsernameStack: NavigatorScreenParams<SetUsernameStackParamList>;
};
export type ShareInsideStackParamList = {
ShareListView: undefined;
ShareView: {
attachments: IAttachment[];
isShareView?: boolean;
isShareExtension: boolean;
serverInfo: IServer;
text: string;
room: IRoom;
thread: any; // TODO: Change
};
SelectServerView: undefined;
};
export type ShareOutsideStackParamList = {
WithoutServersView: undefined;
};
export type ShareAppStackParamList = {
AuthLoading?: undefined;
OutsideStack?: NavigatorScreenParams<ShareOutsideStackParamList>;
InsideStack?: NavigatorScreenParams<ShareInsideStackParamList>;
};
...@@ -25,6 +25,7 @@ import { setCurrentScreen } from './utils/log'; ...@@ -25,6 +25,7 @@ import { setCurrentScreen } from './utils/log';
import AuthLoadingView from './views/AuthLoadingView'; import AuthLoadingView from './views/AuthLoadingView';
import { DimensionsContext } from './dimensions'; import { DimensionsContext } from './dimensions';
import debounce from './utils/debounce'; import debounce from './utils/debounce';
import { ShareInsideStackParamList, ShareOutsideStackParamList, ShareAppStackParamList } from './navigationTypes';
interface IDimensions { interface IDimensions {
width: number; width: number;
...@@ -46,7 +47,7 @@ interface IState { ...@@ -46,7 +47,7 @@ interface IState {
fontScale: number; fontScale: number;
} }
const Inside = createStackNavigator(); const Inside = createStackNavigator<ShareInsideStackParamList>();
const InsideStack = () => { const InsideStack = () => {
const { theme } = useContext(ThemeContext); const { theme } = useContext(ThemeContext);
...@@ -65,24 +66,19 @@ const InsideStack = () => { ...@@ -65,24 +66,19 @@ const InsideStack = () => {
); );
}; };
const Outside = createStackNavigator(); const Outside = createStackNavigator<ShareOutsideStackParamList>();
const OutsideStack = () => { const OutsideStack = () => {
const { theme } = useContext(ThemeContext); const { theme } = useContext(ThemeContext);
return ( return (
<Outside.Navigator screenOptions={{ ...defaultHeader, ...themedHeader(theme) }}> <Outside.Navigator screenOptions={{ ...defaultHeader, ...themedHeader(theme) }}>
<Outside.Screen <Outside.Screen name='WithoutServersView' component={WithoutServersView} options={WithoutServersView.navigationOptions} />
name='WithoutServersView'
component={WithoutServersView}
/* @ts-ignore*/
options={WithoutServersView.navigationOptions}
/>
</Outside.Navigator> </Outside.Navigator>
); );
}; };
// App // App
const Stack = createStackNavigator(); const Stack = createStackNavigator<ShareAppStackParamList>();
export const App = ({ root }: any) => ( export const App = ({ root }: any) => (
<Stack.Navigator screenOptions={{ headerShown: false, animationEnabled: false }}> <Stack.Navigator screenOptions={{ headerShown: false, animationEnabled: false }}>
<> <>
...@@ -112,7 +108,7 @@ class Root extends React.Component<{}, IState> { ...@@ -112,7 +108,7 @@ class Root extends React.Component<{}, IState> {
this.init(); this.init();
} }
componentWillUnmount() { componentWillUnmount(): void {
RocketChat.closeShareExtension(); RocketChat.closeShareExtension();
unsubscribeTheme(); unsubscribeTheme();
} }
......
import React from 'react'; import React from 'react';
import { I18nManager } from 'react-native'; import { I18nManager } from 'react-native';
import { createStackNavigator } from '@react-navigation/stack'; import { createStackNavigator, StackNavigationOptions } from '@react-navigation/stack';
import { createDrawerNavigator } from '@react-navigation/drawer'; import { createDrawerNavigator } from '@react-navigation/drawer';
import { ThemeContext } from '../theme'; import { ThemeContext } from '../theme';
import { ModalAnimation, StackAnimation, defaultHeader, themedHeader } from '../utils/navigation'; import { ModalAnimation, StackAnimation, defaultHeader, themedHeader } from '../utils/navigation';
import Sidebar from '../views/SidebarView'; import Sidebar from '../views/SidebarView';
// Chats Stack // Chats Stack
import RoomView from '../views/RoomView'; import RoomView from '../views/RoomView';
import RoomsListView from '../views/RoomsListView'; import RoomsListView from '../views/RoomsListView';
...@@ -37,10 +36,8 @@ import { themes } from '../constants/colors'; ...@@ -37,10 +36,8 @@ import { themes } from '../constants/colors';
import ProfileView from '../views/ProfileView'; import ProfileView from '../views/ProfileView';
import UserPreferencesView from '../views/UserPreferencesView'; import UserPreferencesView from '../views/UserPreferencesView';
import UserNotificationPrefView from '../views/UserNotificationPreferencesView'; import UserNotificationPrefView from '../views/UserNotificationPreferencesView';
// Display Preferences View // Display Preferences View
import DisplayPrefsView from '../views/DisplayPrefsView'; import DisplayPrefsView from '../views/DisplayPrefsView';
// Settings Stack // Settings Stack
import SettingsView from '../views/SettingsView'; import SettingsView from '../views/SettingsView';
import SecurityPrivacyView from '../views/SecurityPrivacyView'; import SecurityPrivacyView from '../views/SecurityPrivacyView';
...@@ -49,21 +46,16 @@ import LanguageView from '../views/LanguageView'; ...@@ -49,21 +46,16 @@ import LanguageView from '../views/LanguageView';
import ThemeView from '../views/ThemeView'; import ThemeView from '../views/ThemeView';
import DefaultBrowserView from '../views/DefaultBrowserView'; import DefaultBrowserView from '../views/DefaultBrowserView';
import ScreenLockConfigView from '../views/ScreenLockConfigView'; import ScreenLockConfigView from '../views/ScreenLockConfigView';
// Admin Stack // Admin Stack
import AdminPanelView from '../views/AdminPanelView'; import AdminPanelView from '../views/AdminPanelView';
// NewMessage Stack // NewMessage Stack
import NewMessageView from '../views/NewMessageView'; import NewMessageView from '../views/NewMessageView';
import CreateChannelView from '../views/CreateChannelView'; import CreateChannelView from '../views/CreateChannelView';
// E2ESaveYourPassword Stack // E2ESaveYourPassword Stack
import E2ESaveYourPasswordView from '../views/E2ESaveYourPasswordView'; import E2ESaveYourPasswordView from '../views/E2ESaveYourPasswordView';
import E2EHowItWorksView from '../views/E2EHowItWorksView'; import E2EHowItWorksView from '../views/E2EHowItWorksView';
// E2EEnterYourPassword Stack // E2EEnterYourPassword Stack
import E2EEnterYourPasswordView from '../views/E2EEnterYourPasswordView'; import E2EEnterYourPasswordView from '../views/E2EEnterYourPasswordView';
// InsideStackNavigator // InsideStackNavigator
import AttachmentView from '../views/AttachmentView'; import AttachmentView from '../views/AttachmentView';
import ModalBlockView from '../views/ModalBlockView'; import ModalBlockView from '../views/ModalBlockView';
...@@ -75,20 +67,33 @@ import QueueListView from '../ee/omnichannel/views/QueueListView'; ...@@ -75,20 +67,33 @@ import QueueListView from '../ee/omnichannel/views/QueueListView';
import AddChannelTeamView from '../views/AddChannelTeamView'; import AddChannelTeamView from '../views/AddChannelTeamView';
import AddExistingChannelView from '../views/AddExistingChannelView'; import AddExistingChannelView from '../views/AddExistingChannelView';
import SelectListView from '../views/SelectListView'; import SelectListView from '../views/SelectListView';
import {
AdminPanelStackParamList,
ChatsStackParamList,
DisplayPrefStackParamList,
DrawerParamList,
E2EEnterYourPasswordStackParamList,
E2ESaveYourPasswordStackParamList,
InsideStackParamList,
NewMessageStackParamList,
ProfileStackParamList,
SettingsStackParamList
} from './types';
// ChatsStackNavigator // ChatsStackNavigator
const ChatsStack = createStackNavigator(); const ChatsStack = createStackNavigator<ChatsStackParamList>();
const ChatsStackNavigator = () => { const ChatsStackNavigator = () => {
const { theme } = React.useContext(ThemeContext); const { theme } = React.useContext(ThemeContext);
return ( return (
<ChatsStack.Navigator screenOptions={{ ...defaultHeader, ...themedHeader(theme), ...StackAnimation }}> <ChatsStack.Navigator
screenOptions={{ ...defaultHeader, ...themedHeader(theme), ...StackAnimation } as StackNavigationOptions}>
<ChatsStack.Screen name='RoomsListView' component={RoomsListView} /> <ChatsStack.Screen name='RoomsListView' component={RoomsListView} />
<ChatsStack.Screen name='RoomView' component={RoomView} /> <ChatsStack.Screen name='RoomView' component={RoomView} />
<ChatsStack.Screen name='RoomActionsView' component={RoomActionsView} options={RoomActionsView.navigationOptions} /> <ChatsStack.Screen name='RoomActionsView' component={RoomActionsView} options={RoomActionsView.navigationOptions} />
<ChatsStack.Screen name='SelectListView' component={SelectListView} options={SelectListView.navigationOptions} /> <ChatsStack.Screen name='SelectListView' component={SelectListView} options={SelectListView.navigationOptions} />
<ChatsStack.Screen name='RoomInfoView' component={RoomInfoView} options={RoomInfoView.navigationOptions} /> <ChatsStack.Screen name='RoomInfoView' component={RoomInfoView} options={RoomInfoView.navigationOptions} />
<ChatsStack.Screen name='RoomInfoEditView' component={RoomInfoEditView} options={RoomInfoEditView.navigationOptions} /> <ChatsStack.Screen name='RoomInfoEditView' component={RoomInfoEditView} options={RoomInfoEditView.navigationOptions} />
<ChatsStack.Screen name='RoomMembersView' component={RoomMembersView} options={RoomMembersView.navigationOptions} /> <ChatsStack.Screen name='RoomMembersView' component={RoomMembersView} />
<ChatsStack.Screen <ChatsStack.Screen
name='SearchMessagesView' name='SearchMessagesView'
component={SearchMessagesView} component={SearchMessagesView}
...@@ -126,13 +131,9 @@ const ChatsStackNavigator = () => { ...@@ -126,13 +131,9 @@ const ChatsStackNavigator = () => {
component={ThreadMessagesView} component={ThreadMessagesView}
options={ThreadMessagesView.navigationOptions} options={ThreadMessagesView.navigationOptions}
/> />
<ChatsStack.Screen name='TeamChannelsView' component={TeamChannelsView} options={TeamChannelsView.navigationOptions} /> <ChatsStack.Screen name='TeamChannelsView' component={TeamChannelsView} />
<ChatsStack.Screen name='CreateChannelView' component={CreateChannelView} options={CreateChannelView.navigationOptions} /> <ChatsStack.Screen name='CreateChannelView' component={CreateChannelView} options={CreateChannelView.navigationOptions} />
<ChatsStack.Screen <ChatsStack.Screen name='AddChannelTeamView' component={AddChannelTeamView} />
name='AddChannelTeamView'
component={AddChannelTeamView}
options={AddChannelTeamView.navigationOptions}
/>
<ChatsStack.Screen <ChatsStack.Screen
name='AddExistingChannelView' name='AddExistingChannelView'
component={AddExistingChannelView} component={AddExistingChannelView}
...@@ -141,32 +142,21 @@ const ChatsStackNavigator = () => { ...@@ -141,32 +142,21 @@ const ChatsStackNavigator = () => {
<ChatsStack.Screen name='MarkdownTableView' component={MarkdownTableView} options={MarkdownTableView.navigationOptions} /> <ChatsStack.Screen name='MarkdownTableView' component={MarkdownTableView} options={MarkdownTableView.navigationOptions} />
<ChatsStack.Screen name='ReadReceiptsView' component={ReadReceiptsView} options={ReadReceiptsView.navigationOptions} /> <ChatsStack.Screen name='ReadReceiptsView' component={ReadReceiptsView} options={ReadReceiptsView.navigationOptions} />
<ChatsStack.Screen name='QueueListView' component={QueueListView} options={QueueListView.navigationOptions} /> <ChatsStack.Screen name='QueueListView' component={QueueListView} options={QueueListView.navigationOptions} />
<ChatsStack.Screen <ChatsStack.Screen name='CannedResponsesListView' component={CannedResponsesListView} />
name='CannedResponsesListView' <ChatsStack.Screen name='CannedResponseDetail' component={CannedResponseDetail} />
component={CannedResponsesListView}
options={CannedResponsesListView.navigationOptions}
/>
<ChatsStack.Screen
name='CannedResponseDetail'
component={CannedResponseDetail}
options={CannedResponseDetail.navigationOptions}
/>
</ChatsStack.Navigator> </ChatsStack.Navigator>
); );
}; };
// ProfileStackNavigator // ProfileStackNavigator
const ProfileStack = createStackNavigator(); const ProfileStack = createStackNavigator<ProfileStackParamList>();
const ProfileStackNavigator = () => { const ProfileStackNavigator = () => {
const { theme } = React.useContext(ThemeContext); const { theme } = React.useContext(ThemeContext);
return ( return (
<ProfileStack.Navigator screenOptions={{ ...defaultHeader, ...themedHeader(theme), ...StackAnimation }}> <ProfileStack.Navigator
screenOptions={{ ...defaultHeader, ...themedHeader(theme), ...StackAnimation } as StackNavigationOptions}>
<ProfileStack.Screen name='ProfileView' component={ProfileView} options={ProfileView.navigationOptions} /> <ProfileStack.Screen name='ProfileView' component={ProfileView} options={ProfileView.navigationOptions} />
<ProfileStack.Screen <ProfileStack.Screen name='UserPreferencesView' component={UserPreferencesView} />
name='UserPreferencesView'
component={UserPreferencesView}
options={UserPreferencesView.navigationOptions}
/>
<ProfileStack.Screen <ProfileStack.Screen
name='UserNotificationPrefView' name='UserNotificationPrefView'
component={UserNotificationPrefView} component={UserNotificationPrefView}
...@@ -178,18 +168,15 @@ const ProfileStackNavigator = () => { ...@@ -178,18 +168,15 @@ const ProfileStackNavigator = () => {
}; };
// SettingsStackNavigator // SettingsStackNavigator
const SettingsStack = createStackNavigator(); const SettingsStack = createStackNavigator<SettingsStackParamList>();
const SettingsStackNavigator = () => { const SettingsStackNavigator = () => {
const { theme } = React.useContext(ThemeContext); const { theme } = React.useContext(ThemeContext);
return ( return (
<SettingsStack.Navigator screenOptions={{ ...defaultHeader, ...themedHeader(theme), ...StackAnimation }}> <SettingsStack.Navigator
screenOptions={{ ...defaultHeader, ...themedHeader(theme), ...StackAnimation } as StackNavigationOptions}>
<SettingsStack.Screen name='SettingsView' component={SettingsView} options={SettingsView.navigationOptions} /> <SettingsStack.Screen name='SettingsView' component={SettingsView} options={SettingsView.navigationOptions} />
<SettingsStack.Screen <SettingsStack.Screen name='SecurityPrivacyView' component={SecurityPrivacyView} />
name='SecurityPrivacyView'
component={SecurityPrivacyView}
options={SecurityPrivacyView.navigationOptions}
/>
<SettingsStack.Screen <SettingsStack.Screen
name='E2EEncryptionSecurityView'