[MM-16593] Upgrade to RN 0.61.2 (#3455)

* [MM-16593] [MM-17175] [MM-17164] [MM-17189] [MM-17181] Android - Upgrade to RN 0.60 (#3145)

* Upgrade to react-native 0.60

* Use @sentry/react-native

* Manually link @sentry/react-native

* Address review comments

* Jetify after install

* Call jetify from node_modules

* [MM-17785] iOS - Upgrade to RN 0.60 (#3153)

* Upgrade to react-native 0.60

* Use @sentry/react-native

* Manually link @sentry/react-native

* Address review comments

* Jetify after install

* Call jetify from node_modules

* Get app building for iOS

* Revert react-native-image-picker upgrade

* Minor version upgrade of react-native-image-picker

* [MM-17142] Convert all string refs to callbacks (#3217)

* Replace string refs

* Fix tests

* Don't use inline functions

* Fix mattermost-redux reversion from master merge

* [MM-18336] Upload Sentry debug symbols only when SENTRY_ENABLED is true (#3227)

* Upgrade @sentry/react-native

* Run Sentry gradle tasks only when enabled

* Upgrade @sentry/react-native and remove extra Sentry build phase

* [MM-17144] Use Hermes (#3226)

* Replace string refs

* Fix tests

* Don't use inline functions

* Fix mattermost-redux reversion from master merge

* Use Hermes

* bundleCommand ram-bundle no longer needed

* Require harmony-reflect only for Android

* Fix failing test

* Path react-native's splitLayoutProps (#3337)

* [MM-18867] [MM-17186] [MM-18866] [MM-19447] [MM-18967] Upgrade to RN 0.61.2 (#3423)

* Upgrade to RN 0.61.2

* Update rn-fetch-blob commit hash

* Update react-native-keyboard-tracking-view commit hash

* Use react-native-youtube with AVPlayer fix

* Fix jest mocks

* Use updated document picker API

* Remove unnecessary linking

* Revert "MM-17759 Add code highlighting (#3072)"

This reverts commit 26b999e885.

* Fix share extension

* Revert "Revert "MM-17759 Add code highlighting (#3072)""

This reverts commit 52aca776b12dee3abe8646d0c90480f8528e86c1.

* Address PR reviews

* Rename patch to match version

* Update react-native-youtube patch

* Update dependencies

* Fix RNDocViewer reference

* Update tests and revert to redux-persist 4.10.2

* Revert "Revert "Revert "MM-17759 Add code highlighting (#3072)"""

This reverts commit 5ef383be2619b1be6167c23f128ecb4b4ad25df9.

* Android fixes after dep upgrades

* Use fresco 2.0.0

* Use mattermost forks

* Use React-Core in Mattermost.scheme instead of react

* Remove packager (#3452)

* Remove Pods from source control

* Fix unit tests

* Add new line before entering the keystore in gradle.properties

* set ios as working directory for cocoapods

* Cache cocoapods on circleCI builds

* set ios as working dir

* fix cocoapods cache key

* Unify fastlane and npm dependencies command

* Use package-lock.json checksum for npm cache

* Fix package.json and use the checksum as the cache key

* Fix package.json and use the checksum as the cache key

* changes to circleci.yaml fastlane and removing pods from git

* Fix Mattermost.xcodeproj

* Update coocoapods to 1.7.5 and fix xcode header search paths

* Update package-lock.json

* Remove unused tooltip component

* Fix incorrect ref

* Disable Hermes (#3460)

* Revert "Remove packager (#3452)"

This reverts commit b2a79e184b3242124dfdb91ae095f6ce3f4eb986.

* Disable Hermes :'(

* Update preloaded modules

* Fix packages moduleNames and modulePaths, update snapshots and update mm-redux (ts version)

* remove document picker from modulePaths

* Fix package-lock.json

* Add eslint disable rules
This commit is contained in:
Miguel Alatzar 2019-10-28 15:04:24 -07:00 committed by GitHub
parent 87e899a562
commit 1efb01deda
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
139 changed files with 7282 additions and 15710 deletions

View file

@ -5,26 +5,24 @@
; Ignore "BUCK" generated dirs
<PROJECT_ROOT>/\.buckd/
; Ignore unexpected extra "@providesModule"
.*/node_modules/.*/node_modules/fbjs/.*
; Ignore duplicate module providers
; For RN Apps installed via npm, "Libraries" folder is inside
; "node_modules/react-native" but in the source repo it is in the root
.*/Libraries/react-native/React.js
; Ignore polyfills
.*/Libraries/polyfills/.*
node_modules/react-native/Libraries/polyfills/.*
; Ignore metro
.*/node_modules/metro/.*
; These should not be required directly
; require from fbjs/lib instead: require('fbjs/lib/warning')
node_modules/warning/.*
; Flow doesn't support platforms
.*/Libraries/Utilities/LoadingView.js
[untyped]
.*/node_modules/@react-native-community/cli/.*/.*
[include]
[libs]
node_modules/react-native/Libraries/react-native/react-native-interface.js
node_modules/react-native/flow/
node_modules/react-native/flow-github/
[options]
emoji=true
@ -32,39 +30,46 @@ emoji=true
esproposal.optional_chaining=enable
esproposal.nullish_coalescing=enable
module.system=haste
module.system.haste.use_name_reducers=true
# get basename
module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1'
# strip .js or .js.flow suffix
module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1'
# strip .ios suffix
module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1'
module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
module.system.haste.paths.blacklist=.*/__tests__/.*
module.system.haste.paths.blacklist=.*/__mocks__/.*
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/Libraries/.*
module.file_ext=.js
module.file_ext=.json
module.file_ext=.ios.js
munge_underscores=true
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
module.file_ext=.js
module.file_ext=.jsx
module.file_ext=.json
module.file_ext=.native.js
module.name_mapper='^react-native$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/react-native/react-native-implementation'
module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/node_modules/react-native/\1'
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/Image/RelativeImageStub'
suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FlowFixMeProps
suppress_type=$FlowFixMeState
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
[lints]
sketchy-null-number=warn
sketchy-null-mixed=warn
sketchy-number=warn
untyped-type-import=warn
nonstrict-import=warn
deprecated-type=warn
unsafe-getters-setters=warn
inexact-spread=warn
unnecessary-invariant=warn
signature-verification-failure=warn
deprecated-utility=error
[strict]
deprecated-type
nonstrict-import
sketchy-null
unclear-type
unsafe-getters-setters
untyped-import
untyped-type-import
[version]
^0.92.0
^0.105.0

View file

@ -74,6 +74,8 @@ clean: ## Cleans dependencies, previous builds and temp files
@echo Cleanup finished
post-install:
@./node_modules/.bin/jetify
@rm -f node_modules/intl/.babelrc
@# Hack to get react-intl and its dependencies to work with react-native
@# Based off of https://github.com/este/este/blob/master/gulp/native-fix.js

View file

@ -2812,38 +2812,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
---
## react-native-syntax-highlighter
This product contains 'react-native-syntax-highlighter' by Conor Hastings.
A syntax highlighter for react native using https://github.com/conorhastings/react-syntax-highlighter under the hood
* HOMEPAGE:
* https://github.com/conorhastings/react-native-syntax-highlighter#readme
* LICENSE: MIT
The MIT License (MIT)
Copyright (c) 2019 Conor Hastings
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -74,8 +74,8 @@ import com.android.build.OutputFile
project.ext.react = [
entryFile: "index.js",
bundleCommand: "ram-bundle",
bundleConfig: "metro.config.js"
bundleConfig: "metro.config.js",
enableHermes: false,
]
apply from: "../../node_modules/react-native/react.gradle"
@ -87,7 +87,7 @@ if (System.getenv("SENTRY_ENABLED") == "true") {
flavorAware: false
]
apply from: "../../node_modules/react-native-sentry/sentry.gradle"
apply from: "../../node_modules/@sentry/react-native/sentry.gradle"
}
/**
@ -105,6 +105,28 @@ def enableSeparateBuildPerCPUArchitecture = false
*/
def enableProguardInReleaseBuilds = false
/**
* The preferred build flavor of JavaScriptCore.
*
* For example, to use the international variant, you can use:
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
*
* The international variant includes ICU i18n library and necessary data
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
* give correct results when using with locales other than en-US. Note that
* this variant is about 6MiB larger per architecture than default.
*/
def jscFlavor = 'org.webkit:android-jsc-intl:r241213'
/**
* Whether to enable the Hermes VM.
*
* This should be set on project.ext.react and mirrored here. If it is not set
* on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
* and the benefits of using Hermes will therefore be sharply reduced.
*/
def enableHermes = project.ext.react.get("enableHermes", false);
android {
compileSdkVersion rootProject.ext.compileSdkVersion
@ -113,16 +135,11 @@ android {
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
pickFirst '**/libjsc.so'
pickFirst '**/libc++_shared.so'
}
defaultConfig {
applicationId "com.mattermost.rnbeta"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
missingDimensionStrategy "RNN.reactNativeVersion", "reactNative57_5"
missingDimensionStrategy "RNN.reactNativeVersion", "reactNative60"
versionCode 241
versionName "1.25.0"
multiDexEnabled = true
@ -211,15 +228,21 @@ configurations.all {
}
dependencies {
// Make sure to put android-jsc at the top
implementation "org.webkit:android-jsc-intl:r241213"
if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:percent:28.0.0'
implementation "com.google.firebase:firebase-messaging:17.3.0"
implementation "com.facebook.react:react-native:+" // From node_modules
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation "com.google.firebase:firebase-messaging:17.3.0"
implementation project(':react-native-document-picker')
implementation project(':react-native-keychain')
implementation project(':react-native-doc-viewer')
@ -235,22 +258,22 @@ dependencies {
implementation project(':react-native-local-auth')
implementation project(':jail-monkey')
implementation project(':react-native-youtube')
implementation project(':react-native-sentry')
implementation project(':react-native-exception-handler')
implementation project(':rn-fetch-blob')
implementation project(':react-native-webview')
implementation project(':react-native-gesture-handler')
implementation project(':@react-native-community_async-storage')
implementation project(':@react-native-community_netinfo')
implementation project(':@sentry_react-native')
implementation project(':react-native-android-open-settings')
implementation project(':react-native-haptic-feedback')
// For animated GIF support
implementation 'com.facebook.fresco:fresco:1.10.0'
implementation 'com.facebook.fresco:animated-gif:1.10.0'
implementation 'com.facebook.fresco:fresco:2.0.0'
implementation 'com.facebook.fresco:animated-gif:2.0.0'
// For WebP support, including animated WebP
implementation 'com.facebook.fresco:animated-webp:1.10.0'
implementation 'com.facebook.fresco:webpsupport:1.10.0'
implementation 'com.facebook.fresco:animated-webp:2.0.0'
implementation 'com.facebook.fresco:webpsupport:2.0.0'
}
// Run this once to be able to run the application with BUCK

View file

@ -8,10 +8,3 @@
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

View file

@ -29,7 +29,8 @@
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize">
android:windowSoftInputMode="adjustResize"
android:launchMode="singleInstance">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
@ -52,7 +53,8 @@
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
android:taskAffinity="com.mattermost.share">
<intent-filter>
<action android:name="android.intent.action.SEND" />
<action android:name="android.intent.action.SEND_MULTIPLE" />

View file

@ -1,7 +1,7 @@
package com.mattermost.rnbeta;
import android.os.Bundle;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;
import com.reactnativenavigation.NavigationActivity;
@ -10,19 +10,5 @@ public class MainActivity extends NavigationActivity {
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.launch_screen);
/**
* Reference: https://stackoverflow.com/questions/7944338/resume-last-activity-when-launcher-icon-is-clicked
* 1. Open app from launcher/appDrawer
* 2. Go home
* 3. Send notification and open
* 4. It creates a new Activity and Destroys the old
* 5. Causing an unnecessary app restart
* 6. This solution short-circuits the restart
*/
if (!isTaskRoot()) {
finish();
return;
}
}
}

View file

@ -1,7 +1,7 @@
package com.mattermost.rnbeta;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import android.content.Context;
import android.content.RestrictionsManager;
import android.os.Bundle;
@ -22,15 +22,15 @@ import com.wix.reactnativenotifications.RNNotificationsModule;
import io.tradle.react.LocalAuthModule;
import com.gantix.JailMonkey.JailMonkeyModule;
import com.RNFetchBlob.RNFetchBlob;
import io.sentry.RNSentryModule;
import io.sentry.RNSentryEventEmitter;
import com.masteratul.exceptionhandler.ReactNativeExceptionHandlerModule;
import com.inprogress.reactnativeyoutube.YouTubeStandaloneModule;
import com.reactlibrary.RNReactNativeDocViewerModule;
import com.reactnativedocumentpicker.DocumentPicker;
import com.philipphecht.RNDocViewerModule;
import io.github.elyx0.reactnativedocumentpicker.DocumentPickerModule;
import com.oblador.keychain.KeychainModule;
import com.reactnativecommunity.asyncstorage.AsyncStorageModule;
import com.reactnativecommunity.netinfo.NetInfoModule;
import com.reactnativecommunity.webview.RNCWebViewPackage;
import io.sentry.RNSentryModule;
import com.levelasquez.androidopensettings.AndroidOpenSettings;
import com.mkuczera.RNReactNativeHapticFeedbackModule;
@ -124,7 +124,7 @@ public class MainApplication extends NavigationApplication implements INotificat
case "RNLocalAuth":
return new LocalAuthModule(reactContext);
case "JailMonkey":
return new JailMonkeyModule(reactContext);
return new JailMonkeyModule(reactContext, false);
case "RNFetchBlob":
return new RNFetchBlob(reactContext);
case "MattermostManaged":
@ -133,20 +133,18 @@ public class MainApplication extends NavigationApplication implements INotificat
return NotificationPreferencesModule.getInstance(instance, reactContext);
case "RNTextInputReset":
return new RNTextInputResetModule(reactContext);
case "RNSentry":
return new RNSentryModule(reactContext);
case "RNSentryEventEmitter":
return new RNSentryEventEmitter(reactContext);
case "ReactNativeExceptionHandler":
return new ReactNativeExceptionHandlerModule(reactContext);
case "YouTubeStandaloneModule":
return new YouTubeStandaloneModule(reactContext);
case "RNReactNativeDocViewer":
return new RNReactNativeDocViewerModule(reactContext);
case "RNDocViewer":
return new RNDocViewerModule(reactContext);
case "RNDocumentPicker":
return new DocumentPicker(reactContext);
return new DocumentPickerModule(reactContext);
case "RNKeychainManager":
return new KeychainModule(reactContext);
case "RNSentry":
return new RNSentryModule(reactContext);
case AsyncStorageModule.NAME:
return new AsyncStorageModule(reactContext);
case NetInfoModule.NAME:
@ -179,13 +177,12 @@ public class MainApplication extends NavigationApplication implements INotificat
map.put("RNLocalAuth", new ReactModuleInfo("RNLocalAuth", "io.tradle.react.LocalAuthModule", false, false, false, false, false));
map.put("JailMonkey", new ReactModuleInfo("JailMonkey", "com.gantix.JailMonkey.JailMonkeyModule", false, false, true, false, false));
map.put("RNFetchBlob", new ReactModuleInfo("RNFetchBlob", "com.RNFetchBlob.RNFetchBlob", false, false, true, false, false));
map.put("RNSentry", new ReactModuleInfo("RNSentry", "com.sentry.RNSentryModule", false, false, true, false, false));
map.put("RNSentryEventEmitter", new ReactModuleInfo("RNSentryEventEmitter", "com.sentry.RNSentryEventEmitter", false, false, true, false, false));
map.put("ReactNativeExceptionHandler", new ReactModuleInfo("ReactNativeExceptionHandler", "com.masteratul.exceptionhandler.ReactNativeExceptionHandlerModule", false, false, false, false, false));
map.put("YouTubeStandaloneModule", new ReactModuleInfo("YouTubeStandaloneModule", "com.inprogress.reactnativeyoutube.YouTubeStandaloneModule", false, false, false, false, false));
map.put("RNReactNativeDocViewer", new ReactModuleInfo("RNReactNativeDocViewer", "com.reactlibrary.RNReactNativeDocViewerModule", false, false, false, false, false));
map.put("RNDocumentPicker", new ReactModuleInfo("RNDocumentPicker", "com.reactnativedocumentpicker.DocumentPicker", false, false, false, false, false));
map.put("RNDocViewer", new ReactModuleInfo("RNDocViewer", "com.philipphecht.RNDocViewerModule", false, false, false, false, false));
map.put("RNDocumentPicker", new ReactModuleInfo("RNDocumentPicker", "io.github.elyx0.reactnativedocumentpicker.DocumentPickerModule", false, false, false, false, false));
map.put("RNKeychainManager", new ReactModuleInfo("RNKeychainManager", "com.oblador.keychain.KeychainModule", false, false, true, false, false));
map.put("RNSentry", new ReactModuleInfo("RNSentry", "com.sentry.RNSentryModule", false, false, true, false, false));
map.put(AsyncStorageModule.NAME, new ReactModuleInfo(AsyncStorageModule.NAME, "com.reactnativecommunity.asyncstorage.AsyncStorageModule", false, false, false, false, false));
map.put(NetInfoModule.NAME, new ReactModuleInfo(NetInfoModule.NAME, "com.reactnativecommunity.netinfo.NetInfoModule", false, false, false, false, false));
map.put("RNAndroidOpenSettings", new ReactModuleInfo("RNAndroidOpenSettings", "com.levelasquez.androidopensettings.AndroidOpenSettings", false, false, false, false, false));

View file

@ -10,7 +10,7 @@ import android.content.Intent;
import android.content.res.Resources;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;
import android.util.Log;
import java.io.IOException;

View file

@ -1,8 +1,8 @@
package com.mattermost.rnbeta;
import android.support.v13.view.inputmethod.EditorInfoCompat;
import android.support.v13.view.inputmethod.InputConnectionCompat;
import android.support.v4.os.BuildCompat;
import androidx.core.view.inputmethod.EditorInfoCompat;
import androidx.core.view.inputmethod.InputConnectionCompat;
import androidx.core.os.BuildCompat;
import android.text.InputType;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;

View file

@ -1,7 +1,7 @@
package com.mattermost.rnbeta;
import android.content.Context;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;
import android.util.Log;
import java.lang.System;

View file

@ -77,7 +77,7 @@ public class ShareModule extends ReactContextBaseJavaModule {
this.clear();
Activity currentActivity = getCurrentActivity();
if (currentActivity != null) {
currentActivity.finish();
currentActivity.finishAndRemoveTask();
}
if (data != null && data.hasKey("url")) {

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.percent.PercentRelativeLayout
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
@ -16,4 +16,4 @@
android:adjustViewBounds="true"
android:src="@drawable/splash" />
</android.support.percent.PercentRelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -15,7 +15,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
classpath 'com.android.tools.build:gradle:3.4.2'
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong

View file

@ -20,3 +20,6 @@ org.gradle.jvmargs=-Xmx2048M
#android.enableAapt2=false
#android.useDeprecatedNdk=true
android.useAndroidX=true
android.enableJetifier=true

View file

@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-all.zip

View file

@ -1,8 +0,0 @@
keystore(
name = "debug",
properties = "debug.keystore.properties",
store = "debug.keystore",
visibility = [
"PUBLIC",
],
)

View file

@ -1,4 +0,0 @@
key.store=debug.keystore
key.alias=androiddebugkey
key.store.password=android
key.alias.password=android

View file

@ -1,4 +1,6 @@
rootProject.name = 'Mattermost'
include ':@sentry_react-native'
project(':@sentry_react-native').projectDir = new File(rootProject.projectDir, '../node_modules/@sentry/react-native/android')
include ':react-native-android-open-settings'
project(':react-native-android-open-settings').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-android-open-settings/android')
include ':react-native-haptic-feedback'
@ -15,8 +17,6 @@ include ':react-native-video'
project(':react-native-video').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-video/android')
include ':react-native-youtube'
project(':react-native-youtube').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-youtube/android')
include ':react-native-sentry'
project(':react-native-sentry').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-sentry/android')
include ':react-native-exception-handler'
project(':react-native-exception-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-exception-handler/android')
include ':rn-fetch-blob'

View file

@ -27,6 +27,7 @@ exports[`profile_picture_button should match snapshot 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",

View file

@ -14,7 +14,7 @@ import DeviceInfo from 'react-native-device-info';
import AndroidOpenSettings from 'react-native-android-open-settings';
import Icon from 'react-native-vector-icons/Ionicons';
import {DocumentPicker} from 'react-native-document-picker';
import DocumentPicker from 'react-native-document-picker';
import ImagePicker from 'react-native-image-picker';
import Permissions from 'react-native-permissions';
@ -257,13 +257,8 @@ export default class AttachmentButton extends PureComponent {
const hasPermission = await this.hasStoragePermission();
if (hasPermission) {
DocumentPicker.show({
filetype: [browseFileTypes],
}, async (error, res) => {
if (error) {
return;
}
try {
const res = await DocumentPicker.pick({type: [browseFileTypes]});
if (Platform.OS === 'android') {
// For android we need to retrieve the realPath in case the file being imported is from the cloud
const newUri = await ShareExtension.getFilePath(res.uri);
@ -278,7 +273,9 @@ export default class AttachmentButton extends PureComponent {
res.uri = decodeURIComponent(res.uri);
this.uploadFiles([res]);
});
} catch (error) {
// Do nothing
}
}
};

View file

@ -15,12 +15,6 @@ import AttachmentButton from './index';
jest.mock('react-intl');
jest.mock('Platform', () => {
const Platform = require.requireActual('Platform');
Platform.OS = 'ios';
return Platform;
});
describe('AttachmentButton', () => {
const formatMessage = jest.fn();
const baseProps = {

View file

@ -59,19 +59,19 @@ export default class Badge extends PureComponent {
this.mounted = false;
}
setBadgeRef = (ref) => {
this.badgeRef = ref;
};
handlePress = () => {
if (this.props.onPress) {
this.props.onPress();
}
};
setBadgeRef = (ref) => {
this.badgeContainerRef = ref;
};
setNativeProps = (props) => {
if (this.mounted && this.badgeContainerRef) {
this.badgeContainerRef.setNativeProps(props);
if (this.mounted && this.badgeRef) {
this.badgeRef.setNativeProps(props);
}
};

View file

@ -74,6 +74,7 @@ exports[`UserListRow should match snapshot 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -105,6 +106,7 @@ exports[`UserListRow should match snapshot 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -202,6 +204,7 @@ exports[`UserListRow should match snapshot for currentUser with (you) populated
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -233,6 +236,7 @@ exports[`UserListRow should match snapshot for currentUser with (you) populated
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -332,6 +336,7 @@ exports[`UserListRow should match snapshot for deactivated user 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -363,6 +368,7 @@ exports[`UserListRow should match snapshot for deactivated user 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -473,6 +479,7 @@ exports[`UserListRow should match snapshot for guest user 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -504,6 +511,7 @@ exports[`UserListRow should match snapshot for guest user 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",

View file

@ -27,7 +27,7 @@ export default class EmojiPicker extends EmojiPickerBase {
<React.Fragment>
<View style={styles.searchBar}>
<SearchBar
ref={this.searchBarRef}
ref={this.setSearchBarRef}
placeholder={formatMessage({id: 'search_bar.search', defaultMessage: 'Search'})}
cancelTitle={formatMessage({id: 'mobile.post.cancel', defaultMessage: 'Cancel'})}
backgroundColor='transparent'

View file

@ -49,7 +49,7 @@ export default class EmojiPicker extends EmojiPickerBase {
>
<View style={[styles.searchBar, padding(isLandscape)]}>
<SearchBar
ref={this.searchBarRef}
ref={this.setSearchBarRef}
placeholder={formatMessage({id: 'search_bar.search', defaultMessage: 'Search'})}
cancelTitle={formatMessage({id: 'mobile.post.cancel', defaultMessage: 'Cancel'})}
backgroundColor='transparent'
@ -71,7 +71,6 @@ export default class EmojiPicker extends EmojiPickerBase {
{this.renderListComponent(shorten)}
{!searchTerm &&
<KeyboardTrackingView
ref={this.keyboardTracker}
scrollViewNativeID={SCROLLVIEW_NATIVE_ID}
normalList={true}
>

View file

@ -80,7 +80,6 @@ export default class EmojiPicker extends PureComponent {
const emojis = this.renderableEmojis(props.emojisBySection, props.deviceWidth);
const emojiSectionIndexByOffset = this.measureEmojiSections(emojis);
this.searchBarRef = React.createRef();
this.scrollToSectionTries = 0;
this.state = {
emojis,
@ -97,8 +96,8 @@ export default class EmojiPicker extends PureComponent {
if (this.props.deviceWidth !== nextProps.deviceWidth) {
this.rebuildEmojis = true;
if (this.searchBarRef?.current) {
this.searchBarRef.current.blur();
if (this.searchBarRef) {
this.searchBarRef.blur();
}
}
@ -108,6 +107,14 @@ export default class EmojiPicker extends PureComponent {
}
}
setSearchBarRef = (ref) => {
this.searchBarRef = ref;
}
setSectionListRef = (ref) => {
this.sectionListRef = ref;
};
setRebuiltEmojis = (searchBarAnimationComplete = true) => {
if (this.rebuildEmojis && searchBarAnimationComplete) {
this.rebuildEmojis = false;
@ -253,6 +260,7 @@ export default class EmojiPicker extends PureComponent {
} else {
listComponent = (
<SectionList
ref={this.setSectionListRef}
getItemLayout={this.sectionListGetItemLayout}
initialNumToRender={50}
keyboardShouldPersistTaps='always'
@ -265,7 +273,6 @@ export default class EmojiPicker extends PureComponent {
onScroll={this.onScroll}
onScrollToIndexFailed={this.handleScrollToSectionFailed}
pageSize={50}
ref={this.attachSectionList}
removeClippedSubviews={false}
renderItem={this.renderItem}
renderSectionHeader={this.renderSectionHeader}
@ -356,7 +363,7 @@ export default class EmojiPicker extends PureComponent {
jumpToSection: true,
currentSectionIndex: index,
}, () => {
this.sectionList.scrollToLocation({
this.sectionListRef.scrollToLocation({
sectionIndex: index,
itemIndex: 0,
viewOffset: 25,
@ -423,10 +430,6 @@ export default class EmojiPicker extends PureComponent {
});
};
attachSectionList = (c) => {
this.sectionList = c;
};
renderFooter = () => {
if (!this.state.missingPages) {
return null;

View file

@ -42,6 +42,7 @@ exports[`FileAttachment should match snapshot 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",

View file

@ -48,6 +48,7 @@ exports[`PostAttachmentOpenGraph should match snapshot with a single image file
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",

View file

@ -69,7 +69,7 @@ export default class FileAttachmentDocument extends PureComponent {
componentDidMount() {
this.mounted = true;
this.eventEmitter = new NativeEventEmitter(NativeModules.RNReactNativeDocViewer);
this.eventEmitter = new NativeEventEmitter(NativeModules.RNDocViewer);
this.eventEmitter.addListener('DoneButtonEvent', this.onDonePreviewingFile);
}

View file

@ -5,22 +5,19 @@ import {PropTypes} from 'prop-types';
import React from 'react';
import {intlShape} from 'react-intl';
import {
Platform,
Clipboard,
StyleSheet,
Text,
View,
} from 'react-native';
import SyntaxHighlighter from 'react-native-syntax-highlighter';
import CustomPropTypes from 'app/constants/custom_prop_types';
import FormattedText from 'app/components/formatted_text';
import TouchableWithFeedback from 'app/components/touchable_with_feedback';
import BottomSheet from 'app/utils/bottom_sheet';
import {getDisplayNameForLanguage, getCodeFont} from 'app/utils/markdown';
import {getDisplayNameForLanguage} from 'app/utils/markdown';
import {preventDoubleTap} from 'app/utils/tap';
import {changeOpacity, makeStyleSheetFromTheme, getHighlightStyleFromTheme} from 'app/utils/theme';
import {changeOpacity, makeStyleSheetFromTheme} from 'app/utils/theme';
import mattermostManaged from 'app/mattermost_managed';
import {goToScreen} from 'app/actions/navigation';
@ -43,13 +40,11 @@ export default class MarkdownCodeBlock extends React.PureComponent {
};
handlePress = preventDoubleTap(() => {
const {language, content, textStyle} = this.props;
const {language, content} = this.props;
const {intl} = this.context;
const screen = 'Code';
const passProps = {
content,
language,
textStyle,
};
const languageDisplayName = getDisplayNameForLanguage(language);
@ -155,26 +150,6 @@ export default class MarkdownCodeBlock extends React.PureComponent {
);
}
let textComponent = null;
if (Platform.OS === 'ios') {
textComponent = (
<SyntaxHighlighter
language={this.props.language}
style={getHighlightStyleFromTheme(this.props.theme)}
highlighter={'hljs'}
customStyle={{...style.codeText, ...this.props.textStyle}}
>
{content}
</SyntaxHighlighter>
);
} else {
textComponent = (
<Text style={[style.codeText, this.props.textStyle]}>
{content}
</Text>
);
}
return (
<TouchableWithFeedback
onPress={this.handlePress}
@ -189,7 +164,9 @@ export default class MarkdownCodeBlock extends React.PureComponent {
</View>
<View style={style.rightColumn}>
<View style={style.code}>
{textComponent}
<Text style={[style.codeText, this.props.textStyle]}>
{content}
</Text>
</View>
{plusMoreLines}
</View>
@ -227,15 +204,7 @@ const getStyleSheet = makeStyleSheetFromTheme((theme) => {
flexDirection: 'column',
flex: 1,
paddingHorizontal: 6,
...Platform.select({
ios: {
paddingVertical: 0,
backgroundColor: getHighlightStyleFromTheme(theme).hljs.background,
},
android: {
paddingVertical: 4,
},
}),
paddingVertical: 4,
},
code: {
flexDirection: 'row',
@ -245,12 +214,6 @@ const getStyleSheet = makeStyleSheetFromTheme((theme) => {
color: changeOpacity(theme.centerChannelColor, 0.65),
fontSize: 12,
lineHeight: 18,
...Platform.select({
ios: {
fontFamily: getCodeFont(),
paddingVertical: 6,
},
}),
},
plusMoreLinesText: {
color: changeOpacity(theme.centerChannelColor, 0.4),

View file

@ -92,6 +92,14 @@ export default class MarkdownImage extends React.Component {
this.mounted = false;
}
setImageRef = (ref) => {
this.imageRef = ref;
}
setItemRef = (ref) => {
this.itemRef = ref;
}
getSource = () => {
let source = this.props.source;
@ -195,7 +203,7 @@ export default class MarkdownImage extends React.Component {
},
}];
previewImageAtIndex([this.refs.item], 0, files);
previewImageAtIndex([this.itemRef], 0, files);
};
loadImageSize = (source) => {
@ -252,7 +260,7 @@ export default class MarkdownImage extends React.Component {
style={{width, height}}
>
<ProgressiveImage
ref='image'
ref={this.setImageRef}
defaultSource={source}
resizeMode='contain'
style={{width, height}}
@ -282,7 +290,7 @@ export default class MarkdownImage extends React.Component {
return (
<View
ref='item'
ref={this.setItemRef}
style={style.container}
>
{image}

View file

@ -52,6 +52,14 @@ export default class AttachmentImage extends PureComponent {
}
}
setImageRef = (ref) => {
this.imageRef = ref;
}
setItemRef = (ref) => {
this.itemRef = ref;
}
handlePreviewImage = () => {
const {imageUrl} = this.props;
const {
@ -79,7 +87,7 @@ export default class AttachmentImage extends PureComponent {
localPath: uri,
},
}];
previewImageAtIndex([this.refs.item], 0, files);
previewImageAtIndex([this.itemRef], 0, files);
};
setImageDimensions = (imageUri, dimensions, originalWidth, originalHeight) => {
@ -132,7 +140,7 @@ export default class AttachmentImage extends PureComponent {
if (imageUri) {
progressiveImage = (
<ProgressiveImage
ref='image'
ref={this.setImageRef}
style={{height, width}}
imageUri={imageUri}
resizeMode='contain'
@ -149,7 +157,7 @@ export default class AttachmentImage extends PureComponent {
type={'none'}
>
<View
ref='item'
ref={this.setItemRef}
style={[style.imageContainer, {width, height}]}
>
{progressiveImage}

View file

@ -4,10 +4,14 @@
/* eslint-disable no-underscore-dangle */
import React from 'react';
import {TextInput, Text, TouchableWithoutFeedback} from 'react-native';
import UIManager from 'UIManager';
import {
TextInput,
Text,
TouchableWithoutFeedback,
UIManager,
requireNativeComponent,
} from 'react-native';
import invariant from 'invariant';
import requireNativeComponent from 'requireNativeComponent';
const AndroidTextInput = requireNativeComponent('PasteableTextInputAndroid');

View file

@ -64,6 +64,10 @@ export default class PostAttachmentOpenGraph extends PureComponent {
this.mounted = false;
}
setItemRef = (ref) => {
this.itemRef = ref;
}
fetchData = (url, openGraphData) => {
if (!openGraphData) {
this.props.actions.getOpenGraphMetadata(url);
@ -205,7 +209,7 @@ export default class PostAttachmentOpenGraph extends PureComponent {
},
}];
previewImageAtIndex([this.refs.item], 0, files);
previewImageAtIndex([this.itemRef], 0, files);
};
renderDescription = () => {
@ -247,7 +251,7 @@ export default class PostAttachmentOpenGraph extends PureComponent {
return (
<View
ref='item'
ref={this.setItemRef}
style={[style.imageContainer, {width, height}]}
>
<TouchableWithFeedback

View file

@ -44,6 +44,7 @@ exports[`PostTextBox should match, full snapshot 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -122,6 +123,7 @@ exports[`PostTextBox should match, full snapshot 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",

View file

@ -16,14 +16,6 @@ import EphemeralStore from 'app/store/ephemeral_store';
import PostTextbox from './post_textbox.ios';
jest.mock('NativeEventEmitter');
jest.mock('Alert', () => {
return {
alert: jest.fn(),
};
});
describe('PostTextBox', () => {
const baseProps = {
actions: {

View file

@ -44,8 +44,12 @@ export default class Root extends PureComponent {
}
}
setProviderRef = (ref) => {
this.providerRef = ref;
}
handleNoTeams = () => {
if (!this.refs.provider) {
if (!this.providerRef) {
setTimeout(this.handleNoTeams, 200);
return;
}
@ -53,7 +57,7 @@ export default class Root extends PureComponent {
};
errorTeamsList = () => {
if (!this.refs.provider) {
if (!this.providerRef) {
setTimeout(this.errorTeamsList, 200);
return;
}
@ -62,7 +66,7 @@ export default class Root extends PureComponent {
navigateToTeamsPage = (screen) => {
const {currentUrl, theme} = this.props;
const {intl} = this.refs.provider.getChildContext();
const {intl} = this.providerRef.getChildContext();
let passProps = {theme};
const options = {topBar: {}};
@ -99,7 +103,7 @@ export default class Root extends PureComponent {
return (
<IntlProvider
ref='provider'
ref={this.setProviderRef}
locale={locale}
messages={getTranslations(locale)}
>

View file

@ -316,12 +316,12 @@ describe('SafeAreaIos', () => {
expect(setSafeAreaInsets).toHaveBeenCalled();
setSafeAreaInsets.mockClear();
EphemeralStore.safeAreaInsets[PORTRAIT] = TEST_INSETS_1.safeAreaInsets;
EphemeralStore.safeAreaInsets[PORTRAIT] = TEST_INSETS_1.safeAreaInsets; /* eslint-disable-line require-atomic-updates */
await instance.getSafeAreaInsets();
expect(setSafeAreaInsets).toHaveBeenCalled();
setSafeAreaInsets.mockClear();
EphemeralStore.safeAreaInsets[LANDSCAPE] = TEST_INSETS_1.safeAreaInsets;
EphemeralStore.safeAreaInsets[LANDSCAPE] = TEST_INSETS_1.safeAreaInsets; /* eslint-disable-line require-atomic-updates */
await instance.getSafeAreaInsets();
expect(setSafeAreaInsets).not.toHaveBeenCalled();
});

View file

@ -76,6 +76,10 @@ export default class SearchBarAndroid extends PureComponent {
};
}
setInputRef = (ref) => {
this.inputRef = ref;
}
cancel = () => {
this.onCancelButtonPress();
};
@ -123,11 +127,11 @@ export default class SearchBarAndroid extends PureComponent {
};
blur = () => {
this.refs.input.blur();
this.inputRef.blur();
};
focus = () => {
this.refs.input.focus();
this.inputRef.focus();
};
render() {
@ -207,7 +211,7 @@ export default class SearchBarAndroid extends PureComponent {
/>
}
<TextInput
ref='input'
ref={this.setInputRef}
blurOnSubmit={blurOnSubmit}
refocusInput={this.state.refocusInput}
value={this.props.value}

View file

@ -56,8 +56,12 @@ export default class SearchBarIos extends PureComponent {
searchIconExpandedMargin: 10,
};
setSearchRef = (ref) => {
this.searchRef = ref;
}
cancel = () => {
this.refs.search.onCancel();
this.searchRef.onCancel();
};
onBlur = () => {
@ -94,18 +98,18 @@ export default class SearchBarIos extends PureComponent {
};
blur = () => {
this.refs.search.blur();
this.searchRef.blur();
};
focus = () => {
this.refs.search.focus();
this.searchRef.focus();
};
render() {
return (
<Search
{...this.props}
ref='search'
ref={this.setSearchRef}
placeholderCollapsedMargin={33}
placeholderExpandedMargin={33}
shadowVisible={false}

View file

@ -142,15 +142,23 @@ export default class Search extends Component {
}
}
setSearchContainerRef = (ref) => {
this.searchContainerRef = ref;
}
setInputKeywordRef = (ref) => {
this.inputKeywordRef = ref;
}
blur = () => {
this.refs.input_keyword.getNode().blur();
this.inputKeywordRef.getNode().blur();
this.setState({expanded: false});
this.collapseAnimation();
};
focus = () => {
InteractionManager.runAfterInteractions(() => {
const input = this.refs.input_keyword.getNode();
const input = this.inputKeywordRef.getNode();
if (!input.isFocused()) {
input.focus();
}
@ -384,7 +392,7 @@ export default class Search extends Component {
return (
<Animated.View
ref='searchContainer'
ref={this.setSearchContainerRef}
style={[
styles.container,
this.props.backgroundColor && {backgroundColor: this.props.backgroundColor},
@ -403,7 +411,7 @@ export default class Search extends Component {
)}
<Animated.View style={{backgroundColor, right: this.inputFocusAnimated, borderRadius: 2}}>
<AnimatedTextInput
ref='input_keyword'
ref={this.setInputKeywordRef}
style={[
styles.input,
this.props.placeholderTextColor && {color: this.props.placeholderTextColor},

View file

@ -56,6 +56,7 @@ exports[`ChannelItem should match snapshot 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -172,6 +173,7 @@ exports[`ChannelItem should match snapshot for current user i.e currentUser (you
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -287,6 +289,7 @@ exports[`ChannelItem should match snapshot for current user i.e currentUser (you
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -402,6 +405,7 @@ exports[`ChannelItem should match snapshot for deactivated user and is currentCh
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -506,6 +510,7 @@ exports[`ChannelItem should match snapshot for deactivated user and is searchRes
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -611,6 +616,7 @@ exports[`ChannelItem should match snapshot for deactivated user and not searchRe
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -720,6 +726,7 @@ exports[`ChannelItem should match snapshot with draft 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -827,6 +834,7 @@ exports[`ChannelItem should match snapshot with mentions and muted 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -894,7 +902,7 @@ exports[`ChannelItem should match snapshot with mentions and muted 1`] = `
onPress={[Function]}
style={
Object {
"backgroundColor": undefined,
"backgroundColor": "#ffffff",
"height": 21,
"padding": 3,
"position": "relative",

View file

@ -55,9 +55,13 @@ export default class ChannelsList extends PureComponent {
});
}
setSearchBarRef = (ref) => {
this.searchBarRef = ref;
}
cancelSearch = () => {
if (this.refs.search_bar) {
this.refs.search_bar.cancel();
if (this.searchBarRef) {
this.searchBarRef.cancel();
}
};
@ -135,7 +139,7 @@ export default class ChannelsList extends PureComponent {
const title = (
<View style={[styles.searchContainer, padding(isLandscape)]}>
<SearchBar
ref='search_bar'
ref={this.setSearchBarRef}
placeholder={intl.formatMessage({id: 'mobile.channel_drawer.search', defaultMessage: 'Jump to...'})}
cancelTitle={intl.formatMessage({id: 'mobile.post.cancel', defaultMessage: 'Cancel'})}
inputCollapsedMargin={0}

View file

@ -98,14 +98,18 @@ export default class List extends PureComponent {
}
componentDidUpdate(prevProps, prevState) {
if (prevState.sections !== this.state.sections && this.refs.list._wrapperListRef.getListRef()._viewabilityHelper) { //eslint-disable-line
this.refs.list.recordInteraction();
if (prevState.sections !== this.state.sections && this.listRef?._wrapperListRef?.getListRef()._viewabilityHelper) { //eslint-disable-line
this.listRef.recordInteraction();
this.updateUnreadIndicators({
viewableItems: Array.from(this.refs.list._wrapperListRef.getListRef()._viewabilityHelper._viewableItems.values()) //eslint-disable-line
viewableItems: Array.from(this.listRef._wrapperListRef.getListRef()._viewabilityHelper._viewableItems.values()) //eslint-disable-line
});
}
}
setListRef = (ref) => {
this.listRef = ref;
}
getSectionConfigByType = (props, sectionType) => {
const {canCreatePrivateChannels, canJoinPublicChannels} = props;
@ -345,8 +349,8 @@ export default class List extends PureComponent {
};
scrollToTop = () => {
if (this.refs.list) {
this.refs.list._wrapperListRef.getListRef().scrollToOffset({ //eslint-disable-line no-underscore-dangle
if (this.listRef?._wrapperListRef) {
this.listRef._wrapperListRef.getListRef().scrollToOffset({ //eslint-disable-line no-underscore-dangle
x: 0,
y: 0,
animated: true,
@ -402,7 +406,7 @@ export default class List extends PureComponent {
onLayout={this.onLayout}
>
<SectionList
ref='list'
ref={this.setListRef}
sections={sections}
contentContainerStyle={{paddingBottom}}
renderItem={this.renderItem}

View file

@ -35,8 +35,8 @@ export default class DrawerSwiper extends Component {
}
runOnLayout = (shouldRun = true) => {
if (this.refs.swiper) {
this.refs.swiper.runOnLayout = shouldRun;
if (this.swiperRef) {
this.swiperRef.runOnLayout = shouldRun;
}
};

View file

@ -37,6 +37,7 @@ export default class ChannelSidebar extends Component {
makeDirectChannel: PropTypes.func.isRequired,
setChannelDisplayName: PropTypes.func.isRequired,
setChannelLoading: PropTypes.func.isRequired,
joinChannel: PropTypes.func.isRequired,
}).isRequired,
blurPostTextBox: PropTypes.func.isRequired,
children: PropTypes.node,
@ -230,10 +231,11 @@ export default class ChannelSidebar extends Component {
const {
joinChannel,
makeDirectChannel,
setChannelLoading,
} = actions;
this.closeChannelDrawer();
actions.setChannelLoading(channel.id !== currentChannelId);
setChannelLoading(channel.id !== currentChannelId);
setTimeout(async () => {
const displayValue = {displayName: channel.display_name};
@ -263,7 +265,7 @@ export default class ChannelSidebar extends Component {
}
if (result.error || (!result.data && !result.data.channel)) {
actions.setChannelLoading(false);
setChannelLoading(false);
return;
}

View file

@ -20,6 +20,7 @@ describe('MainSidebar', () => {
makeDirectChannel: jest.fn(),
setChannelDisplayName: jest.fn(),
setChannelLoading: jest.fn(),
joinChannel: jest.fn(),
},
blurPostTextBox: jest.fn(),
currentTeamId: 'current-team-id',

View file

@ -81,20 +81,32 @@ export default class SettingsDrawer extends PureComponent {
Dimensions.removeEventListener('change', this.handleDimensions);
}
setDrawerRef = (ref) => {
this.drawerRef = ref;
}
confirmReset = (status) => {
const {intl} = this.context;
confirmOutOfOfficeDisabled(intl, status, this.updateStatus);
};
closeSettingsSidebar = () => {
if (this.refs.drawer && this.drawerOpened) {
this.refs.drawer.closeDrawer();
if (this.drawerRef && this.drawerOpened) {
this.drawerRef.closeDrawer();
}
};
openSettingsSidebar = () => {
this.props.blurPostTextBox();
if (this.drawerRef && !this.drawerOpened) {
this.drawerRef.openDrawer();
}
};
handleAndroidBack = () => {
if (this.refs.drawer && this.drawerOpened) {
this.refs.drawer.closeDrawer();
if (this.drawerRef && this.drawerOpened) {
this.drawerRef.closeDrawer();
return true;
}
@ -227,12 +239,25 @@ export default class SettingsDrawer extends PureComponent {
});
};
openSettingsSidebar = () => {
this.props.blurPostTextBox();
updateStatus = (status) => {
const {currentUser: {id: currentUserId}} = this.props;
this.props.actions.setStatus({
user_id: currentUserId,
status,
});
};
if (this.refs.drawer && !this.drawerOpened) {
this.refs.drawer.openDrawer();
setStatus = (status) => {
const {status: currentUserStatus} = this.props;
if (currentUserStatus === General.OUT_OF_OFFICE) {
dismissModal();
this.closeSettingsSidebar();
this.confirmReset(status);
return;
}
this.updateStatus(status);
EventEmitter.emit(NavigationTypes.NAVIGATION_CLOSE_MODAL);
};
renderUserStatusIcon = (userId) => {
@ -341,27 +366,6 @@ export default class SettingsDrawer extends PureComponent {
);
};
updateStatus = (status) => {
const {currentUser: {id: currentUserId}} = this.props;
this.props.actions.setStatus({
user_id: currentUserId,
status,
});
};
setStatus = (status) => {
const {status: currentUserStatus} = this.props;
if (currentUserStatus === General.OUT_OF_OFFICE) {
dismissModal();
this.closeSettingsSidebar();
this.confirmReset(status);
return;
}
this.updateStatus(status);
EventEmitter.emit(NavigationTypes.NAVIGATION_CLOSE_MODAL);
};
render() {
const {children} = this.props;
const {deviceWidth, openDrawerOffset} = this.state;
@ -369,7 +373,7 @@ export default class SettingsDrawer extends PureComponent {
return (
<DrawerLayout
ref='drawer'
ref={this.setDrawerRef}
renderNavigationView={this.renderNavigationView}
onDrawerClose={this.handleDrawerClose}
onDrawerOpen={this.handleDrawerOpen}

View file

@ -22,12 +22,16 @@ export default class TextInputWithLocalizedPlaceholder extends PureComponent {
intl: intlShape.isRequired,
};
setInputRef = (ref) => {
this.inputRef = ref;
}
blur = () => {
this.refs.input.blur();
this.inputRef.blur();
};
focus = () => {
this.refs.input.focus();
this.inputRef.focus();
};
render() {
@ -40,7 +44,7 @@ export default class TextInputWithLocalizedPlaceholder extends PureComponent {
return (
<TextInput
ref='input'
ref={this.setInputRef}
{...otherProps}
placeholder={placeholderString}
disableFullscreenUI={true}

View file

@ -1,64 +0,0 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import RNToolTip from 'react-native-tooltip';
import {setToolTipVisible, getToolTipVisible} from 'app/utils/tooltip';
export default class ToolTip extends PureComponent {
static propTypes = {
onHide: PropTypes.func,
onShow: PropTypes.func,
actions: PropTypes.array.isRequired,
};
static defaultProps = {
actions: [],
}
handleHide = () => {
if (this.props.onHide) {
this.props.onHide();
}
setToolTipVisible(false);
};
handleShow = () => {
if (this.props.onShow) {
this.props.onShow();
}
setToolTipVisible();
};
hideMenu = () => {
if (this.refs.toolTip) {
this.refs.toolTip.hideMenu();
}
};
showMenu = () => {
if (this.refs.toolTip) {
this.refs.toolTip.showMenu();
}
};
componentDidUpdate(prevProps) {
if (prevProps.actions.length !== this.props.actions.length && getToolTipVisible()) {
this.refs.toolTip.hideMenu();
setTimeout(() => this.refs.toolTip.showMenu(), 1);
}
}
render() {
return (
<RNToolTip
{...this.props}
onHide={this.handleHide}
onShow={this.handleShow}
ref='toolTip'
/>
);
}
}

View file

@ -134,7 +134,7 @@ class EMMProvider {
};
showNotSecuredAlert = (translations) => {
return new Promise(async (resolve) => {
return new Promise(async (resolve) => { /* eslint-disable-line no-async-promise-executor */
const options = [];
if (Platform.OS === 'android') {

View file

@ -102,7 +102,7 @@ Client4.doFetchWithResponse = async (url, options) => {
if (headers[HEADER_X_CLUSTER_ID] || headers[HEADER_X_CLUSTER_ID.toLowerCase()]) {
const clusterId = headers[HEADER_X_CLUSTER_ID] || headers[HEADER_X_CLUSTER_ID.toLowerCase()];
if (clusterId && Client4.clusterId !== clusterId) {
Client4.clusterId = clusterId;
Client4.clusterId = clusterId; /* eslint-disable-line require-atomic-updates */
}
}

View file

@ -62,7 +62,7 @@ class GlobalEventHandler {
await emmProvider.handleAuthentication(this.store, prompt);
}
emmProvider.inBackgroundSince = null;
emmProvider.inBackgroundSince = null; /* eslint-disable-line require-atomic-updates */
};
appInactive = () => {

View file

@ -30,6 +30,10 @@ jest.mock('react-native-notifications', () => ({
NotificationCategory: jest.fn(),
}));
jest.mock('react-native-status-bar-size', () => ({
addEventListener: jest.fn(),
}));
const mockStore = configureMockStore([thunk]);
const store = mockStore(intitialState);
GlobalEventHandler.store = store;

View file

@ -38,6 +38,7 @@ exports[`ChannelNavBar should match, full snapshot 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",

View file

@ -98,7 +98,7 @@ exports[`ChannelDrawerButton should match, full snapshot 2`] = `
onPress={[Function]}
style={
Object {
"backgroundColor": undefined,
"backgroundColor": "#ffffff",
"height": 19,
"padding": 3,
}

View file

@ -33,6 +33,7 @@ export default class ChannelPostList extends PureComponent {
selectPost: PropTypes.func.isRequired,
recordLoadTime: PropTypes.func.isRequired,
refreshChannelWithRetry: PropTypes.func.isRequired,
setChannelRefreshing: PropTypes.func,
}).isRequired,
channelId: PropTypes.string.isRequired,
channelRefreshingFailed: PropTypes.bool,

View file

@ -116,6 +116,10 @@ export default class ChannelAddMembers extends PureComponent {
}
}
setSearchBarRef = (ref) => {
this.searchBarRef = ref;
}
clearSearch = () => {
this.setState({term: '', searchResults: []});
};
@ -343,7 +347,7 @@ export default class ChannelAddMembers extends PureComponent {
<StatusBar/>
<View style={[style.searchBar, padding(isLandscape)]}>
<SearchBar
ref='search_bar'
ref={this.setSearchBarRef}
placeholder={formatMessage({id: 'search_bar.search', defaultMessage: 'Search'})}
cancelTitle={formatMessage({id: 'mobile.post.cancel', defaultMessage: 'Cancel'})}
backgroundColor='transparent'

View file

@ -44,6 +44,7 @@ exports[`channel_info should match snapshot 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -95,6 +96,7 @@ exports[`channel_info should match snapshot 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -143,6 +145,7 @@ exports[`channel_info should match snapshot 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -191,6 +194,7 @@ exports[`channel_info should match snapshot 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -238,6 +242,7 @@ exports[`channel_info should match snapshot 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -287,6 +292,7 @@ exports[`channel_info should match snapshot 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -336,6 +342,7 @@ exports[`channel_info should match snapshot 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -385,6 +392,7 @@ exports[`channel_info should match snapshot 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -434,6 +442,7 @@ exports[`channel_info should match snapshot 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -484,6 +493,7 @@ exports[`channel_info should match snapshot 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -546,6 +556,7 @@ exports[`channel_info should match snapshot 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",

View file

@ -47,6 +47,7 @@ exports[`channel_info_header should match snapshot 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -463,6 +464,7 @@ exports[`channel_info_header should match snapshot when DM and hasGuests and is
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -907,6 +909,7 @@ exports[`channel_info_header should match snapshot when DM and hasGuests but its
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -1323,6 +1326,7 @@ exports[`channel_info_header should match snapshot when GM and hasGuests 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -1767,6 +1771,7 @@ exports[`channel_info_header should match snapshot when is group constrained 1`]
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -2205,6 +2210,7 @@ exports[`channel_info_header should match snapshot when public channel and hasGu
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",

View file

@ -68,6 +68,7 @@ exports[`ChannelMembers should match snapshot 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",

View file

@ -108,6 +108,10 @@ export default class ChannelMembers extends PureComponent {
}
}
setSearchBarRef = (ref) => {
this.searchBarRef = ref;
}
clearSearch = () => {
this.setState({term: '', searchResults: []});
};
@ -371,7 +375,7 @@ export default class ChannelMembers extends PureComponent {
<StatusBar/>
<View style={[style.searchBar, padding(isLandscape)]}>
<SearchBar
ref='search_bar'
ref={this.setSearchBarRef}
placeholder={formatMessage({id: 'search_bar.search', defaultMessage: 'Search'})}
cancelTitle={formatMessage({id: 'mobile.post.cancel', defaultMessage: 'Cancel'})}
backgroundColor='transparent'

View file

@ -13,17 +13,12 @@ import {
View,
} from 'react-native';
import SyntaxHighlighter from 'react-native-syntax-highlighter';
import CustomPropTypes from 'app/constants/custom_prop_types';
import {getCodeFont} from 'app/utils/markdown';
import {
changeOpacity,
makeStyleSheetFromTheme,
setNavigatorStyles,
getKeyboardAppearanceFromTheme,
getHighlightStyleFromTheme,
} from 'app/utils/theme';
import {popTopScreen} from 'app/actions/navigation';
@ -32,8 +27,6 @@ export default class Code extends React.PureComponent {
componentId: PropTypes.string,
theme: PropTypes.object.isRequired,
content: PropTypes.string.isRequired,
language: PropTypes.string,
textStyle: CustomPropTypes.Style,
};
componentDidMount() {
@ -80,20 +73,13 @@ export default class Code extends React.PureComponent {
let textComponent;
if (Platform.OS === 'ios') {
textComponent = (
<SyntaxHighlighter
language={this.props.language}
style={getHighlightStyleFromTheme(this.props.theme)}
highlighter={'hljs'}
CodeTag={TextInput}
codeTagProps={{
editable: false,
multiline: true,
keyboardAppearance: getKeyboardAppearanceFromTheme(this.props.theme),
style: {...style.codeText, ...this.props.textStyle},
}}
>
{this.props.content}
</SyntaxHighlighter>
<TextInput
editable={false}
multiline={true}
value={this.props.content}
style={[style.codeText]}
keyboardAppearance={getKeyboardAppearanceFromTheme(this.props.theme)}
/>
);
} else {
textComponent = (
@ -159,7 +145,6 @@ const getStyleSheet = makeStyleSheetFromTheme((theme) => {
flexGrow: 0,
flexShrink: 1,
width: '100%',
backgroundColor: getHighlightStyleFromTheme(theme).hljs.background,
},
code: {
paddingHorizontal: 6,
@ -167,6 +152,9 @@ const getStyleSheet = makeStyleSheetFromTheme((theme) => {
android: {
paddingVertical: 4,
},
ios: {
top: -4,
},
}),
},
codeText: {
@ -176,7 +164,8 @@ const getStyleSheet = makeStyleSheetFromTheme((theme) => {
lineHeight: 18,
...Platform.select({
ios: {
top: -11,
margin: 0,
padding: 0,
},
}),
},

View file

@ -40,6 +40,7 @@ exports[`edit_profile should match snapshot 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",

View file

@ -7,7 +7,7 @@ import {intlShape} from 'react-intl';
import {Alert, View} from 'react-native';
import RNFetchBlob from 'rn-fetch-blob';
import {KeyboardAwareScrollView} from 'react-native-keyboard-aware-scroll-view';
import {DocumentPickerUtil} from 'react-native-document-picker';
import DocumentPicker from 'react-native-document-picker';
import {Navigation} from 'react-native-navigation';
import {Client4} from 'mattermost-redux/client';
@ -521,7 +521,7 @@ export default class EditProfile extends PureComponent {
currentUser={currentUser}
theme={theme}
blurTextBox={emptyFunction}
browseFileTypes={DocumentPickerUtil.images()}
browseFileTypes={DocumentPicker.types.images}
canTakeVideo={false}
canBrowseVideoLibrary={false}
maxFileSize={MAX_SIZE}

View file

@ -27,6 +27,7 @@ exports[`ErrorTeamsList should match snapshot 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",

View file

@ -23,6 +23,7 @@ exports[`FlaggedPosts should match snapshot 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",

View file

@ -72,6 +72,10 @@ export default class FlaggedPosts extends PureComponent {
}
}
setListRef = (ref) => {
this.listRef = ref;
}
goToThread = (post) => {
const {actions} = this.props;
const channelId = post.channel_id;
@ -212,7 +216,7 @@ export default class FlaggedPosts extends PureComponent {
} else if (postIds.length) {
component = (
<FlatList
ref='list'
ref={this.setListRef}
contentContainerStyle={style.sectionList}
data={postIds}
keyExtractor={this.keyExtractor}

View file

@ -276,7 +276,7 @@ export default class Downloader extends PureComponent {
let path = res.path();
if (saveToCameraRoll) {
path = await CameraRoll.saveToCameraRoll(path, 'photo');
path = await CameraRoll.saveToCameraRoll(path, 'photo'); /* eslint-disable-line require-atomic-updates */
}
if (this.mounted) {

View file

@ -99,6 +99,14 @@ export default class ImagePreview extends PureComponent {
StatusBar.setHidden(false, 'fade');
}
setDocumentRef = (ref) => {
this.documents[this.state.index] = ref;
}
setDownloaderRef = (ref) => {
this.downloaderRef = ref;
}
animateOpenAnimToValue = (toValue, onComplete) => {
Animated.timing(this.openAnim, {
...ANIM_CONFIG,
@ -194,9 +202,7 @@ export default class ImagePreview extends PureComponent {
return (
<View style={[style.flex, style.center]}>
<FileAttachmentDocument
ref={(ref) => {
this.documents[this.state.index] = ref;
}}
ref={this.setDocumentRef}
backgroundColor='transparent'
canDownloadFiles={canDownloadFiles}
file={file}
@ -278,7 +284,7 @@ export default class ImagePreview extends PureComponent {
return (
<Downloader
ref='downloader'
ref={this.setDownloaderRef}
show={this.state.showDownloader}
file={file}
deviceHeight={deviceHeight}
@ -414,9 +420,9 @@ export default class ImagePreview extends PureComponent {
saveVideoIOS = () => {
const file = this.getCurrentFile();
if (this.refs.downloader) {
if (this.downloaderRef) {
EventEmitter.emit(NavigationTypes.NAVIGATION_CLOSE_MODAL);
this.refs.downloader.saveVideo(getLocalFilePathFromFile(VIDEOS_PATH, file));
this.downloaderRef.saveVideo(getLocalFilePathFromFile(VIDEOS_PATH, file));
}
};

View file

@ -68,6 +68,14 @@ export default class VideoPreview extends PureComponent {
EventEmitter.off('stop-video-playback', this.stopPlayback);
}
setVideoPlayerRef = (ref) => {
this.videoPlayerRef = ref;
}
setControlsRef = (ref) => {
this.controlsRef = ref;
}
async initializeComponent() {
const {file} = this.props;
const prefix = Platform.OS === 'android' ? 'file:/' : '';
@ -210,7 +218,7 @@ export default class VideoPreview extends PureComponent {
onPress={() => this.refs.controls.fadeInControls()}
>
<Video
ref='videoPlayer'
ref={this.setVideoPlayerRef}
style={[StyleSheet.absoluteFill, {position: 'absolute'}]}
resizeMode='contain'
source={{uri: path}}
@ -224,7 +232,7 @@ export default class VideoPreview extends PureComponent {
/>
</TouchableOpacity>
<VideoControls
ref='controls'
ref={this.setControlsRef}
mainColor={theme.linkColor}
playerState={playerState}
isFullScreen={isFullScreen}

View file

@ -30,6 +30,7 @@ exports[`InteractiveDialog should display introduction text if present 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",

View file

@ -76,6 +76,7 @@ LongPost {
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -95,6 +96,7 @@ LongPost {
},
"refs": Object {},
"setState": [Function],
"setViewRef": [Function],
"state": null,
"updater": Updater {
"_callbacks": Array [],
@ -138,6 +140,7 @@ LongPost {
"useMemo": [Function],
"useReducer": [Function],
"useRef": [Function],
"useResponder": [Function],
"useState": [Function],
},
"_element": <LongPost
@ -188,6 +191,7 @@ LongPost {
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",

View file

@ -76,6 +76,10 @@ export default class LongPost extends PureComponent {
}
}
setViewRef = (ref) => {
this.viewRef = ref;
}
goToThread = preventDoubleTap((post) => {
const {actions} = this.props;
const channelId = post.channel_id;
@ -94,8 +98,8 @@ export default class LongPost extends PureComponent {
});
handleClose = () => {
if (this.refs.view) {
this.refs.view.zoomOut().then(() => {
if (this.viewRef) {
this.viewRef.zoomOut().then(() => {
dismissModal();
});
}
@ -165,7 +169,7 @@ export default class LongPost extends PureComponent {
>
<View style={[style.container, margin(isLandscape)]}>
<Animatable.View
ref='view'
ref={this.setViewRef}
animation='zoomIn'
duration={200}
delay={0}

View file

@ -96,6 +96,7 @@ exports[`MoreChannels should match snapshot 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",

View file

@ -125,6 +125,10 @@ export default class MoreChannels extends PureComponent {
}
}
setSearchBarRef = (ref) => {
this.searchBarRef = ref;
}
cancelSearch = () => {
const {channels} = this.props;
@ -340,7 +344,7 @@ export default class MoreChannels extends PureComponent {
<React.Fragment>
<View style={[style.searchBar, padding(isLandscape)]}>
<SearchBar
ref='search_bar'
ref={this.setSearchBarRef}
placeholder={formatMessage({id: 'search_bar.search', defaultMessage: 'Search'})}
cancelTitle={formatMessage({id: 'mobile.post.cancel', defaultMessage: 'Cancel'})}
backgroundColor='transparent'

View file

@ -113,6 +113,10 @@ export default class MoreDirectMessages extends PureComponent {
}
}
setSearchBarRef = (ref) => {
this.searchBarRef = ref;
}
close = () => {
dismissModal();
};
@ -460,7 +464,7 @@ export default class MoreDirectMessages extends PureComponent {
<StatusBar/>
<View style={[style.searchBar, padding(isLandscape)]}>
<SearchBar
ref='search_bar'
ref={this.setSearchBarRef}
placeholder={formatMessage({id: 'search_bar.search', defaultMessage: 'Search'})}
cancelTitle={formatMessage({id: 'mobile.post.cancel', defaultMessage: 'Cancel'})}
backgroundColor='transparent'

View file

@ -32,6 +32,7 @@ exports[`SelectedUsers should match snapshot 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -109,6 +110,7 @@ exports[`SelectedUsers should match snapshot for no warning message 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -168,6 +170,7 @@ exports[`SelectedUsers should match snapshot to show warning for ability to add
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -205,6 +208,7 @@ exports[`SelectedUsers should match snapshot to show warning for ability to add
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",

View file

@ -178,6 +178,10 @@ export default class Permalink extends PureComponent {
}
}
setViewRef = (ref) => {
this.viewRef = ref;
}
goToThread = preventDoubleTap((post) => {
const {actions} = this.props;
const channelId = post.channel_id;
@ -197,9 +201,9 @@ export default class Permalink extends PureComponent {
handleClose = () => {
const {actions, onClose} = this.props;
if (this.refs.view) {
if (this.viewRef) {
this.mounted = false;
this.refs.view.zoomOut().then(() => {
this.viewRef.zoomOut().then(() => {
actions.selectPost('');
dismissModal();
@ -221,8 +225,8 @@ export default class Permalink extends PureComponent {
handlePress = () => {
const {channelIdState} = this.state;
if (this.refs.view) {
this.refs.view.growOut().then(() => {
if (this.viewRef) {
this.viewRef.growOut().then(() => {
this.jumpToChannel(channelIdState);
});
}
@ -398,7 +402,7 @@ export default class Permalink extends PureComponent {
style={[style.container, margin(isLandscape)]}
>
<Animatable.View
ref='view'
ref={this.setViewRef}
animation='zoomIn'
duration={200}
delay={0}

View file

@ -71,6 +71,10 @@ export default class PinnedPosts extends PureComponent {
}
}
setListRef = (ref) => {
this.listRef = ref;
}
goToThread = (post) => {
const {actions} = this.props;
const channelId = post.channel_id;
@ -209,7 +213,7 @@ export default class PinnedPosts extends PureComponent {
} else if (postIds.length) {
component = (
<FlatList
ref='list'
ref={this.setListRef}
contentContainerStyle={style.sectionList}
data={postIds}
keyExtractor={this.keyExtractor}

View file

@ -24,6 +24,7 @@ exports[`PostOptions should match snapshot, no option for system message to user
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -59,6 +60,7 @@ exports[`PostOptions should match snapshot, no option for system message to user
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -94,6 +96,7 @@ exports[`PostOptions should match snapshot, no option for system message to user
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -129,6 +132,7 @@ exports[`PostOptions should match snapshot, no option for system message to user
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -164,6 +168,7 @@ exports[`PostOptions should match snapshot, no option for system message to user
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -210,6 +215,7 @@ exports[`PostOptions should match snapshot, showing Delete option only for syste
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -245,6 +251,7 @@ exports[`PostOptions should match snapshot, showing Delete option only for syste
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -280,6 +287,7 @@ exports[`PostOptions should match snapshot, showing Delete option only for syste
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -315,6 +323,7 @@ exports[`PostOptions should match snapshot, showing Delete option only for syste
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -350,6 +359,7 @@ exports[`PostOptions should match snapshot, showing Delete option only for syste
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -385,6 +395,7 @@ exports[`PostOptions should match snapshot, showing Delete option only for syste
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -431,6 +442,7 @@ exports[`PostOptions should match snapshot, showing all possible options 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -466,6 +478,7 @@ exports[`PostOptions should match snapshot, showing all possible options 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -501,6 +514,7 @@ exports[`PostOptions should match snapshot, showing all possible options 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -536,6 +550,7 @@ exports[`PostOptions should match snapshot, showing all possible options 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -571,6 +586,7 @@ exports[`PostOptions should match snapshot, showing all possible options 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -606,6 +622,7 @@ exports[`PostOptions should match snapshot, showing all possible options 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",

View file

@ -11,12 +11,6 @@ import PostOptions from './post_options';
jest.mock('react-intl');
jest.mock('Alert', () => {
return {
alert: jest.fn(),
};
});
describe('PostOptions', () => {
const actions = {
addReaction: jest.fn(),

View file

@ -35,6 +35,7 @@ exports[`ReactionHeader should match snapshot 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -69,6 +70,7 @@ exports[`ReactionHeader should match snapshot 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -110,6 +112,7 @@ Array [
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -144,6 +147,7 @@ Array [
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",

View file

@ -24,6 +24,7 @@ exports[`ReactionList should match snapshot 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -64,6 +65,7 @@ exports[`ReactionList should match snapshot 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -119,6 +121,7 @@ exports[`ReactionList should match snapshot 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -180,6 +183,7 @@ Array [
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -235,6 +239,7 @@ Array [
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",

View file

@ -23,6 +23,7 @@ exports[`RecentMentions should match snapshot 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",

View file

@ -66,6 +66,10 @@ export default class RecentMentions extends PureComponent {
this.navigationEventListener = Navigation.events().bindComponent(this);
}
setListRef = (ref) => {
this.listRef = ref;
}
goToThread = (post) => {
const {actions} = this.props;
const channelId = post.channel_id;
@ -210,7 +214,7 @@ export default class RecentMentions extends PureComponent {
} else if (postIds.length) {
component = (
<FlatList
ref='list'
ref={this.setListRef}
contentContainerStyle={style.sectionList}
data={postIds}
keyExtractor={this.keyExtractor}

View file

@ -109,8 +109,8 @@ export default class Search extends PureComponent {
}
setTimeout(() => {
if (this.refs.searchBar && !this.props.initialValue) {
this.refs.searchBar.focus();
if (this.searchBarRef && !this.props.initialValue) {
this.searchBarRef.focus();
}
}, 150);
}
@ -124,7 +124,7 @@ export default class Search extends PureComponent {
!this.props.isSearchGettingMore && !prevProps.isSearchGettingMore && prevState.recent.length === recent.length;
if (this.props.isLandscape !== prevProps.isLandscape) {
this.refs.searchBar.blur();
this.searchBarRef.blur();
}
if (shouldScroll) {
@ -137,8 +137,8 @@ export default class Search extends PureComponent {
const offset = modifiersHeight + modifiersSeparatorHeight + SECTION_HEIGHT + recentLabelsHeight + recentSeparatorsHeight;
Keyboard.dismiss();
if (this.refs.list) {
this.refs.list._wrapperListRef.getListRef().scrollToOffset({ //eslint-disable-line no-underscore-dangle
if (this.listRef?._wrapperListRef) {
this.listRef._wrapperListRef.getListRef().scrollToOffset({ //eslint-disable-line no-underscore-dangle
animated: true,
offset,
});
@ -149,14 +149,22 @@ export default class Search extends PureComponent {
navigationButtonPressed({buttonId}) {
if (buttonId === 'backPress') {
if (this.state.preview) {
this.refs.preview.handleClose();
if (this.state.preview && this.previewRef) {
this.previewRef.handleClose();
} else {
dismissModal();
}
}
}
setSearchBarRef = (ref) => {
this.searchBarRef = ref;
}
setListRef = (ref) => {
this.listRef = ref;
}
archivedIndicator = (postID, style) => {
const channelIsArchived = this.props.archivedPostIds.includes(postID);
let archivedIndicator = null;
@ -467,8 +475,8 @@ export default class Search extends PureComponent {
};
scrollToTop = () => {
if (this.refs.list) {
this.refs.list._wrapperListRef.getListRef().scrollToOffset({ //eslint-disable-line no-underscore-dangle
if (this.listRef?._wrapperListRef) {
this.listRef._wrapperListRef.getListRef().scrollToOffset({ //eslint-disable-line no-underscore-dangle
animated: false,
offset: 0,
});
@ -523,8 +531,8 @@ export default class Search extends PureComponent {
this.handleTextChanged(newValue, true);
if (this.refs.searchBar) {
this.refs.searchBar.focus();
if (this.searchBarRef) {
this.searchBarRef.focus();
}
});
@ -692,7 +700,7 @@ export default class Search extends PureComponent {
<StatusBar/>
<View style={[style.header, padding(isLandscape)]}>
<SearchBar
ref='searchBar'
ref={this.setSearchBarRef}
placeholder={intl.formatMessage({id: 'search_bar.search', defaultMessage: 'Search'})}
cancelTitle={intl.formatMessage({id: 'mobile.post.cancel', defaultMessage: 'Cancel'})}
backgroundColor='transparent'
@ -715,7 +723,7 @@ export default class Search extends PureComponent {
/>
</View>
<SectionList
ref='list'
ref={this.setListRef}
style={style.sectionList}
renderSectionHeader={this.renderSectionHeader}
sections={sections}

View file

@ -18,6 +18,7 @@ exports[`SelectTeam should match snapshot for fail of teams 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -119,6 +120,7 @@ exports[`SelectTeam should match snapshot for teams 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",

View file

@ -74,6 +74,7 @@ exports[`SelectorScreen should match snapshot for channels 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -169,6 +170,7 @@ exports[`SelectorScreen should match snapshot for channels 2`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -271,6 +273,7 @@ exports[`SelectorScreen should match snapshot for explicit options 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -366,6 +369,7 @@ exports[`SelectorScreen should match snapshot for searching 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -461,6 +465,7 @@ exports[`SelectorScreen should match snapshot for users 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -556,6 +561,7 @@ exports[`SelectorScreen should match snapshot for users 2`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",

View file

@ -96,6 +96,10 @@ export default class SelectorScreen extends PureComponent {
}
}
setSearchBarRef = (ref) => {
this.searchBarRef = ref;
}
clearSearch = () => {
this.setState({term: '', searchResults: []});
};
@ -327,7 +331,7 @@ export default class SelectorScreen extends PureComponent {
<StatusBar/>
<View style={[style.searchBar, padding(isLandscape)]}>
<SearchBar
ref='search_bar'
ref={this.setSearchBarRef}
placeholder={formatMessage({id: 'search_bar.search', defaultMessage: 'Search'})}
cancelTitle={formatMessage({id: 'mobile.post.cancel', defaultMessage: 'Cancel'})}
backgroundColor='transparent'

View file

@ -12,7 +12,7 @@ import {
Text,
View,
} from 'react-native';
import {Sentry} from 'react-native-sentry';
import * as Sentry from '@sentry/react-native';
import {getFormattedFileSize} from 'mattermost-redux/utils/file_utils';

View file

@ -48,6 +48,7 @@ exports[`DisplaySettings should match snapshot 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -126,6 +127,7 @@ exports[`DisplaySettings should match snapshot on Tablet devices 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -165,6 +167,7 @@ exports[`DisplaySettings should match snapshot on Tablet devices 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",

View file

@ -27,6 +27,7 @@ exports[`NotificationSettingsEmailAndroid should match snapshot 1`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",

View file

@ -24,6 +24,7 @@ exports[`NotificationSettingsEmailIos should match snapshot, renderEmailSection
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -66,6 +67,7 @@ exports[`NotificationSettingsEmailIos should match snapshot, renderEmailSection
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -117,6 +119,7 @@ exports[`NotificationSettingsEmailIos should match snapshot, renderEmailSection
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",

View file

@ -11,12 +11,6 @@ import RadioButtonGroup from 'app/components/radio_button';
import NotificationSettingsEmailAndroid from './notification_settings_email.android.js';
jest.mock('Platform', () => {
const Platform = require.requireActual('Platform');
Platform.OS = 'android';
return Platform;
});
describe('NotificationSettingsEmailAndroid', () => {
const baseProps = {
currentUser: {id: 'current_user_id'},
@ -155,6 +149,7 @@ describe('NotificationSettingsEmailAndroid', () => {
const instance = wrapper.instance();
instance.saveEmailNotifyProps = jest.fn();
instance.getPlatformOS = jest.fn(() => 'android');
// Back button on Android should close the modal and trigger
// componentDidDisappear.

View file

@ -10,12 +10,6 @@ import SectionItem from 'app/screens/settings/section_item';
import NotificationSettingsEmailIos from './notification_settings_email.ios.js';
jest.mock('Platform', () => {
const Platform = require.requireActual('Platform');
Platform.OS = 'ios';
return Platform;
});
jest.mock('app/utils/theme', () => {
const original = require.requireActual('app/utils/theme');
return {

View file

@ -74,11 +74,15 @@ export default class NotificationSettingsEmailBase extends PureComponent {
}
componentDidDisappear() {
if (Platform.OS === 'ios') {
if (this.getPlatformOS() === 'ios') {
this.saveEmailNotifyProps();
}
}
getPlatformOS = () => {
return Platform.OS;
}
setEmailInterval = (value) => {
this.setState({newInterval: value});
};

View file

@ -47,6 +47,7 @@ NotificationSettingsMentionsKeywords {
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -85,6 +86,7 @@ NotificationSettingsMentionsKeywords {
"useMemo": [Function],
"useReducer": [Function],
"useRef": [Function],
"useResponder": [Function],
"useState": [Function],
},
"_element": <NotificationSettingsMentionsKeywords
@ -130,6 +132,7 @@ NotificationSettingsMentionsKeywords {
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",

View file

@ -35,6 +35,7 @@ exports[`SidebarSettings should match, full snapshot 2`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",
@ -89,6 +90,7 @@ exports[`SidebarSettings should match, full snapshot 2`] = `
"dndIndicator": "#f74343",
"errorTextColor": "#fd5960",
"linkColor": "#2389d7",
"mentionBg": "#ffffff",
"mentionBj": "#ffffff",
"mentionColor": "#145dbf",
"mentionHighlightBg": "#ffe577",

Some files were not shown because too many files have changed in this diff Show more