compiling
This commit is contained in:
parent
f1e9d5d6d5
commit
796c82a966
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
import { ScrollView, StyleSheet, View } from 'react-native';
|
||||
import { ScrollView, StyleSheet, View, SafeAreaView } from 'react-native';
|
||||
import PropTypes from 'prop-types';
|
||||
import { SafeAreaView } from 'react-navigation';
|
||||
// import { SafeAreaView } from 'react-navigation';
|
||||
|
||||
import { themes } from '../constants/colors';
|
||||
import sharedStyles from '../views/Styles';
|
||||
|
|
|
@ -5,7 +5,7 @@ import {
|
|||
import PropTypes from 'prop-types';
|
||||
import { connect } from 'react-redux';
|
||||
import { Base64 } from 'js-base64';
|
||||
import { withNavigation } from 'react-navigation';
|
||||
import { withNavigation } from '@react-navigation/compat';
|
||||
|
||||
import { withTheme } from '../theme';
|
||||
import sharedStyles from '../views/Styles';
|
||||
|
|
286
app/index.js
286
app/index.js
|
@ -1,41 +1,261 @@
|
|||
import * as React from 'react';
|
||||
import { Button, View, Text } from 'react-native';
|
||||
import React, { useState } from 'react';
|
||||
import { Linking } from 'react-native';
|
||||
import { NavigationContainer } from '@react-navigation/native';
|
||||
import { createStackNavigator } from '@react-navigation/stack';
|
||||
import RNBootSplash from 'react-native-bootsplash';
|
||||
RNBootSplash.hide();
|
||||
import { AppearanceProvider } from 'react-native-appearance';
|
||||
import { Provider } from 'react-redux';
|
||||
import RNUserDefaults from 'rn-user-defaults';
|
||||
import KeyCommands, { KeyCommandsEmitter } from 'react-native-keycommands';
|
||||
import RNScreens from 'react-native-screens';
|
||||
|
||||
function HomeScreen({ navigation }) {
|
||||
return (
|
||||
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
|
||||
<Text>Home Screen</Text>
|
||||
<Button
|
||||
title="Go to Details"
|
||||
onPress={() => navigation.navigate('Details')}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
import {
|
||||
defaultTheme,
|
||||
newThemeState,
|
||||
subscribeTheme,
|
||||
unsubscribeTheme
|
||||
} from './utils/theme';
|
||||
import EventEmitter from './utils/events';
|
||||
import { appInit, appInitLocalSettings } from './actions';
|
||||
import { deepLinkingOpen } from './actions/deepLinking';
|
||||
import Navigation from './lib/Navigation';
|
||||
import parseQuery from './lib/methods/helpers/parseQuery';
|
||||
import { initializePushNotifications, onNotification } from './notifications/push';
|
||||
import store from './lib/createStore';
|
||||
import { loggerConfig, analytics } from './utils/log';
|
||||
import { ThemeContext } from './theme';
|
||||
import RocketChat, { THEME_PREFERENCES_KEY } from './lib/rocketchat';
|
||||
import { MIN_WIDTH_SPLIT_LAYOUT } from './constants/tablet';
|
||||
import {
|
||||
isTablet, isIOS, setWidth, supportSystemTheme
|
||||
} from './utils/deviceInfo';
|
||||
import { KEY_COMMAND } from './commands';
|
||||
import Tablet, { initTabletNav } from './tablet';
|
||||
import { SplitContext } from './split';
|
||||
import { defaultHeader, onNavigationStateChange } from './utils/navigation';
|
||||
|
||||
function DetailsScreen() {
|
||||
return (
|
||||
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
|
||||
<Text>Details Screen</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
// App Stack
|
||||
import AuthLoadingView from './views/AuthLoadingView';
|
||||
|
||||
// SetUsername Stack
|
||||
import SetUsernameView from './views/SetUsernameView';
|
||||
|
||||
import OutsideStack from './stacks/OutsideStack';
|
||||
import InsideStack from './stacks/InsideStack';
|
||||
|
||||
RNScreens.enableScreens();
|
||||
|
||||
const parseDeepLinking = (url) => {
|
||||
if (url) {
|
||||
url = url.replace(/rocketchat:\/\/|https:\/\/go.rocket.chat\//, '');
|
||||
const regex = /^(room|auth|invite)\?/;
|
||||
if (url.match(regex)) {
|
||||
url = url.replace(regex, '').trim();
|
||||
if (url) {
|
||||
return parseQuery(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
// SetUsernameStack
|
||||
const SetUsername = createStackNavigator();
|
||||
const SetUsernameStack = () => (
|
||||
<SetUsername.Navigator screenOptions={defaultHeader}>
|
||||
<SetUsername.Screen
|
||||
name='SetUsernameView'
|
||||
component={SetUsernameView}
|
||||
/>
|
||||
</SetUsername.Navigator>
|
||||
);
|
||||
|
||||
const AuthContext = React.createContext();
|
||||
|
||||
// App
|
||||
const Stack = createStackNavigator();
|
||||
export const App = () => {
|
||||
const [loading] = useState(false);
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<NavigationContainer>
|
||||
<Stack.Navigator>
|
||||
<Stack.Screen name="Home" component={HomeScreen} options={{ title: 'Overview' }} />
|
||||
<Stack.Screen name="Details" component={DetailsScreen} />
|
||||
</Stack.Navigator>
|
||||
</NavigationContainer>
|
||||
);
|
||||
return (
|
||||
<NavigationContainer
|
||||
ref={(navigatorRef) => {
|
||||
Navigation.setTopLevelNavigator(navigatorRef);
|
||||
}}
|
||||
onNavigationStateChange={onNavigationStateChange}
|
||||
>
|
||||
<AuthContext.Provider value={{}}>
|
||||
<Stack.Navigator screenOptions={{ headerShown: false }}>
|
||||
{loading ? (
|
||||
<Stack.Screen
|
||||
name='AuthLoading'
|
||||
component={AuthLoadingView}
|
||||
/>
|
||||
) : (
|
||||
<>
|
||||
<Stack.Screen
|
||||
name='OutsideStack'
|
||||
component={OutsideStack}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name='InsideStack'
|
||||
component={InsideStack}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name='SetUsernameStack'
|
||||
component={SetUsernameStack}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</Stack.Navigator>
|
||||
</AuthContext.Provider>
|
||||
</NavigationContainer>
|
||||
);
|
||||
};
|
||||
|
||||
export default class Root extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.init();
|
||||
this.initCrashReport();
|
||||
this.state = {
|
||||
split: false,
|
||||
inside: false,
|
||||
showModal: false,
|
||||
theme: defaultTheme(),
|
||||
themePreferences: {
|
||||
currentTheme: supportSystemTheme() ? 'automatic' : 'light',
|
||||
darkLevel: 'dark'
|
||||
}
|
||||
};
|
||||
if (isTablet) {
|
||||
this.initTablet();
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.listenerTimeout = setTimeout(() => {
|
||||
Linking.addEventListener('url', ({ url }) => {
|
||||
const parsedDeepLinkingURL = parseDeepLinking(url);
|
||||
if (parsedDeepLinkingURL) {
|
||||
store.dispatch(deepLinkingOpen(parsedDeepLinkingURL));
|
||||
}
|
||||
});
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
componentDidUpdate(_, prevState) {
|
||||
if (isTablet) {
|
||||
const { split, inside } = this.state;
|
||||
if (inside && split !== prevState.split) {
|
||||
// Reset app on split mode changes
|
||||
Navigation.navigate('RoomsListView');
|
||||
this.closeModal();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
clearTimeout(this.listenerTimeout);
|
||||
|
||||
unsubscribeTheme();
|
||||
|
||||
if (this.onKeyCommands && this.onKeyCommands.remove) {
|
||||
this.onKeyCommands.remove();
|
||||
}
|
||||
}
|
||||
|
||||
init = async() => {
|
||||
if (isIOS) {
|
||||
await RNUserDefaults.setName('group.ios.chat.rocket');
|
||||
}
|
||||
RNUserDefaults.objectForKey(THEME_PREFERENCES_KEY).then(this.setTheme);
|
||||
const [notification, deepLinking] = await Promise.all([initializePushNotifications(), Linking.getInitialURL()]);
|
||||
const parsedDeepLinkingURL = parseDeepLinking(deepLinking);
|
||||
store.dispatch(appInitLocalSettings());
|
||||
if (notification) {
|
||||
onNotification(notification);
|
||||
} else if (parsedDeepLinkingURL) {
|
||||
store.dispatch(deepLinkingOpen(parsedDeepLinkingURL));
|
||||
} else {
|
||||
store.dispatch(appInit());
|
||||
}
|
||||
}
|
||||
|
||||
setTheme = (newTheme = {}) => {
|
||||
// change theme state
|
||||
this.setState(prevState => newThemeState(prevState, newTheme), () => {
|
||||
const { themePreferences } = this.state;
|
||||
// subscribe to Appearance changes
|
||||
subscribeTheme(themePreferences, this.setTheme);
|
||||
});
|
||||
}
|
||||
|
||||
initTablet = async() => {
|
||||
initTabletNav(args => this.setState(args));
|
||||
await KeyCommands.setKeyCommands([]);
|
||||
this.onKeyCommands = KeyCommandsEmitter.addListener(
|
||||
'onKeyCommand',
|
||||
command => EventEmitter.emit(KEY_COMMAND, { event: command })
|
||||
);
|
||||
}
|
||||
|
||||
initCrashReport = () => {
|
||||
RocketChat.getAllowCrashReport()
|
||||
.then((allowCrashReport) => {
|
||||
if (!allowCrashReport) {
|
||||
loggerConfig.autoNotify = false;
|
||||
loggerConfig.registerBeforeSendCallback(() => false);
|
||||
analytics().setAnalyticsCollectionEnabled(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onLayout = ({ nativeEvent: { layout: { width } } }) => (isTablet ? this.setSplit(width) : null);
|
||||
|
||||
setSplit = (width) => {
|
||||
this.setState({ split: width > MIN_WIDTH_SPLIT_LAYOUT });
|
||||
setWidth(width);
|
||||
}
|
||||
|
||||
closeModal = () => this.setState({ showModal: false });
|
||||
|
||||
render() {
|
||||
const { split, themePreferences, theme } = this.state;
|
||||
|
||||
let content = <App />;
|
||||
|
||||
if (isTablet) {
|
||||
const { inside, showModal } = this.state;
|
||||
content = (
|
||||
<SplitContext.Provider value={{ split }}>
|
||||
<Tablet
|
||||
theme={theme}
|
||||
tablet={split}
|
||||
inside={inside}
|
||||
showModal={showModal}
|
||||
closeModal={this.closeModal}
|
||||
onLayout={this.onLayout}
|
||||
>
|
||||
{content}
|
||||
</Tablet>
|
||||
</SplitContext.Provider>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<AppearanceProvider>
|
||||
<Provider store={store}>
|
||||
<ThemeContext.Provider
|
||||
value={{
|
||||
theme,
|
||||
themePreferences,
|
||||
setTheme: this.setTheme
|
||||
}}
|
||||
>
|
||||
{content}
|
||||
</ThemeContext.Provider>
|
||||
</Provider>
|
||||
</AppearanceProvider>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default App;
|
||||
|
|
753
app/index.js_
753
app/index.js_
|
@ -1,753 +0,0 @@
|
|||
import React from 'react';
|
||||
import {
|
||||
View, Linking, BackHandler, ScrollView
|
||||
} from 'react-native';
|
||||
import { createAppContainer, createSwitchNavigator } from 'react-navigation';
|
||||
import { createStackNavigator } from 'react-navigation-stack';
|
||||
import { createDrawerNavigator } from 'react-navigation-drawer';
|
||||
import { AppearanceProvider } from 'react-native-appearance';
|
||||
import { Provider } from 'react-redux';
|
||||
import PropTypes from 'prop-types';
|
||||
import RNUserDefaults from 'rn-user-defaults';
|
||||
import Modal from 'react-native-modal';
|
||||
import KeyCommands, { KeyCommandsEmitter } from 'react-native-keycommands';
|
||||
|
||||
import {
|
||||
defaultTheme,
|
||||
newThemeState,
|
||||
subscribeTheme,
|
||||
unsubscribeTheme
|
||||
} from './utils/theme';
|
||||
import EventEmitter from './utils/events';
|
||||
import { appInit, appInitLocalSettings } from './actions';
|
||||
import { deepLinkingOpen } from './actions/deepLinking';
|
||||
import Navigation from './lib/Navigation';
|
||||
import Sidebar from './views/SidebarView';
|
||||
import parseQuery from './lib/methods/helpers/parseQuery';
|
||||
import { initializePushNotifications, onNotification } from './notifications/push';
|
||||
import store from './lib/createStore';
|
||||
import NotificationBadge from './notifications/inApp';
|
||||
import {
|
||||
defaultHeader, onNavigationStateChange, cardStyle, getActiveRouteName
|
||||
} from './utils/navigation';
|
||||
import { loggerConfig, analytics } from './utils/log';
|
||||
import Toast from './containers/Toast';
|
||||
import { ThemeContext } from './theme';
|
||||
import RocketChat, { THEME_PREFERENCES_KEY } from './lib/rocketchat';
|
||||
import { MIN_WIDTH_SPLIT_LAYOUT } from './constants/tablet';
|
||||
import {
|
||||
isTablet, isSplited, isIOS, setWidth, supportSystemTheme, isAndroid
|
||||
} from './utils/deviceInfo';
|
||||
import { KEY_COMMAND } from './commands';
|
||||
import Tablet, { initTabletNav } from './tablet';
|
||||
import sharedStyles from './views/Styles';
|
||||
import { SplitContext } from './split';
|
||||
import TwoFactor from './containers/TwoFactor';
|
||||
|
||||
import RoomsListView from './views/RoomsListView';
|
||||
import RoomView from './views/RoomView';
|
||||
import ScreenLockedView from './views/ScreenLockedView';
|
||||
import ChangePasscodeView from './views/ChangePasscodeView';
|
||||
|
||||
if (isIOS) {
|
||||
const RNScreens = require('react-native-screens');
|
||||
RNScreens.useScreens();
|
||||
}
|
||||
|
||||
const parseDeepLinking = (url) => {
|
||||
if (url) {
|
||||
url = url.replace(/rocketchat:\/\/|https:\/\/go.rocket.chat\//, '');
|
||||
const regex = /^(room|auth|invite)\?/;
|
||||
if (url.match(regex)) {
|
||||
url = url.replace(regex, '').trim();
|
||||
if (url) {
|
||||
return parseQuery(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
// Outside
|
||||
const OutsideStack = createStackNavigator({
|
||||
OnboardingView: {
|
||||
getScreen: () => require('./views/OnboardingView').default,
|
||||
header: null
|
||||
},
|
||||
NewServerView: {
|
||||
getScreen: () => require('./views/NewServerView').default
|
||||
},
|
||||
WorkspaceView: {
|
||||
getScreen: () => require('./views/WorkspaceView').default
|
||||
},
|
||||
LoginView: {
|
||||
getScreen: () => require('./views/LoginView').default
|
||||
},
|
||||
ForgotPasswordView: {
|
||||
getScreen: () => require('./views/ForgotPasswordView').default
|
||||
},
|
||||
RegisterView: {
|
||||
getScreen: () => require('./views/RegisterView').default
|
||||
},
|
||||
LegalView: {
|
||||
getScreen: () => require('./views/LegalView').default
|
||||
}
|
||||
}, {
|
||||
defaultNavigationOptions: defaultHeader,
|
||||
cardStyle
|
||||
});
|
||||
|
||||
const AuthenticationWebViewStack = createStackNavigator({
|
||||
AuthenticationWebView: {
|
||||
getScreen: () => require('./views/AuthenticationWebView').default
|
||||
}
|
||||
}, {
|
||||
defaultNavigationOptions: defaultHeader,
|
||||
cardStyle
|
||||
});
|
||||
|
||||
const OutsideStackModal = createStackNavigator({
|
||||
OutsideStack,
|
||||
AuthenticationWebViewStack
|
||||
},
|
||||
{
|
||||
mode: 'modal',
|
||||
headerMode: 'none',
|
||||
cardStyle
|
||||
});
|
||||
|
||||
const RoomRoutes = {
|
||||
RoomView,
|
||||
ThreadMessagesView: {
|
||||
getScreen: () => require('./views/ThreadMessagesView').default
|
||||
},
|
||||
MarkdownTableView: {
|
||||
getScreen: () => require('./views/MarkdownTableView').default
|
||||
},
|
||||
ReadReceiptsView: {
|
||||
getScreen: () => require('./views/ReadReceiptView').default
|
||||
}
|
||||
};
|
||||
|
||||
// Inside
|
||||
const ChatsStack = createStackNavigator({
|
||||
RoomsListView,
|
||||
RoomActionsView: {
|
||||
getScreen: () => require('./views/RoomActionsView').default
|
||||
},
|
||||
RoomInfoView: {
|
||||
getScreen: () => require('./views/RoomInfoView').default
|
||||
},
|
||||
RoomInfoEditView: {
|
||||
getScreen: () => require('./views/RoomInfoEditView').default
|
||||
},
|
||||
RoomMembersView: {
|
||||
getScreen: () => require('./views/RoomMembersView').default
|
||||
},
|
||||
SearchMessagesView: {
|
||||
getScreen: () => require('./views/SearchMessagesView').default
|
||||
},
|
||||
SelectedUsersView: {
|
||||
getScreen: () => require('./views/SelectedUsersView').default
|
||||
},
|
||||
InviteUsersView: {
|
||||
getScreen: () => require('./views/InviteUsersView').default
|
||||
},
|
||||
InviteUsersEditView: {
|
||||
getScreen: () => require('./views/InviteUsersEditView').default
|
||||
},
|
||||
MessagesView: {
|
||||
getScreen: () => require('./views/MessagesView').default
|
||||
},
|
||||
AutoTranslateView: {
|
||||
getScreen: () => require('./views/AutoTranslateView').default
|
||||
},
|
||||
DirectoryView: {
|
||||
getScreen: () => require('./views/DirectoryView').default
|
||||
},
|
||||
NotificationPrefView: {
|
||||
getScreen: () => require('./views/NotificationPreferencesView').default
|
||||
},
|
||||
VisitorNavigationView: {
|
||||
getScreen: () => require('./views/VisitorNavigationView').default
|
||||
},
|
||||
ForwardLivechatView: {
|
||||
getScreen: () => require('./views/ForwardLivechatView').default
|
||||
},
|
||||
LivechatEditView: {
|
||||
getScreen: () => require('./views/LivechatEditView').default
|
||||
},
|
||||
PickerView: {
|
||||
getScreen: () => require('./views/PickerView').default
|
||||
},
|
||||
...RoomRoutes
|
||||
}, {
|
||||
defaultNavigationOptions: defaultHeader,
|
||||
cardStyle
|
||||
});
|
||||
|
||||
// Inside
|
||||
const RoomStack = createStackNavigator({
|
||||
...RoomRoutes
|
||||
}, {
|
||||
defaultNavigationOptions: defaultHeader,
|
||||
cardStyle
|
||||
});
|
||||
|
||||
ChatsStack.navigationOptions = ({ navigation }) => {
|
||||
let drawerLockMode = 'unlocked';
|
||||
if (navigation.state.index > 0 || isSplited()) {
|
||||
drawerLockMode = 'locked-closed';
|
||||
}
|
||||
return {
|
||||
drawerLockMode
|
||||
};
|
||||
};
|
||||
|
||||
const ProfileStack = createStackNavigator({
|
||||
ProfileView: {
|
||||
getScreen: () => require('./views/ProfileView').default
|
||||
}
|
||||
}, {
|
||||
defaultNavigationOptions: defaultHeader,
|
||||
cardStyle
|
||||
});
|
||||
|
||||
ProfileStack.navigationOptions = ({ navigation }) => {
|
||||
let drawerLockMode = 'unlocked';
|
||||
if (navigation.state.index > 0) {
|
||||
drawerLockMode = 'locked-closed';
|
||||
}
|
||||
return {
|
||||
drawerLockMode
|
||||
};
|
||||
};
|
||||
|
||||
const SettingsStack = createStackNavigator({
|
||||
SettingsView: {
|
||||
getScreen: () => require('./views/SettingsView').default
|
||||
},
|
||||
LanguageView: {
|
||||
getScreen: () => require('./views/LanguageView').default
|
||||
},
|
||||
ThemeView: {
|
||||
getScreen: () => require('./views/ThemeView').default
|
||||
},
|
||||
DefaultBrowserView: {
|
||||
getScreen: () => require('./views/DefaultBrowserView').default
|
||||
},
|
||||
ScreenLockConfigView: {
|
||||
getScreen: () => require('./views/ScreenLockConfigView').default
|
||||
}
|
||||
}, {
|
||||
defaultNavigationOptions: defaultHeader,
|
||||
cardStyle
|
||||
});
|
||||
|
||||
const AdminPanelStack = createStackNavigator({
|
||||
AdminPanelView: {
|
||||
getScreen: () => require('./views/AdminPanelView').default
|
||||
}
|
||||
}, {
|
||||
defaultNavigationOptions: defaultHeader,
|
||||
cardStyle
|
||||
});
|
||||
|
||||
SettingsStack.navigationOptions = ({ navigation }) => {
|
||||
let drawerLockMode = 'unlocked';
|
||||
if (navigation.state.index > 0) {
|
||||
drawerLockMode = 'locked-closed';
|
||||
}
|
||||
return {
|
||||
drawerLockMode
|
||||
};
|
||||
};
|
||||
|
||||
const ChatsDrawer = createDrawerNavigator({
|
||||
ChatsStack,
|
||||
ProfileStack,
|
||||
SettingsStack,
|
||||
AdminPanelStack
|
||||
}, {
|
||||
contentComponent: Sidebar,
|
||||
overlayColor: '#00000090'
|
||||
});
|
||||
|
||||
const NewMessageStack = createStackNavigator({
|
||||
NewMessageView: {
|
||||
getScreen: () => require('./views/NewMessageView').default
|
||||
},
|
||||
SelectedUsersViewCreateChannel: {
|
||||
getScreen: () => require('./views/SelectedUsersView').default
|
||||
},
|
||||
CreateChannelView: {
|
||||
getScreen: () => require('./views/CreateChannelView').default
|
||||
}
|
||||
}, {
|
||||
defaultNavigationOptions: defaultHeader,
|
||||
cardStyle
|
||||
});
|
||||
|
||||
const AttachmentStack = createStackNavigator({
|
||||
AttachmentView: {
|
||||
getScreen: () => require('./views/AttachmentView').default
|
||||
}
|
||||
}, {
|
||||
defaultNavigationOptions: defaultHeader,
|
||||
cardStyle
|
||||
});
|
||||
|
||||
const ModalBlockStack = createStackNavigator({
|
||||
ModalBlockView: {
|
||||
getScreen: () => require('./views/ModalBlockView').default
|
||||
}
|
||||
}, {
|
||||
mode: 'modal',
|
||||
defaultNavigationOptions: defaultHeader,
|
||||
cardStyle
|
||||
});
|
||||
|
||||
const CreateDiscussionStack = createStackNavigator({
|
||||
CreateDiscussionView: {
|
||||
getScreen: () => require('./views/CreateDiscussionView').default
|
||||
}
|
||||
}, {
|
||||
defaultNavigationOptions: defaultHeader,
|
||||
cardStyle
|
||||
});
|
||||
|
||||
const StatusStack = createStackNavigator({
|
||||
StatusView: {
|
||||
getScreen: () => require('./views/StatusView').default
|
||||
}
|
||||
}, {
|
||||
defaultNavigationOptions: defaultHeader,
|
||||
cardStyle
|
||||
});
|
||||
|
||||
const InsideStackModal = createStackNavigator({
|
||||
Main: ChatsDrawer,
|
||||
NewMessageStack,
|
||||
AttachmentStack,
|
||||
ModalBlockStack,
|
||||
StatusStack,
|
||||
CreateDiscussionStack,
|
||||
JitsiMeetView: {
|
||||
getScreen: () => require('./views/JitsiMeetView').default
|
||||
}
|
||||
},
|
||||
{
|
||||
mode: 'modal',
|
||||
headerMode: 'none',
|
||||
cardStyle
|
||||
});
|
||||
|
||||
const SetUsernameStack = createStackNavigator({
|
||||
SetUsernameView: {
|
||||
getScreen: () => require('./views/SetUsernameView').default
|
||||
}
|
||||
},
|
||||
{
|
||||
cardStyle
|
||||
});
|
||||
|
||||
class CustomInsideStack extends React.Component {
|
||||
static router = InsideStackModal.router;
|
||||
|
||||
static propTypes = {
|
||||
navigation: PropTypes.object,
|
||||
screenProps: PropTypes.object
|
||||
}
|
||||
|
||||
render() {
|
||||
const { navigation, screenProps } = this.props;
|
||||
return (
|
||||
<>
|
||||
<InsideStackModal navigation={navigation} screenProps={screenProps} />
|
||||
{ !isTablet ? <NotificationBadge navigation={navigation} /> : null }
|
||||
{ !isTablet ? <Toast /> : null }
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class CustomRoomStack extends React.Component {
|
||||
static router = RoomStack.router;
|
||||
|
||||
static propTypes = {
|
||||
navigation: PropTypes.object,
|
||||
screenProps: PropTypes.object
|
||||
}
|
||||
|
||||
render() {
|
||||
const { navigation, screenProps } = this.props;
|
||||
return (
|
||||
<>
|
||||
<RoomStack navigation={navigation} screenProps={screenProps} />
|
||||
<Toast />
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const MessagesStack = createStackNavigator({
|
||||
NewMessageView: {
|
||||
getScreen: () => require('./views/NewMessageView').default
|
||||
},
|
||||
SelectedUsersViewCreateChannel: {
|
||||
getScreen: () => require('./views/SelectedUsersView').default
|
||||
},
|
||||
CreateChannelView: {
|
||||
getScreen: () => require('./views/CreateChannelView').default
|
||||
}
|
||||
}, {
|
||||
defaultNavigationOptions: defaultHeader,
|
||||
cardStyle
|
||||
});
|
||||
|
||||
const DirectoryStack = createStackNavigator({
|
||||
DirectoryView: {
|
||||
getScreen: () => require('./views/DirectoryView').default
|
||||
}
|
||||
}, {
|
||||
defaultNavigationOptions: defaultHeader,
|
||||
cardStyle
|
||||
});
|
||||
|
||||
const SidebarStack = createStackNavigator({
|
||||
SettingsView: {
|
||||
getScreen: () => require('./views/SettingsView').default
|
||||
},
|
||||
ProfileView: {
|
||||
getScreen: () => require('./views/ProfileView').default
|
||||
},
|
||||
AdminPanelView: {
|
||||
getScreen: () => require('./views/AdminPanelView').default
|
||||
},
|
||||
StatusView: {
|
||||
getScreen: () => require('./views/StatusView').default
|
||||
}
|
||||
}, {
|
||||
defaultNavigationOptions: defaultHeader,
|
||||
cardStyle
|
||||
});
|
||||
|
||||
const RoomActionsStack = createStackNavigator({
|
||||
RoomActionsView: {
|
||||
getScreen: () => require('./views/RoomActionsView').default
|
||||
},
|
||||
RoomInfoView: {
|
||||
getScreen: () => require('./views/RoomInfoView').default
|
||||
},
|
||||
RoomInfoEditView: {
|
||||
getScreen: () => require('./views/RoomInfoEditView').default
|
||||
},
|
||||
RoomMembersView: {
|
||||
getScreen: () => require('./views/RoomMembersView').default
|
||||
},
|
||||
SearchMessagesView: {
|
||||
getScreen: () => require('./views/SearchMessagesView').default
|
||||
},
|
||||
SelectedUsersView: {
|
||||
getScreen: () => require('./views/SelectedUsersView').default
|
||||
},
|
||||
MessagesView: {
|
||||
getScreen: () => require('./views/MessagesView').default
|
||||
},
|
||||
AutoTranslateView: {
|
||||
getScreen: () => require('./views/AutoTranslateView').default
|
||||
},
|
||||
ReadReceiptsView: {
|
||||
getScreen: () => require('./views/ReadReceiptView').default
|
||||
},
|
||||
NotificationPrefView: {
|
||||
getScreen: () => require('./views/NotificationPreferencesView').default
|
||||
},
|
||||
AttachmentView: {
|
||||
getScreen: () => require('./views/AttachmentView').default
|
||||
},
|
||||
PickerView: {
|
||||
getScreen: () => require('./views/PickerView').default
|
||||
}
|
||||
}, {
|
||||
defaultNavigationOptions: defaultHeader,
|
||||
cardStyle
|
||||
});
|
||||
|
||||
|
||||
const ModalSwitch = createSwitchNavigator({
|
||||
MessagesStack,
|
||||
DirectoryStack,
|
||||
SidebarStack,
|
||||
RoomActionsStack,
|
||||
SettingsStack,
|
||||
ModalBlockStack,
|
||||
CreateDiscussionStack,
|
||||
AuthLoading: () => null
|
||||
},
|
||||
{
|
||||
initialRouteName: 'AuthLoading'
|
||||
});
|
||||
|
||||
class CustomModalStack extends React.Component {
|
||||
static router = ModalSwitch.router;
|
||||
|
||||
static propTypes = {
|
||||
navigation: PropTypes.object,
|
||||
showModal: PropTypes.bool,
|
||||
closeModal: PropTypes.func,
|
||||
screenProps: PropTypes.object
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.backHandler = BackHandler.addEventListener('hardwareBackPress', this.closeModal);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
this.backHandler.remove();
|
||||
}
|
||||
|
||||
closeModal = () => {
|
||||
const { closeModal, navigation } = this.props;
|
||||
const { state } = navigation;
|
||||
if (state && state.routes[state.index] && state.routes[state.index].index === 0) {
|
||||
closeModal();
|
||||
return true;
|
||||
}
|
||||
if (state && state.routes[state.index] && state.routes[state.index].routes && state.routes[state.index].routes.length > 1) {
|
||||
navigation.goBack();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
navigation, showModal, closeModal, screenProps
|
||||
} = this.props;
|
||||
|
||||
const pageSheetViews = ['AttachmentView'];
|
||||
const pageSheet = pageSheetViews.includes(getActiveRouteName(navigation.state));
|
||||
|
||||
const androidProps = isAndroid && !pageSheet && {
|
||||
style: { marginBottom: 0 }
|
||||
};
|
||||
|
||||
let content = (
|
||||
<View style={[sharedStyles.modal, pageSheet ? sharedStyles.modalPageSheet : sharedStyles.modalFormSheet]}>
|
||||
<ModalSwitch navigation={navigation} screenProps={{ ...screenProps, closeModal: this.closeModal }} />
|
||||
</View>
|
||||
);
|
||||
|
||||
if (isAndroid && !pageSheet) {
|
||||
content = (
|
||||
<ScrollView overScrollMode='never'>
|
||||
{content}
|
||||
</ScrollView>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Modal
|
||||
useNativeDriver
|
||||
coverScreen={false}
|
||||
isVisible={showModal}
|
||||
onBackdropPress={closeModal}
|
||||
hideModalContentWhileAnimating
|
||||
avoidKeyboard
|
||||
{...androidProps}
|
||||
>
|
||||
{content}
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class CustomNotificationStack extends React.Component {
|
||||
static router = InsideStackModal.router;
|
||||
|
||||
static propTypes = {
|
||||
navigation: PropTypes.object,
|
||||
screenProps: PropTypes.object
|
||||
}
|
||||
|
||||
render() {
|
||||
const { navigation, screenProps } = this.props;
|
||||
return <NotificationBadge navigation={navigation} screenProps={screenProps} />;
|
||||
}
|
||||
}
|
||||
|
||||
export const App = createAppContainer(createSwitchNavigator(
|
||||
{
|
||||
OutsideStack: OutsideStackModal,
|
||||
InsideStack: CustomInsideStack,
|
||||
AuthLoading: {
|
||||
getScreen: () => require('./views/AuthLoadingView').default
|
||||
},
|
||||
SetUsernameStack
|
||||
},
|
||||
{
|
||||
initialRouteName: 'AuthLoading'
|
||||
}
|
||||
));
|
||||
|
||||
export const RoomContainer = createAppContainer(CustomRoomStack);
|
||||
|
||||
export const ModalContainer = createAppContainer(CustomModalStack);
|
||||
|
||||
export const NotificationContainer = createAppContainer(CustomNotificationStack);
|
||||
|
||||
export default class Root extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.init();
|
||||
this.initCrashReport();
|
||||
this.state = {
|
||||
split: false,
|
||||
inside: false,
|
||||
showModal: false,
|
||||
theme: defaultTheme(),
|
||||
themePreferences: {
|
||||
currentTheme: supportSystemTheme() ? 'automatic' : 'light',
|
||||
darkLevel: 'dark'
|
||||
}
|
||||
};
|
||||
if (isTablet) {
|
||||
this.initTablet();
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.listenerTimeout = setTimeout(() => {
|
||||
Linking.addEventListener('url', ({ url }) => {
|
||||
const parsedDeepLinkingURL = parseDeepLinking(url);
|
||||
if (parsedDeepLinkingURL) {
|
||||
store.dispatch(deepLinkingOpen(parsedDeepLinkingURL));
|
||||
}
|
||||
});
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
componentDidUpdate(_, prevState) {
|
||||
if (isTablet) {
|
||||
const { split, inside } = this.state;
|
||||
if (inside && split !== prevState.split) {
|
||||
// Reset app on split mode changes
|
||||
Navigation.navigate('RoomsListView');
|
||||
this.closeModal();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
clearTimeout(this.listenerTimeout);
|
||||
|
||||
unsubscribeTheme();
|
||||
|
||||
if (this.onKeyCommands && this.onKeyCommands.remove) {
|
||||
this.onKeyCommands.remove();
|
||||
}
|
||||
}
|
||||
|
||||
init = async() => {
|
||||
RNUserDefaults.objectForKey(THEME_PREFERENCES_KEY).then(this.setTheme);
|
||||
const [notification, deepLinking] = await Promise.all([initializePushNotifications(), Linking.getInitialURL()]);
|
||||
const parsedDeepLinkingURL = parseDeepLinking(deepLinking);
|
||||
store.dispatch(appInitLocalSettings());
|
||||
if (notification) {
|
||||
onNotification(notification);
|
||||
} else if (parsedDeepLinkingURL) {
|
||||
store.dispatch(deepLinkingOpen(parsedDeepLinkingURL));
|
||||
} else {
|
||||
store.dispatch(appInit());
|
||||
}
|
||||
}
|
||||
|
||||
setTheme = (newTheme = {}) => {
|
||||
// change theme state
|
||||
this.setState(prevState => newThemeState(prevState, newTheme), () => {
|
||||
const { themePreferences } = this.state;
|
||||
// subscribe to Appearance changes
|
||||
subscribeTheme(themePreferences, this.setTheme);
|
||||
});
|
||||
}
|
||||
|
||||
initTablet = async() => {
|
||||
initTabletNav(args => this.setState(args));
|
||||
await KeyCommands.setKeyCommands([]);
|
||||
this.onKeyCommands = KeyCommandsEmitter.addListener(
|
||||
'onKeyCommand',
|
||||
command => EventEmitter.emit(KEY_COMMAND, { event: command })
|
||||
);
|
||||
}
|
||||
|
||||
initCrashReport = () => {
|
||||
RocketChat.getAllowCrashReport()
|
||||
.then((allowCrashReport) => {
|
||||
if (!allowCrashReport) {
|
||||
loggerConfig.autoNotify = false;
|
||||
loggerConfig.registerBeforeSendCallback(() => false);
|
||||
analytics().setAnalyticsCollectionEnabled(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onLayout = ({ nativeEvent: { layout: { width } } }) => (isTablet ? this.setSplit(width) : null);
|
||||
|
||||
setSplit = (width) => {
|
||||
this.setState({ split: width > MIN_WIDTH_SPLIT_LAYOUT });
|
||||
setWidth(width);
|
||||
}
|
||||
|
||||
closeModal = () => this.setState({ showModal: false });
|
||||
|
||||
render() {
|
||||
const { split, themePreferences, theme } = this.state;
|
||||
|
||||
let content = (
|
||||
<App
|
||||
ref={(navigatorRef) => {
|
||||
Navigation.setTopLevelNavigator(navigatorRef);
|
||||
}}
|
||||
screenProps={{ split, theme }}
|
||||
onNavigationStateChange={onNavigationStateChange}
|
||||
/>
|
||||
);
|
||||
|
||||
if (isTablet) {
|
||||
const { inside, showModal } = this.state;
|
||||
content = (
|
||||
<SplitContext.Provider value={{ split }}>
|
||||
<Tablet
|
||||
theme={theme}
|
||||
tablet={split}
|
||||
inside={inside}
|
||||
showModal={showModal}
|
||||
closeModal={this.closeModal}
|
||||
onLayout={this.onLayout}
|
||||
>
|
||||
{content}
|
||||
</Tablet>
|
||||
</SplitContext.Provider>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<AppearanceProvider>
|
||||
<Provider store={store}>
|
||||
<ThemeContext.Provider
|
||||
value={{
|
||||
theme,
|
||||
themePreferences,
|
||||
setTheme: this.setTheme
|
||||
}}
|
||||
>
|
||||
{content}
|
||||
<TwoFactor />
|
||||
<ScreenLockedView />
|
||||
<ChangePasscodeView />
|
||||
</ThemeContext.Provider>
|
||||
</Provider>
|
||||
</AppearanceProvider>
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
import { NavigationActions } from 'react-navigation';
|
||||
import { CommonActions } from '@react-navigation/native';
|
||||
|
||||
let _navigatorModal;
|
||||
|
||||
|
@ -6,10 +6,10 @@ function setTopLevelNavigator(navigatorRef) {
|
|||
_navigatorModal = navigatorRef;
|
||||
}
|
||||
|
||||
function navigate(routeName, params) {
|
||||
function navigate(name, params) {
|
||||
_navigatorModal.dispatch(
|
||||
NavigationActions.navigate({
|
||||
routeName,
|
||||
CommonActions.navigate({
|
||||
name,
|
||||
params
|
||||
})
|
||||
);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { NavigationActions } from 'react-navigation';
|
||||
import { CommonActions } from '@react-navigation/native';
|
||||
|
||||
let _navigator;
|
||||
|
||||
|
@ -8,14 +8,14 @@ function setTopLevelNavigator(navigatorRef) {
|
|||
|
||||
function back() {
|
||||
_navigator.dispatch(
|
||||
NavigationActions.back()
|
||||
CommonActions.back()
|
||||
);
|
||||
}
|
||||
|
||||
function navigate(routeName, params) {
|
||||
function navigate(name, params) {
|
||||
_navigator.dispatch(
|
||||
NavigationActions.navigate({
|
||||
routeName,
|
||||
CommonActions.navigate({
|
||||
name,
|
||||
params
|
||||
})
|
||||
);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { NavigationActions } from 'react-navigation';
|
||||
import { NavigationActions } from '@react-navigation/native';
|
||||
|
||||
let _shareNavigator;
|
||||
|
||||
|
|
|
@ -0,0 +1,179 @@
|
|||
import React, { useState, useContext } from 'react';
|
||||
import { View } from 'react-native';
|
||||
import { NavigationContainer } from '@react-navigation/native';
|
||||
import { AppearanceProvider } from 'react-native-appearance';
|
||||
import { createStackNavigator } from '@react-navigation/stack';
|
||||
import { Provider } from 'react-redux';
|
||||
import RNUserDefaults from 'rn-user-defaults';
|
||||
|
||||
import {
|
||||
defaultTheme,
|
||||
newThemeState,
|
||||
subscribeTheme,
|
||||
unsubscribeTheme
|
||||
} from './utils/theme';
|
||||
import Navigation from './lib/ShareNavigation';
|
||||
import store from './lib/createStore';
|
||||
import sharedStyles from './views/Styles';
|
||||
import { isNotch, isIOS, supportSystemTheme } from './utils/deviceInfo';
|
||||
import { defaultHeader, onNavigationStateChange, themedHeader } from './utils/navigation';
|
||||
import RocketChat, { THEME_PREFERENCES_KEY } from './lib/rocketchat';
|
||||
import { ThemeContext } from './theme';
|
||||
|
||||
// Outside Stack
|
||||
import AuthLoadingView from './views/AuthLoadingView';
|
||||
import WithoutServersView from './views/WithoutServersView';
|
||||
|
||||
// Inside Stack
|
||||
import ShareListView from './views/ShareListView';
|
||||
import ShareView from './views/ShareView';
|
||||
import SelectServerView from './views/SelectServerView';
|
||||
|
||||
const Inside = createStackNavigator();
|
||||
const InsideStack = () => {
|
||||
const { theme } = useContext(ThemeContext);
|
||||
|
||||
return (
|
||||
<Inside.Navigator screenOptions={{ ...defaultHeader, ...themedHeader(theme) }}>
|
||||
<Inside.Screen
|
||||
name='ShareListView'
|
||||
component={ShareListView}
|
||||
options={props => ShareListView.navigationOptions({ ...props, theme })}
|
||||
/>
|
||||
<Inside.Screen
|
||||
name='ShareView'
|
||||
component={ShareView}
|
||||
options={ShareView.navigationOptions}
|
||||
/>
|
||||
<Inside.Screen
|
||||
name='SelectServerView'
|
||||
component={SelectServerView}
|
||||
options={SelectServerView.navigationOptions}
|
||||
/>
|
||||
</Inside.Navigator>
|
||||
);
|
||||
};
|
||||
|
||||
const Outside = createStackNavigator();
|
||||
const OutsideStack = () => {
|
||||
const { theme } = useContext(ThemeContext);
|
||||
|
||||
return (
|
||||
<Outside.Navigator screenOptions={{ ...defaultHeader, ...themedHeader(theme) }}>
|
||||
<Outside.Screen
|
||||
name='WithoutServersView'
|
||||
component={WithoutServersView}
|
||||
options={WithoutServersView.navigationOptions}
|
||||
/>
|
||||
</Outside.Navigator>
|
||||
);
|
||||
};
|
||||
|
||||
const AuthContext = React.createContext();
|
||||
|
||||
// App
|
||||
const Stack = createStackNavigator();
|
||||
export const App = () => {
|
||||
const [loading] = useState(false);
|
||||
|
||||
return (
|
||||
<AuthContext.Provider value={{}}>
|
||||
<Stack.Navigator screenOptions={{ headerShown: false }}>
|
||||
{loading ? (
|
||||
<Stack.Screen
|
||||
name='AuthLoading'
|
||||
component={AuthLoadingView}
|
||||
/>
|
||||
) : (
|
||||
<>
|
||||
<Stack.Screen
|
||||
name='OutsideStack'
|
||||
component={OutsideStack}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name='InsideStack'
|
||||
component={InsideStack}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</Stack.Navigator>
|
||||
</AuthContext.Provider>
|
||||
);
|
||||
};
|
||||
|
||||
class Root extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
isLandscape: false,
|
||||
theme: defaultTheme(),
|
||||
themePreferences: {
|
||||
currentTheme: supportSystemTheme() ? 'automatic' : 'light',
|
||||
darkLevel: 'dark'
|
||||
}
|
||||
};
|
||||
this.init();
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
RocketChat.closeShareExtension();
|
||||
unsubscribeTheme();
|
||||
}
|
||||
|
||||
init = async() => {
|
||||
if (isIOS) {
|
||||
await RNUserDefaults.setName('group.ios.chat.rocket');
|
||||
}
|
||||
RNUserDefaults.objectForKey(THEME_PREFERENCES_KEY).then(this.setTheme);
|
||||
const currentServer = await RNUserDefaults.get('currentServer');
|
||||
const token = await RNUserDefaults.get(RocketChat.TOKEN_KEY);
|
||||
|
||||
if (currentServer && token) {
|
||||
await Navigation.navigate('InsideStack');
|
||||
await RocketChat.shareExtensionInit(currentServer);
|
||||
} else {
|
||||
await Navigation.navigate('OutsideStack');
|
||||
}
|
||||
}
|
||||
|
||||
setTheme = (newTheme = {}) => {
|
||||
// change theme state
|
||||
this.setState(prevState => newThemeState(prevState, newTheme), () => {
|
||||
const { themePreferences } = this.state;
|
||||
// subscribe to Appearance changes
|
||||
subscribeTheme(themePreferences, this.setTheme);
|
||||
});
|
||||
}
|
||||
|
||||
handleLayout = (event) => {
|
||||
const { width, height } = event.nativeEvent.layout;
|
||||
this.setState({ isLandscape: width > height });
|
||||
}
|
||||
|
||||
render() {
|
||||
const { isLandscape, theme } = this.state;
|
||||
return (
|
||||
<AppearanceProvider>
|
||||
<View
|
||||
style={[sharedStyles.container, isLandscape && isNotch ? sharedStyles.notchLandscapeContainer : {}]}
|
||||
onLayout={this.handleLayout}
|
||||
>
|
||||
<Provider store={store}>
|
||||
<ThemeContext.Provider value={{ theme }}>
|
||||
<NavigationContainer
|
||||
ref={(navigatorRef) => {
|
||||
Navigation.setTopLevelNavigator(navigatorRef);
|
||||
}}
|
||||
onNavigationStateChange={onNavigationStateChange}
|
||||
>
|
||||
<App />
|
||||
</NavigationContainer>
|
||||
</ThemeContext.Provider>
|
||||
</Provider>
|
||||
</View>
|
||||
</AppearanceProvider>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default Root;
|
135
app/share.js_
135
app/share.js_
|
@ -1,135 +0,0 @@
|
|||
import React from 'react';
|
||||
import { View } from 'react-native';
|
||||
import { createAppContainer, createSwitchNavigator } from 'react-navigation';
|
||||
import { AppearanceProvider } from 'react-native-appearance';
|
||||
import { createStackNavigator } from 'react-navigation-stack';
|
||||
import { Provider } from 'react-redux';
|
||||
import RNUserDefaults from 'rn-user-defaults';
|
||||
|
||||
import {
|
||||
defaultTheme,
|
||||
newThemeState,
|
||||
subscribeTheme,
|
||||
unsubscribeTheme
|
||||
} from './utils/theme';
|
||||
import Navigation from './lib/ShareNavigation';
|
||||
import store from './lib/createStore';
|
||||
import sharedStyles from './views/Styles';
|
||||
import { hasNotch, supportSystemTheme } from './utils/deviceInfo';
|
||||
import { defaultHeader, onNavigationStateChange, cardStyle } from './utils/navigation';
|
||||
import RocketChat, { THEME_PREFERENCES_KEY } from './lib/rocketchat';
|
||||
import { ThemeContext } from './theme';
|
||||
import { localAuthenticate } from './utils/localAuthentication';
|
||||
import ScreenLockedView from './views/ScreenLockedView';
|
||||
|
||||
const InsideNavigator = createStackNavigator({
|
||||
ShareListView: {
|
||||
getScreen: () => require('./views/ShareListView').default
|
||||
},
|
||||
ShareView: {
|
||||
getScreen: () => require('./views/ShareView').default
|
||||
},
|
||||
SelectServerView: {
|
||||
getScreen: () => require('./views/SelectServerView').default
|
||||
}
|
||||
}, {
|
||||
initialRouteName: 'ShareListView',
|
||||
defaultNavigationOptions: defaultHeader,
|
||||
cardStyle
|
||||
});
|
||||
|
||||
const OutsideNavigator = createStackNavigator({
|
||||
WithoutServersView: {
|
||||
getScreen: () => require('./views/WithoutServersView').default
|
||||
}
|
||||
}, {
|
||||
initialRouteName: 'WithoutServersView',
|
||||
defaultNavigationOptions: defaultHeader,
|
||||
cardStyle
|
||||
});
|
||||
|
||||
const AppContainer = createAppContainer(createSwitchNavigator({
|
||||
OutsideStack: OutsideNavigator,
|
||||
InsideStack: InsideNavigator,
|
||||
AuthLoading: {
|
||||
getScreen: () => require('./views/AuthLoadingView').default
|
||||
}
|
||||
},
|
||||
{
|
||||
initialRouteName: 'AuthLoading'
|
||||
}));
|
||||
|
||||
class Root extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
isLandscape: false,
|
||||
theme: defaultTheme(),
|
||||
themePreferences: {
|
||||
currentTheme: supportSystemTheme() ? 'automatic' : 'light',
|
||||
darkLevel: 'dark'
|
||||
}
|
||||
};
|
||||
this.init();
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
RocketChat.closeShareExtension();
|
||||
unsubscribeTheme();
|
||||
}
|
||||
|
||||
init = async() => {
|
||||
RNUserDefaults.objectForKey(THEME_PREFERENCES_KEY).then(this.setTheme);
|
||||
const currentServer = await RNUserDefaults.get('currentServer');
|
||||
const token = await RNUserDefaults.get(RocketChat.TOKEN_KEY);
|
||||
|
||||
if (currentServer && token) {
|
||||
await localAuthenticate(currentServer);
|
||||
await Navigation.navigate('InsideStack');
|
||||
await RocketChat.shareExtensionInit(currentServer);
|
||||
} else {
|
||||
await Navigation.navigate('OutsideStack');
|
||||
}
|
||||
}
|
||||
|
||||
setTheme = (newTheme = {}) => {
|
||||
// change theme state
|
||||
this.setState(prevState => newThemeState(prevState, newTheme), () => {
|
||||
const { themePreferences } = this.state;
|
||||
// subscribe to Appearance changes
|
||||
subscribeTheme(themePreferences, this.setTheme);
|
||||
});
|
||||
}
|
||||
|
||||
handleLayout = (event) => {
|
||||
const { width, height } = event.nativeEvent.layout;
|
||||
this.setState({ isLandscape: width > height });
|
||||
}
|
||||
|
||||
render() {
|
||||
const { isLandscape, theme } = this.state;
|
||||
return (
|
||||
<AppearanceProvider>
|
||||
<View
|
||||
style={[sharedStyles.container, isLandscape && hasNotch ? sharedStyles.notchLandscapeContainer : {}]}
|
||||
onLayout={this.handleLayout}
|
||||
>
|
||||
<Provider store={store}>
|
||||
<ThemeContext.Provider value={{ theme }}>
|
||||
<AppContainer
|
||||
ref={(navigatorRef) => {
|
||||
Navigation.setTopLevelNavigator(navigatorRef);
|
||||
}}
|
||||
onNavigationStateChange={onNavigationStateChange}
|
||||
screenProps={{ theme }}
|
||||
/>
|
||||
<ScreenLockedView />
|
||||
</ThemeContext.Provider>
|
||||
</Provider>
|
||||
</View>
|
||||
</AppearanceProvider>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default Root;
|
|
@ -0,0 +1,300 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { createStackNavigator } from '@react-navigation/stack';
|
||||
import { createDrawerNavigator } from '@react-navigation/drawer';
|
||||
|
||||
import { ThemeContext } from '../theme';
|
||||
import { SplitContext } from '../split';
|
||||
import { defaultHeader, themedHeader } from '../utils/navigation';
|
||||
import Toast from '../containers/Toast';
|
||||
import Sidebar from '../views/SidebarView';
|
||||
import NotificationBadge from '../notifications/inApp';
|
||||
|
||||
// Chats Stack
|
||||
import RoomView from '../views/RoomView';
|
||||
import RoomsListView from '../views/RoomsListView';
|
||||
import RoomActionsView from '../views/RoomActionsView';
|
||||
import RoomInfoView from '../views/RoomInfoView';
|
||||
import RoomInfoEditView from '../views/RoomInfoEditView';
|
||||
import RoomMembersView from '../views/RoomMembersView';
|
||||
import SearchMessagesView from '../views/SearchMessagesView';
|
||||
import SelectedUsersView from '../views/SelectedUsersView';
|
||||
import InviteUsersView from '../views/InviteUsersView';
|
||||
import InviteUsersEditView from '../views/InviteUsersEditView';
|
||||
import MessagesView from '../views/MessagesView';
|
||||
import AutoTranslateView from '../views/AutoTranslateView';
|
||||
import DirectoryView from '../views/DirectoryView';
|
||||
import NotificationPrefView from '../views/NotificationPreferencesView';
|
||||
import ThreadMessagesView from '../views/ThreadMessagesView';
|
||||
import MarkdownTableView from '../views/MarkdownTableView';
|
||||
import ReadReceiptsView from '../views/ReadReceiptView';
|
||||
|
||||
// Profile Stack
|
||||
import ProfileView from '../views/ProfileView';
|
||||
|
||||
// Settings Stack
|
||||
import SettingsView from '../views/SettingsView';
|
||||
import LanguageView from '../views/LanguageView';
|
||||
import ThemeView from '../views/ThemeView';
|
||||
import DefaultBrowserView from '../views/DefaultBrowserView';
|
||||
|
||||
// Admin Stack
|
||||
import AdminPanelView from '../views/AdminPanelView';
|
||||
|
||||
// NewMessage Stack
|
||||
import NewMessageView from '../views/NewMessageView';
|
||||
import CreateChannelView from '../views/CreateChannelView';
|
||||
|
||||
// InsideStackModal
|
||||
import AttachmentView from '../views/AttachmentView';
|
||||
import ModalBlockView from '../views/ModalBlockView';
|
||||
import JitsiMeetView from '../views/JitsiMeetView';
|
||||
|
||||
// ChatsStack
|
||||
const Chats = createStackNavigator();
|
||||
const ChatsStack = () => {
|
||||
const { theme } = React.useContext(ThemeContext);
|
||||
const { split } = React.useContext(SplitContext);
|
||||
|
||||
return (
|
||||
<Chats.Navigator screenOptions={{ ...defaultHeader, ...themedHeader(theme) }}>
|
||||
<Chats.Screen
|
||||
name='RoomsListView'
|
||||
component={RoomsListView}
|
||||
options={RoomsListView.navigationOptions}
|
||||
/>
|
||||
<Chats.Screen
|
||||
name='RoomActionsView'
|
||||
component={RoomActionsView}
|
||||
options={RoomActionsView.navigationOptions}
|
||||
/>
|
||||
<Chats.Screen
|
||||
name='RoomInfoView'
|
||||
component={RoomInfoView}
|
||||
options={RoomInfoView.navigationOptions}
|
||||
/>
|
||||
<Chats.Screen
|
||||
name='RoomInfoEditView'
|
||||
component={RoomInfoEditView}
|
||||
options={RoomInfoEditView.navigationOptions}
|
||||
/>
|
||||
<Chats.Screen
|
||||
name='RoomMembersView'
|
||||
component={RoomMembersView}
|
||||
options={RoomMembersView.navigationOptions}
|
||||
/>
|
||||
<Chats.Screen
|
||||
name='SearchMessagesView'
|
||||
component={SearchMessagesView}
|
||||
options={SearchMessagesView.navigationOptions}
|
||||
/>
|
||||
<Chats.Screen
|
||||
name='SelectedUsersView'
|
||||
component={SelectedUsersView}
|
||||
options={SelectedUsersView.navigationOptions}
|
||||
/>
|
||||
<Chats.Screen
|
||||
name='InviteUsersView'
|
||||
component={InviteUsersView}
|
||||
options={InviteUsersView.navigationOptions}
|
||||
/>
|
||||
<Chats.Screen
|
||||
name='InviteUsersEditView'
|
||||
component={InviteUsersEditView}
|
||||
options={InviteUsersEditView.navigationOptions}
|
||||
/>
|
||||
<Chats.Screen
|
||||
name='MessagesView'
|
||||
component={MessagesView}
|
||||
options={MessagesView.navigationOptions}
|
||||
/>
|
||||
<Chats.Screen
|
||||
name='AutoTranslateView'
|
||||
component={AutoTranslateView}
|
||||
options={AutoTranslateView.navigationOptions}
|
||||
/>
|
||||
<Chats.Screen
|
||||
name='DirectoryView'
|
||||
component={DirectoryView}
|
||||
options={props => DirectoryView.navigationOptions({ ...props, split })}
|
||||
/>
|
||||
<Chats.Screen
|
||||
name='NotificationPrefView'
|
||||
component={NotificationPrefView}
|
||||
options={NotificationPrefView.navigationOptions}
|
||||
/>
|
||||
<Chats.Screen
|
||||
name='RoomView'
|
||||
component={RoomView}
|
||||
options={RoomView.navigationOptions}
|
||||
/>
|
||||
<Chats.Screen
|
||||
name='ThreadMessagesView'
|
||||
component={ThreadMessagesView}
|
||||
options={ThreadMessagesView.navigationOptions}
|
||||
/>
|
||||
<Chats.Screen
|
||||
name='MarkdownTableView'
|
||||
component={MarkdownTableView}
|
||||
options={MarkdownTableView.navigationOptions}
|
||||
/>
|
||||
<Chats.Screen
|
||||
name='ReadReceiptsView'
|
||||
component={ReadReceiptsView}
|
||||
options={ReadReceiptsView.navigationOptions}
|
||||
/>
|
||||
</Chats.Navigator>
|
||||
);
|
||||
};
|
||||
|
||||
// ProfileStack
|
||||
const Profile = createStackNavigator();
|
||||
const ProfileStack = () => {
|
||||
const { theme } = React.useContext(ThemeContext);
|
||||
const { split } = React.useContext(SplitContext);
|
||||
|
||||
return (
|
||||
<Profile.Navigator screenOptions={{ ...defaultHeader, ...themedHeader(theme) }}>
|
||||
<Profile.Screen
|
||||
name='ProfileView'
|
||||
component={ProfileView}
|
||||
options={props => ProfileView.navigationOptions({ ...props, split })}
|
||||
/>
|
||||
</Profile.Navigator>
|
||||
);
|
||||
};
|
||||
|
||||
// SettingsStack
|
||||
const Settings = createStackNavigator();
|
||||
const SettingsStack = () => {
|
||||
const { theme } = React.useContext(ThemeContext);
|
||||
const { split } = React.useContext(SplitContext);
|
||||
|
||||
return (
|
||||
<Settings.Navigator screenOptions={{ ...defaultHeader, ...themedHeader(theme) }}>
|
||||
<Settings.Screen
|
||||
name='SettingsView'
|
||||
component={SettingsView}
|
||||
options={props => SettingsView.navigationOptions({ ...props, split })}
|
||||
/>
|
||||
<Settings.Screen
|
||||
name='LanguageView'
|
||||
component={LanguageView}
|
||||
options={LanguageView.navigationOptions}
|
||||
/>
|
||||
<Settings.Screen
|
||||
name='ThemeView'
|
||||
component={ThemeView}
|
||||
options={ThemeView.navigationOptions}
|
||||
/>
|
||||
<Settings.Screen
|
||||
name='DefaultBrowserView'
|
||||
component={DefaultBrowserView}
|
||||
options={DefaultBrowserView.navigationOptions}
|
||||
/>
|
||||
</Settings.Navigator>
|
||||
);
|
||||
};
|
||||
|
||||
// AdminPanelStack
|
||||
const AdminPanel = createStackNavigator();
|
||||
const AdminPanelStack = () => {
|
||||
const { theme } = React.useContext(ThemeContext);
|
||||
|
||||
return (
|
||||
<AdminPanel.Navigator screenOptions={{ ...defaultHeader, ...themedHeader(theme) }}>
|
||||
<AdminPanel.Screen
|
||||
name='AdminPanelView'
|
||||
component={AdminPanelView}
|
||||
options={AdminPanelView.navigationOptions}
|
||||
/>
|
||||
</AdminPanel.Navigator>
|
||||
);
|
||||
};
|
||||
|
||||
// ChatsDrawer
|
||||
const Drawer = createDrawerNavigator();
|
||||
const ChatsDrawer = () => (
|
||||
<Drawer.Navigator drawerContent={({ navigation, state }) => <Sidebar navigation={navigation} state={state} />}>
|
||||
<Drawer.Screen name='ChatsStack' component={ChatsStack} />
|
||||
<Drawer.Screen name='ProfileStack' component={ProfileStack} />
|
||||
<Drawer.Screen name='SettingsStack' component={SettingsStack} />
|
||||
<Drawer.Screen name='AdminPanelStack' component={AdminPanelStack} />
|
||||
</Drawer.Navigator>
|
||||
);
|
||||
|
||||
// NewMessageStack
|
||||
const NewMessage = createStackNavigator();
|
||||
const NewMessageStack = () => {
|
||||
const { theme } = React.useContext(ThemeContext);
|
||||
|
||||
return (
|
||||
<NewMessage.Navigator screenOptions={{ ...defaultHeader, ...themedHeader(theme) }}>
|
||||
<NewMessage.Screen
|
||||
name='NewMessageView'
|
||||
component={NewMessageView}
|
||||
options={NewMessageView.navigationOptions}
|
||||
/>
|
||||
<NewMessage.Screen
|
||||
name='SelectedUsersViewCreateChannel'
|
||||
component={SelectedUsersView}
|
||||
options={SelectedUsersView.navigationOptions}
|
||||
/>
|
||||
<NewMessage.Screen
|
||||
name='CreateChannelView'
|
||||
component={CreateChannelView}
|
||||
options={CreateChannelView.navigationOptions}
|
||||
/>
|
||||
</NewMessage.Navigator>
|
||||
);
|
||||
};
|
||||
|
||||
// InsideStackModal
|
||||
const InsideStack = createStackNavigator();
|
||||
const InsideStackModal = () => {
|
||||
const { theme } = React.useContext(ThemeContext);
|
||||
|
||||
return (
|
||||
<InsideStack.Navigator mode='modal' screenOptions={{ ...defaultHeader, ...themedHeader(theme) }}>
|
||||
<InsideStack.Screen
|
||||
name='ChatsDrawer'
|
||||
component={ChatsDrawer}
|
||||
options={{ headerShown: false }}
|
||||
/>
|
||||
<InsideStack.Screen
|
||||
name='NewMessageStack'
|
||||
component={NewMessageStack}
|
||||
options={{ headerShown: false }}
|
||||
/>
|
||||
<InsideStack.Screen
|
||||
name='AttachmentView'
|
||||
component={AttachmentView}
|
||||
options={AttachmentView.navigationOptions}
|
||||
/>
|
||||
<InsideStack.Screen
|
||||
name='ModalBlockView'
|
||||
component={ModalBlockView}
|
||||
options={ModalBlockView.navigationOptions}
|
||||
/>
|
||||
<InsideStack.Screen
|
||||
name='JitsiMeetView'
|
||||
component={JitsiMeetView}
|
||||
options={{ headerShown: false }}
|
||||
/>
|
||||
</InsideStack.Navigator>
|
||||
);
|
||||
};
|
||||
|
||||
const CustomInsideStack = ({ navigation, route }) => (
|
||||
<>
|
||||
<InsideStackModal navigation={navigation} />
|
||||
<NotificationBadge navigation={navigation} route={route} />
|
||||
<Toast />
|
||||
</>
|
||||
);
|
||||
CustomInsideStack.propTypes = {
|
||||
navigation: PropTypes.object,
|
||||
route: PropTypes.object
|
||||
};
|
||||
|
||||
export default CustomInsideStack;
|
|
@ -0,0 +1,84 @@
|
|||
import React from 'react';
|
||||
import { createStackNavigator } from '@react-navigation/stack';
|
||||
|
||||
import { ThemeContext } from '../theme';
|
||||
import { defaultHeader, themedHeader } from '../utils/navigation';
|
||||
|
||||
// Outside Stack
|
||||
import OnboardingView from '../views/OnboardingView';
|
||||
import NewServerView from '../views/NewServerView';
|
||||
import WorkspaceView from '../views/WorkspaceView';
|
||||
import LoginView from '../views/LoginView';
|
||||
import ForgotPasswordView from '../views/ForgotPasswordView';
|
||||
import RegisterView from '../views/RegisterView';
|
||||
import LegalView from '../views/LegalView';
|
||||
import AuthenticationWebView from '../views/AuthenticationWebView';
|
||||
|
||||
// Outside
|
||||
const Outside = createStackNavigator();
|
||||
const OutsideStack = () => {
|
||||
const { theme } = React.useContext(ThemeContext);
|
||||
|
||||
return (
|
||||
<Outside.Navigator screenOptions={{ ...defaultHeader, ...themedHeader(theme) }}>
|
||||
<Outside.Screen
|
||||
name='OnboardingView'
|
||||
component={OnboardingView}
|
||||
// options={{ headerShown: false }}
|
||||
/>
|
||||
<Outside.Screen
|
||||
name='NewServerView'
|
||||
component={NewServerView}
|
||||
// options={{ headerShown: false }}
|
||||
/>
|
||||
<Outside.Screen
|
||||
name='WorkspaceView'
|
||||
component={WorkspaceView}
|
||||
// options={WorkspaceView.navigationOptions}
|
||||
/>
|
||||
<Outside.Screen
|
||||
name='LoginView'
|
||||
component={LoginView}
|
||||
// options={LoginView.navigationOptions}
|
||||
/>
|
||||
<Outside.Screen
|
||||
name='ForgotPasswordView'
|
||||
component={ForgotPasswordView}
|
||||
// options={ForgotPasswordView.navigationOptions}
|
||||
/>
|
||||
<Outside.Screen
|
||||
name='RegisterView'
|
||||
component={RegisterView}
|
||||
// options={RegisterView.navigationOptions}
|
||||
/>
|
||||
<Outside.Screen
|
||||
name='LegalView'
|
||||
component={LegalView}
|
||||
// options={LegalView.navigationOptions}
|
||||
/>
|
||||
</Outside.Navigator>
|
||||
);
|
||||
};
|
||||
|
||||
// OutsideStackModal
|
||||
const OutsideModal = createStackNavigator();
|
||||
const OutsideStackModal = () => {
|
||||
const { theme } = React.useContext(ThemeContext);
|
||||
|
||||
return (
|
||||
<OutsideModal.Navigator mode='modal' screenOptions={{ ...defaultHeader, ...themedHeader(theme) }}>
|
||||
<OutsideModal.Screen
|
||||
name='OutsideStack'
|
||||
component={OutsideStack}
|
||||
options={{ headerShown: false }}
|
||||
/>
|
||||
<OutsideModal.Screen
|
||||
name='AuthenticationWebView'
|
||||
component={AuthenticationWebView}
|
||||
options={AuthenticationWebView.navigationOptions}
|
||||
/>
|
||||
</OutsideModal.Navigator>
|
||||
);
|
||||
};
|
||||
|
||||
export default OutsideStackModal;
|
|
@ -1,14 +1,12 @@
|
|||
import React from 'react';
|
||||
import { View } from 'react-native';
|
||||
import PropTypes from 'prop-types';
|
||||
import { NavigationActions, StackActions } from 'react-navigation';
|
||||
import { NavigationActions, StackActions } from '@react-navigation/native';
|
||||
import KeyCommands from 'react-native-keycommands';
|
||||
|
||||
import Navigation from './lib/Navigation';
|
||||
import { isSplited } from './utils/deviceInfo';
|
||||
import {
|
||||
App, RoomContainer, ModalContainer, NotificationContainer
|
||||
} from './index.js';
|
||||
import { App } from './index';
|
||||
import { MAX_SIDEBAR_WIDTH } from './constants/tablet';
|
||||
import ModalNavigation from './lib/ModalNavigation';
|
||||
import { keyCommands, defaultCommands } from './commands';
|
||||
|
@ -24,61 +22,61 @@ export const initTabletNav = (setState) => {
|
|||
let inCall = false;
|
||||
|
||||
const defaultApp = App.router.getStateForAction;
|
||||
const defaultModal = ModalContainer.router.getStateForAction;
|
||||
const defaultRoom = RoomContainer.router.getStateForAction;
|
||||
const defaultNotification = NotificationContainer.router.getStateForAction;
|
||||
// const defaultModal = ModalContainer.router.getStateForAction;
|
||||
// const defaultRoom = RoomContainer.router.getStateForAction;
|
||||
// const defaultNotification = NotificationContainer.router.getStateForAction;
|
||||
|
||||
NotificationContainer.router.getStateForAction = (action, state) => {
|
||||
if (action.type === NavigationActions.NAVIGATE && isSplited()) {
|
||||
const { routeName, params } = action;
|
||||
if (routeName === 'RoomView') {
|
||||
const resetAction = StackActions.reset({
|
||||
index: 0,
|
||||
actions: [NavigationActions.navigate({ routeName, params })]
|
||||
});
|
||||
roomRef.dispatch(resetAction);
|
||||
}
|
||||
}
|
||||
return defaultNotification(action, state);
|
||||
};
|
||||
// NotificationContainer.router.getStateForAction = (action, state) => {
|
||||
// if (action.type === NavigationActions.NAVIGATE && isSplited()) {
|
||||
// const { routeName, params } = action;
|
||||
// if (routeName === 'RoomView') {
|
||||
// const resetAction = StackActions.reset({
|
||||
// index: 0,
|
||||
// actions: [NavigationActions.navigate({ routeName, params })]
|
||||
// });
|
||||
// roomRef.dispatch(resetAction);
|
||||
// }
|
||||
// }
|
||||
// return defaultNotification(action, state);
|
||||
// };
|
||||
|
||||
RoomContainer.router.getStateForAction = (action, state) => {
|
||||
if (action.type === NavigationActions.NAVIGATE && isSplited()) {
|
||||
const { routeName, params } = action;
|
||||
if (routeName === 'RoomActionsView') {
|
||||
modalRef.dispatch(NavigationActions.navigate({ routeName, params }));
|
||||
setState({ showModal: true });
|
||||
return null;
|
||||
}
|
||||
if (routeName === 'AttachmentView') {
|
||||
modalRef.dispatch(NavigationActions.navigate({ routeName, params }));
|
||||
setState({ showModal: true });
|
||||
return null;
|
||||
}
|
||||
}
|
||||
if (action.type === 'Navigation/RESET' && isSplited()) {
|
||||
const { params } = action.actions[action.index];
|
||||
const routes = state.routes[state.index] && state.routes[state.index].params;
|
||||
if (params && params.rid && routes && routes.rid && params.rid === routes.rid) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return defaultRoom(action, state);
|
||||
};
|
||||
// RoomContainer.router.getStateForAction = (action, state) => {
|
||||
// if (action.type === NavigationActions.NAVIGATE && isSplited()) {
|
||||
// const { routeName, params } = action;
|
||||
// if (routeName === 'RoomActionsView') {
|
||||
// modalRef.dispatch(NavigationActions.navigate({ routeName, params }));
|
||||
// setState({ showModal: true });
|
||||
// return null;
|
||||
// }
|
||||
// if (routeName === 'AttachmentView') {
|
||||
// modalRef.dispatch(NavigationActions.navigate({ routeName, params }));
|
||||
// setState({ showModal: true });
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
// if (action.type === 'Navigation/RESET' && isSplited()) {
|
||||
// const { params } = action.actions[action.index];
|
||||
// const routes = state.routes[state.index] && state.routes[state.index].params;
|
||||
// if (params && params.rid && routes && routes.rid && params.rid === routes.rid) {
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
// return defaultRoom(action, state);
|
||||
// };
|
||||
|
||||
ModalContainer.router.getStateForAction = (action, state) => {
|
||||
if (action.type === 'Navigation/POP' && isSplited()) {
|
||||
modalRef.dispatch(NavigationActions.navigate({ routeName: 'AuthLoading' }));
|
||||
setState({ showModal: false });
|
||||
}
|
||||
if (action.type === NavigationActions.NAVIGATE && isSplited()) {
|
||||
const { routeName, params } = action;
|
||||
if (routeName === 'RoomView') {
|
||||
Navigation.navigate(routeName, params);
|
||||
}
|
||||
}
|
||||
return defaultModal(action, state);
|
||||
};
|
||||
// ModalContainer.router.getStateForAction = (action, state) => {
|
||||
// if (action.type === 'Navigation/POP' && isSplited()) {
|
||||
// modalRef.dispatch(NavigationActions.navigate({ routeName: 'AuthLoading' }));
|
||||
// setState({ showModal: false });
|
||||
// }
|
||||
// if (action.type === NavigationActions.NAVIGATE && isSplited()) {
|
||||
// const { routeName, params } = action;
|
||||
// if (routeName === 'RoomView') {
|
||||
// Navigation.navigate(routeName, params);
|
||||
// }
|
||||
// }
|
||||
// return defaultModal(action, state);
|
||||
// };
|
||||
|
||||
App.router.getStateForAction = (action, state) => {
|
||||
if (action.type === NavigationActions.NAVIGATE) {
|
||||
|
@ -108,15 +106,16 @@ export const initTabletNav = (setState) => {
|
|||
KeyCommands.deleteKeyCommands([...defaultCommands, ...keyCommands]);
|
||||
setState({ inside: false, showModal: false });
|
||||
}
|
||||
if (routeName === 'OnboardingView' || routeName === 'NewServerView') {
|
||||
if (routeName === 'OnboardingView') {
|
||||
KeyCommands.deleteKeyCommands([...defaultCommands, ...keyCommands]);
|
||||
setState({ inside: false, showModal: false });
|
||||
}
|
||||
if (routeName === 'ModalBlockView' || routeName === 'StatusView' || routeName === 'CreateDiscussionView') {
|
||||
if (routeName === 'ModalBlockView') {
|
||||
modalRef.dispatch(NavigationActions.navigate({ routeName, params }));
|
||||
setState({ showModal: true });
|
||||
return null;
|
||||
}
|
||||
|
||||
if (routeName === 'RoomView') {
|
||||
const resetAction = StackActions.reset({
|
||||
index: 0,
|
||||
|
@ -171,9 +170,9 @@ const Split = ({
|
|||
return (
|
||||
<>
|
||||
<View style={[sharedStyles.container, sharedStyles.separatorLeft, { borderColor: themes[theme].separatorColor }]}>
|
||||
<RoomContainer ref={ref => roomRef = ref} screenProps={{ split: tablet, theme }} />
|
||||
<App ref={ref => roomRef = ref} />
|
||||
</View>
|
||||
<ModalContainer showModal={showModal} closeModal={closeModal} ref={setModalRef} screenProps={{ split: tablet, theme }} />
|
||||
{/* <ModalContainer showModal={showModal} closeModal={closeModal} ref={setModalRef} /> */}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
@ -195,7 +194,7 @@ const Tablet = ({
|
|||
{children}
|
||||
</View>
|
||||
<Split split={split} tablet={tablet} theme={theme} showModal={showModal} closeModal={closeModal} setModalRef={setModalRef} />
|
||||
<NotificationContainer ref={ref => notificationRef = ref} screenProps={{ theme }} />
|
||||
{/* <NotificationContainer ref={ref => notificationRef = ref} /> */}
|
||||
</View>
|
||||
);
|
||||
};
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { WebView } from 'react-native-webview';
|
||||
import { SafeAreaView } from 'react-navigation';
|
||||
import { SafeAreaView } from 'react-native';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import I18n from '../../i18n';
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import {
|
||||
FlatList, Switch, View, StyleSheet
|
||||
FlatList, Switch, View, StyleSheet, SafeAreaView, ScrollView
|
||||
} from 'react-native';
|
||||
import { SafeAreaView, ScrollView } from 'react-navigation';
|
||||
// import { SafeAreaView, ScrollView } from 'react-navigation';
|
||||
|
||||
import RocketChat from '../../lib/rocketchat';
|
||||
import I18n from '../../i18n';
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { connect, SafeAreaView } from 'react-redux';
|
||||
import PropTypes from 'prop-types';
|
||||
import {
|
||||
View, Text, Switch, ScrollView, StyleSheet, FlatList
|
||||
} from 'react-native';
|
||||
import { SafeAreaView } from 'react-navigation';
|
||||
// import { SafeAreaView } from 'react-navigation';
|
||||
import equal from 'deep-equal';
|
||||
|
||||
import TextInput from '../presentation/TextInput';
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import PropTypes from 'prop-types';
|
||||
import { ScrollView, Text } from 'react-native';
|
||||
import { SafeAreaView } from 'react-navigation';
|
||||
import { ScrollView, Text, SafeAreaView } from 'react-native';
|
||||
// import { SafeAreaView } from 'react-navigation';
|
||||
import isEqual from 'lodash/isEqual';
|
||||
|
||||
import Loading from '../../containers/Loading';
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import {
|
||||
StyleSheet, FlatList, View, Text, Linking
|
||||
StyleSheet, FlatList, View, Text, Linking, SafeAreaView
|
||||
} from 'react-native';
|
||||
import { SafeAreaView } from 'react-navigation';
|
||||
// import { SafeAreaView } from 'react-navigation';
|
||||
import RNUserDefaults from 'rn-user-defaults';
|
||||
|
||||
import I18n from '../i18n';
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import {
|
||||
View, FlatList, Text
|
||||
View, FlatList, Text, SafeAreaView
|
||||
} from 'react-native';
|
||||
import { connect } from 'react-redux';
|
||||
import { SafeAreaView } from 'react-navigation';
|
||||
// import { SafeAreaView } from 'react-navigation';
|
||||
|
||||
import Touch from '../../utils/touch';
|
||||
import RocketChat from '../../lib/rocketchat';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { ScrollView, View } from 'react-native';
|
||||
import { SafeAreaView } from 'react-navigation';
|
||||
import { ScrollView, View, SafeAreaView } from 'react-native';
|
||||
// import { SafeAreaView } from 'react-navigation';
|
||||
import { connect } from 'react-redux';
|
||||
import RNPickerSelect from 'react-native-picker-select';
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { View, Share, ScrollView } from 'react-native';
|
||||
import { SafeAreaView } from 'react-navigation';
|
||||
import { View, Share, ScrollView, SafeAreaView } from 'react-native';
|
||||
// import { SafeAreaView } from 'react-navigation';
|
||||
import moment from 'moment';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { FlatList } from 'react-native';
|
||||
import { FlatList, SafeAreaView } from 'react-native';
|
||||
import { connect } from 'react-redux';
|
||||
import { SafeAreaView } from 'react-navigation';
|
||||
// import { SafeAreaView } from 'react-navigation';
|
||||
|
||||
import RocketChat from '../../lib/rocketchat';
|
||||
import I18n from '../../i18n';
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import {
|
||||
Text, ScrollView, View, StyleSheet
|
||||
Text, ScrollView, View, StyleSheet, SafeAreaView
|
||||
} from 'react-native';
|
||||
import { SafeAreaView } from 'react-navigation';
|
||||
// import { SafeAreaView } from 'react-navigation';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import Touch from '../utils/touch';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import React, { useState, useEffect } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Text, StyleSheet, ScrollView } from 'react-native';
|
||||
import { SafeAreaView } from 'react-navigation';
|
||||
import { Text, StyleSheet, ScrollView, SafeAreaView } from 'react-native';
|
||||
// import { SafeAreaView } from 'react-navigation';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import { withTheme } from '../theme';
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { FlatList, View, Text } from 'react-native';
|
||||
import { FlatList, View, Text, SafeAreaView } from 'react-native';
|
||||
import { connect } from 'react-redux';
|
||||
import { SafeAreaView } from 'react-navigation';
|
||||
// import { SafeAreaView } from 'react-navigation';
|
||||
import equal from 'deep-equal';
|
||||
import ActionSheet from 'react-native-action-sheet';
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ import PropTypes from 'prop-types';
|
|||
import {
|
||||
View, StyleSheet, FlatList, Text
|
||||
} from 'react-native';
|
||||
import { connect } from 'react-redux';
|
||||
import { SafeAreaView } from 'react-navigation';
|
||||
import { connect, SafeAreaView } from 'react-redux';
|
||||
// import { SafeAreaView } from 'react-navigation';
|
||||
import equal from 'deep-equal';
|
||||
import { orderBy } from 'lodash';
|
||||
import { Q } from '@nozbe/watermelondb';
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import React from 'react';
|
||||
import {
|
||||
View, ScrollView, Switch, Text
|
||||
View, ScrollView, Switch, Text, SafeAreaView
|
||||
} from 'react-native';
|
||||
import PropTypes from 'prop-types';
|
||||
import { SafeAreaView } from 'react-navigation';
|
||||
// import { SafeAreaView } from 'react-navigation';
|
||||
|
||||
import database from '../../lib/database';
|
||||
import { SWITCH_TRACK_COLOR, themes } from '../../constants/colors';
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { View, ScrollView, Keyboard } from 'react-native';
|
||||
import { View, ScrollView, Keyboard, SafeAreaView } from 'react-native';
|
||||
import { connect } from 'react-redux';
|
||||
import prompt from 'react-native-prompt-android';
|
||||
import SHA256 from 'js-sha256';
|
||||
import ImagePicker from 'react-native-image-crop-picker';
|
||||
import RNPickerSelect from 'react-native-picker-select';
|
||||
import { SafeAreaView } from 'react-navigation';
|
||||
import { HeaderBackButton } from 'react-navigation-stack';
|
||||
// import { SafeAreaView } from 'react-navigation';
|
||||
// import { HeaderBackButton } from 'react-navigation-stack';
|
||||
import equal from 'deep-equal';
|
||||
|
||||
import Touch from '../../utils/touch';
|
||||
|
@ -36,14 +36,14 @@ import { getUserSelector } from '../../selectors/login';
|
|||
class ProfileView extends React.Component {
|
||||
static navigationOptions = ({ navigation, screenProps }) => ({
|
||||
...themedHeader(screenProps.theme),
|
||||
headerLeft: screenProps.split ? (
|
||||
<HeaderBackButton
|
||||
onPress={() => navigation.navigate('SettingsView')}
|
||||
tintColor={themes[screenProps.theme].headerTintColor}
|
||||
/>
|
||||
) : (
|
||||
<DrawerButton navigation={navigation} />
|
||||
),
|
||||
// headerLeft: screenProps.split ? (
|
||||
// <HeaderBackButton
|
||||
// onPress={() => navigation.navigate('SettingsView')}
|
||||
// tintColor={themes[screenProps.theme].headerTintColor}
|
||||
// />
|
||||
// ) : (
|
||||
// <DrawerButton navigation={navigation} />
|
||||
// ),
|
||||
title: I18n.t('Profile')
|
||||
})
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { FlatList, View, Text } from 'react-native';
|
||||
import { SafeAreaView } from 'react-navigation';
|
||||
import { FlatList, View, Text, SafeAreaView } from 'react-native';
|
||||
// import { SafeAreaView } from 'react-navigation';
|
||||
import equal from 'deep-equal';
|
||||
import moment from 'moment';
|
||||
import { connect } from 'react-redux';
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import {
|
||||
View, SectionList, Text, Alert, Share
|
||||
View, SectionList, Text, Alert, Share, SafeAreaView
|
||||
} from 'react-native';
|
||||
import { connect } from 'react-redux';
|
||||
import { SafeAreaView } from 'react-navigation';
|
||||
// import { SafeAreaView } from 'react-navigation';
|
||||
import _ from 'lodash';
|
||||
|
||||
import Touch from '../../utils/touch';
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import {
|
||||
Text, View, ScrollView, TouchableOpacity, Keyboard, Alert
|
||||
Text, View, ScrollView, TouchableOpacity, Keyboard, Alert, SafeAreaView
|
||||
} from 'react-native';
|
||||
import { connect } from 'react-redux';
|
||||
import { SafeAreaView } from 'react-navigation';
|
||||
// import { SafeAreaView } from 'react-navigation';
|
||||
import equal from 'deep-equal';
|
||||
import { BLOCK_CONTEXT } from '@rocket.chat/ui-kit';
|
||||
import isEqual from 'lodash/isEqual';
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { View, Text, ScrollView } from 'react-native';
|
||||
import { View, Text, ScrollView, SafeAreaView } from 'react-native';
|
||||
import { BorderlessButton } from 'react-native-gesture-handler';
|
||||
import { connect } from 'react-redux';
|
||||
import { SafeAreaView } from 'react-navigation';
|
||||
// import { SafeAreaView } from 'react-navigation';
|
||||
import UAParser from 'ua-parser-js';
|
||||
import _ from 'lodash';
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { FlatList, View } from 'react-native';
|
||||
import { FlatList, View, SafeAreaView } from 'react-native';
|
||||
import ActionSheet from 'react-native-action-sheet';
|
||||
import { connect } from 'react-redux';
|
||||
import { SafeAreaView } from 'react-navigation';
|
||||
// import { SafeAreaView } from 'react-navigation';
|
||||
import * as Haptics from 'expo-haptics';
|
||||
import { Q } from '@nozbe/watermelondb';
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { StyleSheet } from 'react-native';
|
||||
import { HeaderBackButton } from 'react-navigation-stack';
|
||||
// import { HeaderBackButton } from 'react-navigation-stack';
|
||||
|
||||
import { isIOS } from '../../../utils/deviceInfo';
|
||||
import { themes } from '../../../constants/colors';
|
||||
|
@ -18,14 +18,15 @@ const RoomHeaderLeft = ({
|
|||
tmid, unreadsCount, navigation, baseUrl, userId, token, title, t, theme, goRoomActionsView, split
|
||||
}) => {
|
||||
if (!split || tmid) {
|
||||
return (
|
||||
<HeaderBackButton
|
||||
title={unreadsCount > 999 ? '+999' : unreadsCount || ' '}
|
||||
backTitleVisible={isIOS}
|
||||
onPress={() => navigation.goBack()}
|
||||
tintColor={themes[theme].headerTintColor}
|
||||
/>
|
||||
);
|
||||
// return (
|
||||
// <HeaderBackButton
|
||||
// title={unreadsCount > 999 ? '+999' : unreadsCount || ' '}
|
||||
// backTitleVisible={isIOS}
|
||||
// onPress={() => navigation.goBack()}
|
||||
// tintColor={themes[theme].headerTintColor}
|
||||
// />
|
||||
// );
|
||||
return null;
|
||||
}
|
||||
if (baseUrl && userId && token) {
|
||||
return (
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Text, View, InteractionManager } from 'react-native';
|
||||
import { Text, View, InteractionManager, SafeAreaView } from 'react-native';
|
||||
import { connect } from 'react-redux';
|
||||
import { SafeAreaView } from 'react-navigation';
|
||||
// import { SafeAreaView } from 'react-navigation';
|
||||
|
||||
import { sanitizedRaw } from '@nozbe/watermelondb/RawRecord';
|
||||
import moment from 'moment';
|
||||
|
|
|
@ -5,7 +5,7 @@ import {
|
|||
import PropTypes from 'prop-types';
|
||||
import { connect } from 'react-redux';
|
||||
import equal from 'deep-equal';
|
||||
import { withNavigation } from 'react-navigation';
|
||||
import { withNavigation } from '@react-navigation/compat';
|
||||
import RNUserDefaults from 'rn-user-defaults';
|
||||
|
||||
import { toggleServerDropdown as toggleServerDropdownAction } from '../../actions/rooms';
|
||||
|
|
|
@ -7,11 +7,12 @@ import {
|
|||
Text,
|
||||
Keyboard,
|
||||
Dimensions,
|
||||
RefreshControl
|
||||
RefreshControl,
|
||||
SafeAreaView
|
||||
} from 'react-native';
|
||||
import { connect } from 'react-redux';
|
||||
import { isEqual, orderBy } from 'lodash';
|
||||
import { SafeAreaView } from 'react-navigation';
|
||||
// import { SafeAreaView } from 'react-navigation';
|
||||
import Orientation from 'react-native-orientation-locker';
|
||||
import { Q } from '@nozbe/watermelondb';
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { StyleSheet, Switch, ScrollView } from 'react-native';
|
||||
import { SafeAreaView } from 'react-navigation';
|
||||
import { StyleSheet, Switch, ScrollView, SafeAreaView } from 'react-native';
|
||||
// import { SafeAreaView } from 'react-navigation';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import I18n from '../i18n';
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { View, FlatList, Text } from 'react-native';
|
||||
import { View, FlatList, Text, SafeAreaView } from 'react-native';
|
||||
import { connect } from 'react-redux';
|
||||
import { SafeAreaView } from 'react-navigation';
|
||||
// import { SafeAreaView } from 'react-navigation';
|
||||
import equal from 'deep-equal';
|
||||
|
||||
import RCTextInput from '../../containers/TextInput';
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import React from 'react';
|
||||
import {
|
||||
FlatList, StyleSheet, View
|
||||
FlatList, StyleSheet, View, SafeAreaView
|
||||
} from 'react-native';
|
||||
import PropTypes from 'prop-types';
|
||||
import { connect } from 'react-redux';
|
||||
import { SafeAreaView } from 'react-navigation';
|
||||
// import { SafeAreaView } from 'react-navigation';
|
||||
|
||||
import I18n from '../i18n';
|
||||
import StatusBar from '../containers/StatusBar';
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { View, StyleSheet, FlatList } from 'react-native';
|
||||
import { View, StyleSheet, FlatList, SafeAreaView } from 'react-native';
|
||||
import { connect } from 'react-redux';
|
||||
import { SafeAreaView } from 'react-navigation';
|
||||
// import { SafeAreaView } from 'react-navigation';
|
||||
import equal from 'deep-equal';
|
||||
import { orderBy } from 'lodash';
|
||||
import { Q } from '@nozbe/watermelondb';
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import {
|
||||
Text, ScrollView, StyleSheet
|
||||
Text, ScrollView, StyleSheet, SafeAreaView
|
||||
} from 'react-native';
|
||||
import { connect } from 'react-redux';
|
||||
import { SafeAreaView } from 'react-navigation';
|
||||
// import { SafeAreaView } from 'react-navigation';
|
||||
import Orientation from 'react-native-orientation-locker';
|
||||
|
||||
import { loginRequest as loginRequestAction } from '../actions/login';
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import React from 'react';
|
||||
import {
|
||||
View, Linking, ScrollView, Switch, Share, Clipboard
|
||||
View, Linking, ScrollView, Switch, Share, Clipboard, SafeAreaView
|
||||
} from 'react-native';
|
||||
import PropTypes from 'prop-types';
|
||||
import { connect } from 'react-redux';
|
||||
import { SafeAreaView } from 'react-navigation';
|
||||
// import { SafeAreaView } from 'react-navigation';
|
||||
import AsyncStorage from '@react-native-community/async-storage';
|
||||
|
||||
import { logout as logoutAction } from '../../actions/login';
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import {
|
||||
View, Text, FlatList, Keyboard, BackHandler
|
||||
View, Text, FlatList, Keyboard, BackHandler, SafeAreaView
|
||||
} from 'react-native';
|
||||
import { SafeAreaView } from 'react-navigation';
|
||||
// import { SafeAreaView } from 'react-navigation';
|
||||
import ShareExtension from 'rn-extensions-share';
|
||||
import { connect } from 'react-redux';
|
||||
import RNFetchBlob from 'rn-fetch-blob';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { FlatList, StyleSheet } from 'react-native';
|
||||
import { SafeAreaView } from 'react-navigation';
|
||||
import { FlatList, StyleSheet, SafeAreaView } from 'react-native';
|
||||
// import { SafeAreaView } from 'react-navigation';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import I18n from '../i18n';
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import {
|
||||
FlatList, Text, View, StyleSheet
|
||||
FlatList, Text, View, StyleSheet, SafeAreaView
|
||||
} from 'react-native';
|
||||
import { SafeAreaView } from 'react-navigation';
|
||||
// import { SafeAreaView } from 'react-navigation';
|
||||
import RNUserDefaults from 'rn-user-defaults';
|
||||
|
||||
import I18n from '../i18n';
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import {
|
||||
FlatList, View, Text, InteractionManager
|
||||
FlatList, View, Text, InteractionManager, SafeAreaView
|
||||
} from 'react-native';
|
||||
import { connect } from 'react-redux';
|
||||
import { SafeAreaView } from 'react-navigation';
|
||||
// import { SafeAreaView } from 'react-navigation';
|
||||
import moment from 'moment';
|
||||
import orderBy from 'lodash/orderBy';
|
||||
import { Q } from '@nozbe/watermelondb';
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
"@react-native-community/datetimepicker": "2.3.2",
|
||||
"@react-native-community/masked-view": "^0.1.10",
|
||||
"@react-native-community/slider": "2.0.9",
|
||||
"@react-navigation/compat": "^5.1.23",
|
||||
"@react-navigation/drawer": "^5.7.7",
|
||||
"@react-navigation/native": "^5.4.2",
|
||||
"@react-navigation/stack": "^5.3.9",
|
||||
"@rocket.chat/sdk": "djorkaeffalexandre/Rocket.Chat.js.SDK#test.fix-ddp",
|
||||
|
|
13
yarn.lock
13
yarn.lock
|
@ -1764,6 +1764,11 @@
|
|||
resolved "https://registry.yarnpkg.com/@react-native-community/viewpager/-/viewpager-2.0.2.tgz#622b190294b1310c4825c98daeaee1c8443f7124"
|
||||
integrity sha512-CKVhIZdX/Cmb80muog8sKpi5vM8npwFp4tx4Dj1IvTBidZweuO22+VH2rDOj7E0LzdV9IYRJ4FGBwcPBD2qUrQ==
|
||||
|
||||
"@react-navigation/compat@^5.1.23":
|
||||
version "5.1.23"
|
||||
resolved "https://registry.yarnpkg.com/@react-navigation/compat/-/compat-5.1.23.tgz#2e43727815919c38ef7bd198cdbf0ca08ec85599"
|
||||
integrity sha512-JczqRNZujNcz32SsNJeBEcMatsQix/9MIPOXZcAnmUV8UxYpcXt8NKD0Us60evqVc8pZDTV3vCLvAOkOY7OxeA==
|
||||
|
||||
"@react-navigation/core@^5.8.1":
|
||||
version "5.8.1"
|
||||
resolved "https://registry.yarnpkg.com/@react-navigation/core/-/core-5.8.1.tgz#4f0d744a10eec7dc8bfad2901eec5fb9623b0972"
|
||||
|
@ -1776,6 +1781,14 @@
|
|||
react-is "^16.13.0"
|
||||
use-subscription "^1.4.0"
|
||||
|
||||
"@react-navigation/drawer@^5.7.7":
|
||||
version "5.7.7"
|
||||
resolved "https://registry.yarnpkg.com/@react-navigation/drawer/-/drawer-5.7.7.tgz#25d088b7bf53368085bc88a853071e3c14560296"
|
||||
integrity sha512-E/1kcZexfIXC3uLJSokAb5CD4qmOF1udjZ8QzDyzKWgygWk6YhvXX+koCENOvGnslU0HfUH/BCoecxksilJ7kA==
|
||||
dependencies:
|
||||
color "^3.1.2"
|
||||
react-native-iphone-x-helper "^1.2.1"
|
||||
|
||||
"@react-navigation/native@^5.4.2":
|
||||
version "5.4.2"
|
||||
resolved "https://registry.yarnpkg.com/@react-navigation/native/-/native-5.4.2.tgz#256d4f67aa97083de9c8ff52cdc77ac039b66350"
|
||||
|
|
Loading…
Reference in New Issue