From 442159ab78be4fe69e12d7493afe80b1a6ccbdf0 Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Tue, 14 Dec 2021 11:45:12 +0200 Subject: [PATCH] Fix navigation --- android/app/src/main/AndroidManifest.xml | 2 +- app/components/app_version/index.tsx | 33 ++++++++++++++++--- app/screens/forgot_password/index.tsx | 2 +- app/screens/login/index.tsx | 2 +- app/screens/server/index.tsx | 2 +- ios/Podfile.lock | 8 ++--- package-lock.json | 14 ++++---- package.json | 2 +- ...h => react-native-navigation+7.24.1.patch} | 0 9 files changed, 45 insertions(+), 20 deletions(-) rename patches/{react-native-navigation+7.24.0.patch => react-native-navigation+7.24.1.patch} (100%) diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 8f3284d00..b3cb70322 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -30,7 +30,7 @@ android:name=".MainActivity" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" - android:windowSoftInputMode="adjustPan" + android:windowSoftInputMode="adjustResize" android:launchMode="singleTask" android:taskAffinity=""> diff --git a/app/components/app_version/index.tsx b/app/components/app_version/index.tsx index 50db56bca..1b377750c 100644 --- a/app/components/app_version/index.tsx +++ b/app/components/app_version/index.tsx @@ -1,9 +1,10 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React from 'react'; -import {StyleSheet, TextStyle, View} from 'react-native'; +import React, {useEffect} from 'react'; +import {Keyboard, StyleSheet, TextStyle, View} from 'react-native'; import DeviceInfo from 'react-native-device-info'; +import Animated, {useAnimatedStyle, useSharedValue, withTiming} from 'react-native-reanimated'; import FormattedText from '@components/formatted_text'; import {t} from '@i18n'; @@ -26,6 +27,27 @@ type AppVersionProps = { } const AppVersion = ({isWrapped = true, textStyle = {}}: AppVersionProps) => { + const opacity = useSharedValue(1); + const animatedStyle = useAnimatedStyle(() => { + return { + opacity: withTiming(opacity.value, {duration: 250}), + }; + }); + + useEffect(() => { + const willHide = Keyboard.addListener('keyboardDidHide', () => { + opacity.value = 1; + }); + const willShow = Keyboard.addListener('keyboardDidShow', () => { + opacity.value = 0; + }); + + return () => { + willHide.remove(); + willShow.remove(); + }; + }, []); + const appVersion = ( { } return ( - + {appVersion} - + ); }; diff --git a/app/screens/forgot_password/index.tsx b/app/screens/forgot_password/index.tsx index dbe6442bd..40522168c 100644 --- a/app/screens/forgot_password/index.tsx +++ b/app/screens/forgot_password/index.tsx @@ -187,7 +187,7 @@ const ForgotPassword = ({serverUrl, theme}: Props) => { bounces={false} contentContainerStyle={styles.innerContainer} enableAutomaticScroll={Platform.OS === 'android'} - enableOnAndroid={true} + enableOnAndroid={false} enableResetScrollToCoords={true} extraScrollHeight={0} keyboardDismissMode='on-drag' diff --git a/app/screens/login/index.tsx b/app/screens/login/index.tsx index 8e27af9c4..29ee1d2cd 100644 --- a/app/screens/login/index.tsx +++ b/app/screens/login/index.tsx @@ -173,7 +173,7 @@ const LoginOptions = ({config, extra, hasLoginForm, launchType, launchError, lic bounces={false} contentContainerStyle={[styles.innerContainer, additionalContainerStyle]} enableAutomaticScroll={Platform.OS === 'android'} - enableOnAndroid={true} + enableOnAndroid={false} enableResetScrollToCoords={true} extraScrollHeight={0} keyboardDismissMode='on-drag' diff --git a/app/screens/server/index.tsx b/app/screens/server/index.tsx index 5514d29e0..fa6226b1c 100644 --- a/app/screens/server/index.tsx +++ b/app/screens/server/index.tsx @@ -291,7 +291,7 @@ const Server = ({componentId, extra, launchType, launchError, theme}: ServerProp bounces={false} contentContainerStyle={styles.scrollContainer} enableAutomaticScroll={Platform.OS === 'android'} - enableOnAndroid={true} + enableOnAndroid={false} enableResetScrollToCoords={true} extraScrollHeight={20} keyboardDismissMode='on-drag' diff --git a/ios/Podfile.lock b/ios/Podfile.lock index b574d95f9..fffff795f 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -362,13 +362,13 @@ PODS: - React-Core - ReactNativeKeyboardTrackingView (5.7.0): - React - - ReactNativeNavigation (7.24.0): + - ReactNativeNavigation (7.24.1): - HMSegmentedControl - React-Core - React-RCTImage - React-RCTText - - ReactNativeNavigation/Core (= 7.24.0) - - ReactNativeNavigation/Core (7.24.0): + - ReactNativeNavigation/Core (= 7.24.1) + - ReactNativeNavigation/Core (7.24.1): - HMSegmentedControl - React-Core - React-RCTImage @@ -802,7 +802,7 @@ SPEC CHECKSUMS: ReactNativeART: 78edc68dd4a1e675338cd0cd113319cf3a65f2ab ReactNativeExceptionHandler: b11ff67c78802b2f62eed0e10e75cb1ef7947c60 ReactNativeKeyboardTrackingView: 02137fac3b2ebd330d74fa54ead48b14750a2306 - ReactNativeNavigation: 61887ca5804d6eb3185c52593ee8e211fb8cd7eb + ReactNativeNavigation: 23ac4081ca7439b35412242cb3a0a33adf615887 RNCAsyncStorage: ea6b5c280997b2b32a587793163b1f10e580c4f7 RNCClipboard: 41d8d918092ae8e676f18adada19104fa3e68495 RNCMaskedView: 0e1bc4bfa8365eba5fbbb71e07fbdc0555249489 diff --git a/package-lock.json b/package-lock.json index 14f2bb744..972a487d2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -67,7 +67,7 @@ "react-native-keychain": "8.0.0", "react-native-linear-gradient": "2.5.6", "react-native-localize": "2.1.5", - "react-native-navigation": "7.24.0", + "react-native-navigation": "7.24.1", "react-native-neomorph-shadows": "1.1.2", "react-native-notifications": "4.1.2", "react-native-permissions": "3.1.0", @@ -19824,9 +19824,9 @@ } }, "node_modules/react-native-navigation": { - "version": "7.24.0", - "resolved": "https://registry.npmjs.org/react-native-navigation/-/react-native-navigation-7.24.0.tgz", - "integrity": "sha512-ReDJ6vgFClOgorczLl972cgmML4xx5QRXIW26ZjXUtTLcHiMYdI1yVyeZnCCAYk5CAmMUAI6pSnq0RY9ncy1og==", + "version": "7.24.1", + "resolved": "https://registry.npmjs.org/react-native-navigation/-/react-native-navigation-7.24.1.tgz", + "integrity": "sha512-O6ZOFs2WKeV9o8zoJWEQ+6GfBs8NRXieR90yP/DcoPNE12Uvd1s0Bt3ssVcfY9dX3TcPxTsIn5CmxTZs4EFZ0w==", "dependencies": { "hoist-non-react-statics": "3.x.x", "lodash": "4.17.x", @@ -39969,9 +39969,9 @@ "requires": {} }, "react-native-navigation": { - "version": "7.24.0", - "resolved": "https://registry.npmjs.org/react-native-navigation/-/react-native-navigation-7.24.0.tgz", - "integrity": "sha512-ReDJ6vgFClOgorczLl972cgmML4xx5QRXIW26ZjXUtTLcHiMYdI1yVyeZnCCAYk5CAmMUAI6pSnq0RY9ncy1og==", + "version": "7.24.1", + "resolved": "https://registry.npmjs.org/react-native-navigation/-/react-native-navigation-7.24.1.tgz", + "integrity": "sha512-O6ZOFs2WKeV9o8zoJWEQ+6GfBs8NRXieR90yP/DcoPNE12Uvd1s0Bt3ssVcfY9dX3TcPxTsIn5CmxTZs4EFZ0w==", "requires": { "hoist-non-react-statics": "3.x.x", "lodash": "4.17.x", diff --git a/package.json b/package.json index 409e5a57e..240a4965e 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "react-native-keychain": "8.0.0", "react-native-linear-gradient": "2.5.6", "react-native-localize": "2.1.5", - "react-native-navigation": "7.24.0", + "react-native-navigation": "7.24.1", "react-native-neomorph-shadows": "1.1.2", "react-native-notifications": "4.1.2", "react-native-permissions": "3.1.0", diff --git a/patches/react-native-navigation+7.24.0.patch b/patches/react-native-navigation+7.24.1.patch similarity index 100% rename from patches/react-native-navigation+7.24.0.patch rename to patches/react-native-navigation+7.24.1.patch