Create ShareExtensionStack
This commit is contained in:
parent
60f505c7d8
commit
f60a9f6332
|
@ -3,17 +3,15 @@ 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 './definitions/navigationTypes';
|
|
||||||
import Navigation from './lib/navigation/appNavigation';
|
import Navigation from './lib/navigation/appNavigation';
|
||||||
import { defaultHeader, getActiveRouteName, navigationTheme } from './lib/methods/helpers/navigation';
|
import { defaultHeader, getActiveRouteName, navigationTheme } from './lib/methods/helpers/navigation';
|
||||||
import { RootEnum } from './definitions';
|
import { RootEnum } from './definitions';
|
||||||
// Stacks
|
|
||||||
import AuthLoadingView from './views/AuthLoadingView';
|
import AuthLoadingView from './views/AuthLoadingView';
|
||||||
// SetUsername Stack
|
|
||||||
import SetUsernameView from './views/SetUsernameView';
|
import SetUsernameView from './views/SetUsernameView';
|
||||||
import OutsideStack from './stacks/OutsideStack';
|
import OutsideStack from './stacks/OutsideStack';
|
||||||
import InsideStack from './stacks/InsideStack';
|
import InsideStack from './stacks/InsideStack';
|
||||||
import MasterDetailStack from './stacks/MasterDetailStack';
|
import MasterDetailStack from './stacks/MasterDetailStack';
|
||||||
|
import { SetUsernameStackParamList, StackParamList } from './stacks/types';
|
||||||
import { ThemeContext } from './theme';
|
import { ThemeContext } from './theme';
|
||||||
import { setCurrentScreen } from './lib/methods/helpers/log';
|
import { setCurrentScreen } from './lib/methods/helpers/log';
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,5 @@
|
||||||
import { NavigatorScreenParams } from '@react-navigation/core';
|
|
||||||
import { StackNavigationOptions } from '@react-navigation/stack';
|
import { StackNavigationOptions } from '@react-navigation/stack';
|
||||||
|
|
||||||
import { TSubscriptionModel } from './ISubscription';
|
|
||||||
import { TServerModel } from './IServer';
|
|
||||||
import { IAttachment } from './IAttachment';
|
|
||||||
import { MasterDetailInsideStackParamList } from '../stacks/MasterDetailStack/types';
|
|
||||||
import { OutsideParamList, InsideStackParamList } from '../stacks/types';
|
|
||||||
|
|
||||||
interface INavigationProps {
|
interface INavigationProps {
|
||||||
route?: any;
|
route?: any;
|
||||||
navigation?: any;
|
navigation?: any;
|
||||||
|
@ -16,41 +9,3 @@ interface INavigationProps {
|
||||||
export type TNavigationOptions = {
|
export type TNavigationOptions = {
|
||||||
navigationOptions?(props: INavigationProps): StackNavigationOptions;
|
navigationOptions?(props: INavigationProps): StackNavigationOptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
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: TServerModel;
|
|
||||||
text: string;
|
|
||||||
room: TSubscriptionModel;
|
|
||||||
thread?: any; // TODO: Change
|
|
||||||
};
|
|
||||||
SelectServerView: undefined;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ShareOutsideStackParamList = {
|
|
||||||
WithoutServersView: undefined;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ShareAppStackParamList = {
|
|
||||||
AuthLoading?: undefined;
|
|
||||||
OutsideStack?: NavigatorScreenParams<ShareOutsideStackParamList>;
|
|
||||||
InsideStack?: NavigatorScreenParams<ShareInsideStackParamList>;
|
|
||||||
};
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import React, { useContext, useEffect, useLayoutEffect, useState } from 'react';
|
import React, { useEffect, useLayoutEffect, useState } from 'react';
|
||||||
import { Dimensions } from 'react-native';
|
import { Dimensions } from 'react-native';
|
||||||
import { NavigationContainer } from '@react-navigation/native';
|
import { NavigationContainer } from '@react-navigation/native';
|
||||||
import { createStackNavigator } from '@react-navigation/stack';
|
|
||||||
import { Provider } from 'react-redux';
|
import { Provider } from 'react-redux';
|
||||||
|
|
||||||
import { getTheme, setNativeTheme, initialTheme as initialThemeFunction, unsubscribeTheme } from './lib/methods/helpers/theme';
|
import { getTheme, setNativeTheme, initialTheme as initialThemeFunction, unsubscribeTheme } from './lib/methods/helpers/theme';
|
||||||
|
@ -10,67 +9,18 @@ import Navigation from './lib/navigation/shareNavigation';
|
||||||
import store from './lib/store';
|
import store from './lib/store';
|
||||||
import { initStore } from './lib/store/auxStore';
|
import { initStore } from './lib/store/auxStore';
|
||||||
import { closeShareExtension, shareExtensionInit } from './lib/methods/shareExtension';
|
import { closeShareExtension, shareExtensionInit } from './lib/methods/shareExtension';
|
||||||
import { defaultHeader, getActiveRouteName, navigationTheme, themedHeader } from './lib/methods/helpers/navigation';
|
import { getActiveRouteName, navigationTheme } from './lib/methods/helpers/navigation';
|
||||||
import { ThemeContext } from './theme';
|
import { ThemeContext } from './theme';
|
||||||
import { localAuthenticate } from './lib/methods/helpers/localAuthentication';
|
import { localAuthenticate } from './lib/methods/helpers/localAuthentication';
|
||||||
import ScreenLockedView from './views/ScreenLockedView';
|
import ScreenLockedView from './views/ScreenLockedView';
|
||||||
// Outside Stack
|
|
||||||
import WithoutServersView from './views/WithoutServersView';
|
|
||||||
// Inside Stack
|
|
||||||
import ShareListView from './views/ShareListView';
|
|
||||||
import ShareView from './views/ShareView';
|
|
||||||
import SelectServerView from './views/SelectServerView';
|
|
||||||
import { setCurrentScreen } from './lib/methods/helpers/log';
|
import { setCurrentScreen } from './lib/methods/helpers/log';
|
||||||
import AuthLoadingView from './views/AuthLoadingView';
|
|
||||||
import { DimensionsContext } from './dimensions';
|
import { DimensionsContext } from './dimensions';
|
||||||
import { ShareInsideStackParamList, ShareOutsideStackParamList, ShareAppStackParamList } from './definitions/navigationTypes';
|
|
||||||
import { colors, CURRENT_SERVER } from './lib/constants';
|
import { colors, CURRENT_SERVER } from './lib/constants';
|
||||||
import Loading from './containers/Loading';
|
import Loading from './containers/Loading';
|
||||||
|
import ShareExtensionStack from './stacks/ShareExtensionStack';
|
||||||
|
|
||||||
initStore(store);
|
initStore(store);
|
||||||
|
|
||||||
const Inside = createStackNavigator<ShareInsideStackParamList>();
|
|
||||||
const InsideStack = () => {
|
|
||||||
const { theme } = useContext(ThemeContext);
|
|
||||||
|
|
||||||
const screenOptions = {
|
|
||||||
...defaultHeader,
|
|
||||||
...themedHeader(theme)
|
|
||||||
};
|
|
||||||
screenOptions.headerStyle = { ...screenOptions.headerStyle, height: 57 };
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Inside.Navigator screenOptions={screenOptions}>
|
|
||||||
<Inside.Screen name='ShareListView' component={ShareListView} />
|
|
||||||
<Inside.Screen name='ShareView' component={ShareView} />
|
|
||||||
<Inside.Screen name='SelectServerView' component={SelectServerView} />
|
|
||||||
</Inside.Navigator>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const Outside = createStackNavigator<ShareOutsideStackParamList>();
|
|
||||||
const OutsideStack = () => {
|
|
||||||
const { theme } = useContext(ThemeContext);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Outside.Navigator screenOptions={{ ...defaultHeader, ...themedHeader(theme) }}>
|
|
||||||
<Outside.Screen name='WithoutServersView' component={WithoutServersView} />
|
|
||||||
</Outside.Navigator>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
// App
|
|
||||||
const Stack = createStackNavigator<ShareAppStackParamList>();
|
|
||||||
export const App = ({ root }: { root: string }): React.ReactElement => (
|
|
||||||
<Stack.Navigator screenOptions={{ headerShown: false, animationEnabled: false }}>
|
|
||||||
<>
|
|
||||||
{!root ? <Stack.Screen name='AuthLoading' component={AuthLoadingView} /> : null}
|
|
||||||
{root === 'outside' ? <Stack.Screen name='OutsideStack' component={OutsideStack} /> : null}
|
|
||||||
{root === 'inside' ? <Stack.Screen name='InsideStack' component={InsideStack} /> : null}
|
|
||||||
</>
|
|
||||||
</Stack.Navigator>
|
|
||||||
);
|
|
||||||
|
|
||||||
const { width, height, scale, fontScale } = Dimensions.get('screen');
|
const { width, height, scale, fontScale } = Dimensions.get('screen');
|
||||||
const initialTheme = initialThemeFunction();
|
const initialTheme = initialThemeFunction();
|
||||||
const theme = getTheme(initialTheme);
|
const theme = getTheme(initialTheme);
|
||||||
|
@ -131,7 +81,7 @@ const Root = (): React.ReactElement => {
|
||||||
Navigation.routeNameRef.current = currentRouteName;
|
Navigation.routeNameRef.current = currentRouteName;
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<App root={root} />
|
<ShareExtensionStack root={root} />
|
||||||
<Loading />
|
<Loading />
|
||||||
</NavigationContainer>
|
</NavigationContainer>
|
||||||
<ScreenLockedView />
|
<ScreenLockedView />
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
import React, { useContext } from 'react';
|
||||||
|
import { createStackNavigator } from '@react-navigation/stack';
|
||||||
|
|
||||||
|
import { defaultHeader, themedHeader } from '../../lib/methods/helpers/navigation';
|
||||||
|
import { ThemeContext } from '../../theme';
|
||||||
|
// Outside Stack
|
||||||
|
import WithoutServersView from '../../views/WithoutServersView';
|
||||||
|
// Inside Stack
|
||||||
|
import ShareListView from '../../views/ShareListView';
|
||||||
|
import ShareView from '../../views/ShareView';
|
||||||
|
import SelectServerView from '../../views/SelectServerView';
|
||||||
|
import AuthLoadingView from '../../views/AuthLoadingView';
|
||||||
|
import { ShareAppStackParamList, ShareInsideStackParamList, ShareOutsideStackParamList } from './types';
|
||||||
|
|
||||||
|
const Inside = createStackNavigator<ShareInsideStackParamList>();
|
||||||
|
const InsideStack = () => {
|
||||||
|
const { theme } = useContext(ThemeContext);
|
||||||
|
|
||||||
|
const screenOptions = {
|
||||||
|
...defaultHeader,
|
||||||
|
...themedHeader(theme)
|
||||||
|
};
|
||||||
|
screenOptions.headerStyle = { ...screenOptions.headerStyle, height: 57 };
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Inside.Navigator screenOptions={screenOptions}>
|
||||||
|
<Inside.Screen name='ShareListView' component={ShareListView} />
|
||||||
|
<Inside.Screen name='ShareView' component={ShareView} />
|
||||||
|
<Inside.Screen name='SelectServerView' component={SelectServerView} />
|
||||||
|
</Inside.Navigator>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const Outside = createStackNavigator<ShareOutsideStackParamList>();
|
||||||
|
const OutsideStack = () => {
|
||||||
|
const { theme } = useContext(ThemeContext);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Outside.Navigator screenOptions={{ ...defaultHeader, ...themedHeader(theme) }}>
|
||||||
|
<Outside.Screen name='WithoutServersView' component={WithoutServersView} />
|
||||||
|
</Outside.Navigator>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
// App
|
||||||
|
const Stack = createStackNavigator<ShareAppStackParamList>();
|
||||||
|
const ShareExtensionStack = ({ root }: { root: string }): React.ReactElement => (
|
||||||
|
<Stack.Navigator screenOptions={{ headerShown: false, animationEnabled: false }}>
|
||||||
|
<>
|
||||||
|
{!root ? <Stack.Screen name='AuthLoading' component={AuthLoadingView} /> : null}
|
||||||
|
{root === 'outside' ? <Stack.Screen name='OutsideStack' component={OutsideStack} /> : null}
|
||||||
|
{root === 'inside' ? <Stack.Screen name='InsideStack' component={InsideStack} /> : null}
|
||||||
|
</>
|
||||||
|
</Stack.Navigator>
|
||||||
|
);
|
||||||
|
|
||||||
|
export default ShareExtensionStack;
|
|
@ -0,0 +1,29 @@
|
||||||
|
import { NavigatorScreenParams } from '@react-navigation/core';
|
||||||
|
|
||||||
|
import { TSubscriptionModel } from '../../definitions/ISubscription';
|
||||||
|
import { TServerModel } from '../../definitions/IServer';
|
||||||
|
import { IAttachment } from '../../definitions/IAttachment';
|
||||||
|
|
||||||
|
export type ShareInsideStackParamList = {
|
||||||
|
ShareListView: undefined;
|
||||||
|
ShareView: {
|
||||||
|
attachments: IAttachment[];
|
||||||
|
isShareView?: boolean;
|
||||||
|
isShareExtension: boolean;
|
||||||
|
serverInfo: TServerModel;
|
||||||
|
text: string;
|
||||||
|
room: TSubscriptionModel;
|
||||||
|
thread?: any; // TODO: Change
|
||||||
|
};
|
||||||
|
SelectServerView: undefined;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ShareOutsideStackParamList = {
|
||||||
|
WithoutServersView: undefined;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ShareAppStackParamList = {
|
||||||
|
AuthLoading?: undefined;
|
||||||
|
OutsideStack?: NavigatorScreenParams<ShareOutsideStackParamList>;
|
||||||
|
InsideStack?: NavigatorScreenParams<ShareInsideStackParamList>;
|
||||||
|
};
|
|
@ -9,11 +9,25 @@ import { IMessage, TAnyMessageModel, TMessageModel } from '../definitions/IMessa
|
||||||
import { ISubscription, SubscriptionType, TSubscriptionModel } from '../definitions/ISubscription';
|
import { ISubscription, SubscriptionType, TSubscriptionModel } from '../definitions/ISubscription';
|
||||||
import { ICannedResponse } from '../definitions/ICannedResponse';
|
import { ICannedResponse } from '../definitions/ICannedResponse';
|
||||||
import { TDataSelect } from '../definitions/IDataSelect';
|
import { TDataSelect } from '../definitions/IDataSelect';
|
||||||
import { ModalStackParamList } from './MasterDetailStack/types';
|
import { MasterDetailInsideStackParamList, ModalStackParamList } from './MasterDetailStack/types';
|
||||||
import { TThreadModel } from '../definitions';
|
import { TThreadModel } from '../definitions';
|
||||||
import { ILivechatDepartment } from '../definitions/ILivechatDepartment';
|
import { ILivechatDepartment } from '../definitions/ILivechatDepartment';
|
||||||
import { ILivechatTag } from '../definitions/ILivechatTag';
|
import { ILivechatTag } from '../definitions/ILivechatTag';
|
||||||
|
|
||||||
|
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 ChatsStackParamList = {
|
export type ChatsStackParamList = {
|
||||||
ModalStackNavigator: NavigatorScreenParams<ModalStackParamList>;
|
ModalStackNavigator: NavigatorScreenParams<ModalStackParamList>;
|
||||||
E2ESaveYourPasswordStackNavigator: NavigatorScreenParams<E2ESaveYourPasswordStackParamList>;
|
E2ESaveYourPasswordStackNavigator: NavigatorScreenParams<E2ESaveYourPasswordStackParamList>;
|
||||||
|
|
Loading…
Reference in New Issue