diff --git a/app/AppContainer.js b/app/AppContainer.js
index f717761dd..f62f1c23a 100644
--- a/app/AppContainer.js
+++ b/app/AppContainer.js
@@ -3,6 +3,8 @@ import PropTypes from 'prop-types';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import { connect } from 'react-redux';
+import { SafeAreaProvider, initialWindowMetrics } from 'react-native-safe-area-context';
+
import { defaultHeader, onNavigationStateChange } from './utils/navigation';
import Navigation from './lib/Navigation';
@@ -29,46 +31,48 @@ const SetUsernameStack = () => (
// App
const Stack = createStackNavigator();
const App = ({ root }) => {
- if (!root) {
+ if (!root || root === 'background') {
return null;
}
return (
- {
- Navigation.setTopLevelNavigator(navigatorRef);
- }}
- onNavigationStateChange={onNavigationStateChange}
- >
-
- <>
- {root === 'loading' ? (
-
- ) : null}
- {root === 'outside' ? (
-
- ) : null}
- {root === 'inside' ? (
-
- ) : null}
- {root === 'setUsername' ? (
-
- ) : null}
- >
-
-
+
+ {
+ Navigation.setTopLevelNavigator(navigatorRef);
+ }}
+ onNavigationStateChange={onNavigationStateChange}
+ >
+
+ <>
+ {root === 'loading' ? (
+
+ ) : null}
+ {root === 'outside' ? (
+
+ ) : null}
+ {root === 'inside' ? (
+
+ ) : null}
+ {root === 'setUsername' ? (
+
+ ) : null}
+ >
+
+
+
);
};
const mapStateToProps = state => ({
diff --git a/app/containers/FormContainer.js b/app/containers/FormContainer.js
index 7938a5f9e..19b5c189f 100644
--- a/app/containers/FormContainer.js
+++ b/app/containers/FormContainer.js
@@ -1,7 +1,6 @@
import React from 'react';
-import { ScrollView, StyleSheet, View, SafeAreaView } from 'react-native';
+import { ScrollView, StyleSheet, View } from 'react-native';
import PropTypes from 'prop-types';
-// import { SafeAreaView } from 'react-navigation';
import { themes } from '../constants/colors';
import sharedStyles from '../views/Styles';
@@ -10,6 +9,7 @@ import KeyboardView from '../presentation/KeyboardView';
import StatusBar from './StatusBar';
import AppVersion from './AppVersion';
import { isTablet } from '../utils/deviceInfo';
+import SafeAreaView from './SafeAreaView';
const styles = StyleSheet.create({
scrollView: {
@@ -31,7 +31,7 @@ const FormContainer = ({ children, theme, testID }) => (
>
-
+
{children}
diff --git a/app/containers/MessageBox/Recording.js b/app/containers/MessageBox/Recording.js
index c471f2d94..c3fa65ab3 100644
--- a/app/containers/MessageBox/Recording.js
+++ b/app/containers/MessageBox/Recording.js
@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import {
- View, SafeAreaView, PermissionsAndroid, Text
+ View, PermissionsAndroid, Text
} from 'react-native';
import { AudioRecorder, AudioUtils } from 'react-native-audio';
import { BorderlessButton } from 'react-native-gesture-handler';
@@ -13,6 +13,7 @@ import I18n from '../../i18n';
import { isIOS, isAndroid } from '../../utils/deviceInfo';
import { CustomIcon } from '../../lib/Icons';
import { themes } from '../../constants/colors';
+import SafeAreaView from '../SafeAreaView';
export const _formatTime = function(seconds) {
let minutes = Math.floor(seconds / 60);
@@ -134,6 +135,7 @@ export default class extends React.PureComponent {
return (
{
if (message && message.reactions) {
return (
-
+
(
+
+ {children}
+
+));
+
+SafeAreaView.propTypes = {
+ testID: PropTypes.string,
+ theme: PropTypes.string,
+ style: PropTypes.object,
+ children: PropTypes.element
+};
+
+export default SafeAreaView;
diff --git a/app/views/AdminPanelView/index.js b/app/views/AdminPanelView/index.js
index 4311337e4..a588a9309 100644
--- a/app/views/AdminPanelView/index.js
+++ b/app/views/AdminPanelView/index.js
@@ -1,17 +1,15 @@
import React from 'react';
import PropTypes from 'prop-types';
import { WebView } from 'react-native-webview';
-import { SafeAreaView } from 'react-native';
import { connect } from 'react-redux';
import I18n from '../../i18n';
import StatusBar from '../../containers/StatusBar';
import { DrawerButton } from '../../containers/HeaderButton';
-import styles from '../Styles';
import { themedHeader } from '../../utils/navigation';
import { withTheme } from '../../theme';
-import { themes } from '../../constants/colors';
import { getUserSelector } from '../../selectors/login';
+import SafeAreaView from '../../containers/SafeAreaView';
class AdminPanelView extends React.Component {
static navigationOptions = ({ navigation, screenProps }) => ({
@@ -32,7 +30,7 @@ class AdminPanelView extends React.Component {
return null;
}
return (
-
+
+
-
+
{
@@ -137,7 +137,7 @@ class CreateChannelView extends React.Component {
keyboardVerticalOffset={128}
>
-
+
{I18n.t('Discussion_Desc')}
+
{
@@ -230,7 +230,7 @@ class DirectoryView extends React.Component {
} = this.state;
const { isFederationEnabled, theme } = this.props;
return (
-
+
+
+
+
{
keyboardVerticalOffset={128}
>
-
+
{
const { theme } = this.props;
return (
-
+
{this.renderList()}
diff --git a/app/views/NotificationPreferencesView/index.js b/app/views/NotificationPreferencesView/index.js
index c694bb663..5c4343b42 100644
--- a/app/views/NotificationPreferencesView/index.js
+++ b/app/views/NotificationPreferencesView/index.js
@@ -1,9 +1,8 @@
import React from 'react';
import {
- View, ScrollView, Switch, Text, SafeAreaView
+ View, ScrollView, Switch, Text
} from 'react-native';
import PropTypes from 'prop-types';
-// import { SafeAreaView } from 'react-navigation';
import database from '../../lib/database';
import { SWITCH_TRACK_COLOR, themes } from '../../constants/colors';
@@ -13,11 +12,11 @@ import Separator from '../../containers/Separator';
import I18n from '../../i18n';
import scrollPersistTaps from '../../utils/scrollPersistTaps';
import styles from './styles';
-import sharedStyles from '../Styles';
import RocketChat from '../../lib/rocketchat';
import { withTheme } from '../../theme';
import { themedHeader } from '../../utils/navigation';
import protectedFunction from '../../lib/methods/helpers/protectedFunction';
+import SafeAreaView from '../../containers/SafeAreaView';
const SectionTitle = React.memo(({ title, theme }) => (
+
({
@@ -440,7 +440,7 @@ class ProfileView extends React.Component {
keyboardVerticalOffset={128}
>
-
+
({
@@ -135,11 +135,7 @@ class ReadReceiptView extends React.Component {
}
return (
-
+
{loading
diff --git a/app/views/ReadReceiptView/styles.js b/app/views/ReadReceiptView/styles.js
index a0013531c..c93754294 100644
--- a/app/views/ReadReceiptView/styles.js
+++ b/app/views/ReadReceiptView/styles.js
@@ -28,9 +28,6 @@ export default StyleSheet.create({
flexDirection: 'row',
padding: 10
},
- container: {
- flex: 1
- },
list: {
...sharedStyles.separatorVertical,
marginVertical: 10
diff --git a/app/views/RoomActionsView/index.js b/app/views/RoomActionsView/index.js
index 1bfb56279..eb68ceb1c 100644
--- a/app/views/RoomActionsView/index.js
+++ b/app/views/RoomActionsView/index.js
@@ -1,10 +1,9 @@
import React from 'react';
import PropTypes from 'prop-types';
import {
- View, SectionList, Text, Alert, Share, SafeAreaView
+ View, SectionList, Text, Alert, Share
} from 'react-native';
import { connect } from 'react-redux';
-// import { SafeAreaView } from 'react-navigation';
import _ from 'lodash';
import Touch from '../../utils/touch';
@@ -29,6 +28,7 @@ import { CloseModalButton } from '../../containers/HeaderButton';
import { getUserSelector } from '../../selectors/login';
import Markdown from '../../containers/markdown';
import { showConfirmationAlert, showErrorAlert } from '../../utils/info';
+import SafeAreaView from '../../containers/SafeAreaView';
class RoomActionsView extends React.Component {
static navigationOptions = ({ navigation, screenProps }) => {
@@ -647,7 +647,7 @@ class RoomActionsView extends React.Component {
render() {
const { theme } = this.props;
return (
-
+
-
+
{ this.name = e; }}
label={I18n.t('Name')}
diff --git a/app/views/RoomMembersView/index.js b/app/views/RoomMembersView/index.js
index 59e73e615..2a3b4a65b 100644
--- a/app/views/RoomMembersView/index.js
+++ b/app/views/RoomMembersView/index.js
@@ -1,9 +1,8 @@
import React from 'react';
import PropTypes from 'prop-types';
-import { FlatList, View, SafeAreaView } from 'react-native';
+import { FlatList, View } from 'react-native';
import ActionSheet from 'react-native-action-sheet';
import { connect } from 'react-redux';
-// import { SafeAreaView } from 'react-navigation';
import * as Haptics from 'expo-haptics';
import { Q } from '@nozbe/watermelondb';
@@ -25,6 +24,7 @@ import { withTheme } from '../../theme';
import { themedHeader } from '../../utils/navigation';
import { themes } from '../../constants/colors';
import { getUserSelector } from '../../selectors/login';
+import SafeAreaView from '../../containers/SafeAreaView';
const PAGE_SIZE = 25;
@@ -261,7 +261,7 @@ class RoomMembersView extends React.Component {
} = this.state;
const { theme } = this.props;
return (
-
+
{
- // Check if there were changes while not focused (it's set on sCU)
- if (this.shouldUpdate) {
- this.forceUpdate();
- this.shouldUpdate = false;
- }
- });
- this.didFocusListener = navigation.addListener('didFocus', () => {
+ this.unsubscribeFocus = navigation.addListener('focus', () => {
Orientation.unlockAllOrientations();
this.animated = true;
// Check if there were changes while not focused (it's set on sCU)
@@ -178,7 +169,7 @@ class RoomsListView extends React.Component {
}
this.backHandler = BackHandler.addEventListener('hardwareBackPress', this.handleBackPress);
});
- this.willBlurListener = navigation.addListener('willBlur', () => {
+ this.unsubscribeBlur = navigation.addListener('blur', () => {
this.animated = false;
closeServerDropdown();
if (this.backHandler && this.backHandler.remove) {
@@ -286,14 +277,11 @@ class RoomsListView extends React.Component {
if (this.querySubscription && this.querySubscription.unsubscribe) {
this.querySubscription.unsubscribe();
}
- if (this.willFocusListener && this.willFocusListener.remove) {
- this.willFocusListener.remove();
+ if (this.unsubscribeFocus) {
+ this.unsubscribeFocus();
}
- if (this.didFocusListener && this.didFocusListener.remove) {
- this.didFocusListener.remove();
- }
- if (this.willBlurListener && this.willBlurListener.remove) {
- this.willBlurListener.remove();
+ if (this.unsubscribeBlur) {
+ this.unsubscribeBlur();
}
if (isTablet) {
EventEmitter.removeListener(KEY_COMMAND, this.handleCommands);
@@ -801,11 +789,7 @@ class RoomsListView extends React.Component {
} = this.props;
return (
-
+
{this.renderScroll()}
{showSortDropdown ? (
diff --git a/app/views/ScreenLockConfigView.js b/app/views/ScreenLockConfigView.js
index f57f56d57..259e52566 100644
--- a/app/views/ScreenLockConfigView.js
+++ b/app/views/ScreenLockConfigView.js
@@ -1,14 +1,12 @@
import React from 'react';
import PropTypes from 'prop-types';
-import { StyleSheet, Switch, ScrollView, SafeAreaView } from 'react-native';
-// import { SafeAreaView } from 'react-navigation';
+import { StyleSheet, Switch, ScrollView } from 'react-native';
import { connect } from 'react-redux';
import I18n from '../i18n';
import { themedHeader } from '../utils/navigation';
import { withTheme } from '../theme';
import { themes, SWITCH_TRACK_COLOR } from '../constants/colors';
-import sharedStyles from './Styles';
import StatusBar from '../containers/StatusBar';
import Separator from '../containers/Separator';
import ListItem from '../containers/ListItem';
@@ -18,6 +16,7 @@ import database from '../lib/database';
import { supportedBiometryLabel, changePasscode, checkHasPasscode } from '../utils/localAuthentication';
import { DisclosureImage } from '../containers/DisclosureIndicator';
import { DEFAULT_AUTO_LOCK } from '../constants/localAuthentication';
+import SafeAreaView from '../containers/SafeAreaView';
const styles = StyleSheet.create({
listPadding: {
@@ -246,10 +245,7 @@ class ScreenLockConfigView extends React.Component {
const { autoLock } = this.state;
const { theme } = this.props;
return (
-
+
item.value}
diff --git a/app/views/SearchMessagesView/index.js b/app/views/SearchMessagesView/index.js
index a84ae9ca8..0b4dabbf2 100644
--- a/app/views/SearchMessagesView/index.js
+++ b/app/views/SearchMessagesView/index.js
@@ -1,8 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
-import { View, FlatList, Text, SafeAreaView } from 'react-native';
+import { View, FlatList, Text } from 'react-native';
import { connect } from 'react-redux';
-// import { SafeAreaView } from 'react-navigation';
import equal from 'deep-equal';
import RCTextInput from '../../containers/TextInput';
@@ -20,6 +19,7 @@ import { themes } from '../../constants/colors';
import { withTheme } from '../../theme';
import { themedHeader } from '../../utils/navigation';
import { getUserSelector } from '../../selectors/login';
+import SafeAreaView from '../../containers/SafeAreaView';
class SearchMessagesView extends React.Component {
static navigationOptions = ({ screenProps }) => ({
@@ -152,7 +152,7 @@ class SearchMessagesView extends React.Component {
render() {
const { theme } = this.props;
return (
-
+
({ length: ROW_HEIGHT, offset: ROW_HEIGHT * index, index });
const keyExtractor = item => item.id;
const styles = StyleSheet.create({
- container: {
- flex: 1
- },
list: {
marginVertical: 32,
...sharedStyles.separatorVertical
@@ -88,10 +85,7 @@ class SelectServerView extends React.Component {
const { servers } = this.state;
const { theme } = this.props;
return (
-
+
{
const { loading, theme } = this.props;
return (
-
+
{this.renderList()}
diff --git a/app/views/SetUsernameView.js b/app/views/SetUsernameView.js
index 3303479c0..dace2b507 100644
--- a/app/views/SetUsernameView.js
+++ b/app/views/SetUsernameView.js
@@ -1,10 +1,9 @@
import React from 'react';
import PropTypes from 'prop-types';
import {
- Text, ScrollView, StyleSheet, SafeAreaView
+ Text, ScrollView, StyleSheet
} from 'react-native';
import { connect } from 'react-redux';
-// import { SafeAreaView } from 'react-navigation';
import Orientation from 'react-native-orientation-locker';
import { loginRequest as loginRequestAction } from '../actions/login';
@@ -22,6 +21,7 @@ import { themes } from '../constants/colors';
import { isTablet } from '../utils/deviceInfo';
import { getUserSelector } from '../selectors/login';
import { showErrorAlert } from '../utils/info';
+import SafeAreaView from '../containers/SafeAreaView';
const styles = StyleSheet.create({
loginTitle: {
@@ -111,7 +111,7 @@ class SetUsernameView extends React.Component {
>
-
+
(
+
({ length: ROW_HEIGHT, offset: ROW_HEIGHT * index, index });
@@ -452,7 +452,7 @@ class ShareListView extends React.Component {
const { showError } = this.state;
const { theme } = this.props;
return (
-
+
{ showError ? this.renderError() : this.renderContent() }
diff --git a/app/views/SidebarView/index.js b/app/views/SidebarView/index.js
index bee708251..3521e69ca 100644
--- a/app/views/SidebarView/index.js
+++ b/app/views/SidebarView/index.js
@@ -1,7 +1,7 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import {
- ScrollView, Text, View, SafeAreaView
+ ScrollView, Text, View
} from 'react-native';
import { connect } from 'react-redux';
import { Q } from '@nozbe/watermelondb';
@@ -20,6 +20,7 @@ import { withTheme } from '../../theme';
import { withSplit } from '../../split';
import { getUserSelector } from '../../selectors/login';
import Navigation from '../../lib/Navigation';
+import SafeAreaView from '../../containers/SafeAreaView';
const Separator = React.memo(({ theme }) => );
Separator.propTypes = {
@@ -199,7 +200,7 @@ class Sidebar extends Component {
return null;
}
return (
-
+
+
item.id}
diff --git a/app/views/ThemeView.js b/app/views/ThemeView.js
index 36f567ca2..4d044a742 100644
--- a/app/views/ThemeView.js
+++ b/app/views/ThemeView.js
@@ -1,9 +1,8 @@
import React from 'react';
import PropTypes from 'prop-types';
import {
- FlatList, Text, View, StyleSheet, SafeAreaView
+ FlatList, Text, View, StyleSheet
} from 'react-native';
-// import { SafeAreaView } from 'react-navigation';
import RNUserDefaults from 'rn-user-defaults';
import I18n from '../i18n';
@@ -17,6 +16,7 @@ import ListItem from '../containers/ListItem';
import { CustomIcon } from '../lib/Icons';
import { THEME_PREFERENCES_KEY } from '../lib/rocketchat';
import { supportSystemTheme } from '../utils/deviceInfo';
+import SafeAreaView from '../containers/SafeAreaView';
const THEME_GROUP = 'THEME_GROUP';
const DARK_GROUP = 'DARK_GROUP';
@@ -167,11 +167,7 @@ class ThemeView extends React.Component {
render() {
const { theme } = this.props;
return (
-
+
);
Separator.propTypes = {
@@ -331,7 +331,7 @@ class ThreadMessagesView extends React.Component {
}
return (
-
+