diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 9ab4c7c5c22..6b1aa4b0540 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1141,14 +1141,14 @@ PODS: - React-Core - ReactNativeKeyboardTrackingView (5.7.0): - React - - ReactNativeNavigation (7.39.1): + - ReactNativeNavigation (7.40.0): - HMSegmentedControl - React-Core - React-CoreModules - React-RCTImage - React-RCTText - - ReactNativeNavigation/Core (= 7.39.1) - - ReactNativeNavigation/Core (7.39.1): + - ReactNativeNavigation/Core (= 7.40.0) + - ReactNativeNavigation/Core (7.40.0): - HMSegmentedControl - React-Core - React-CoreModules @@ -1614,7 +1614,7 @@ SPEC CHECKSUMS: ReactNativeExceptionHandler: b11ff67c78802b2f62eed0e10e75cb1ef7947c60 ReactNativeIncallManager: bfc9c67358cd524882a7c4116dcb311ac2293d4b ReactNativeKeyboardTrackingView: 02137fac3b2ebd330d74fa54ead48b14750a2306 - ReactNativeNavigation: 86a23855d2ccc74ad3e59bff1595c2d4b76ed8cc + ReactNativeNavigation: e62ba14d9cd44774dca6068b6559ec872e0e61a6 RNCClipboard: 60fed4b71560d7bfe40e9d35dea9762b024da86d RNDateTimePicker: 08f00a2c341bf96e4b30da15799fbdd4c5fa48a3 RNDeviceInfo: 4f9c7cfd6b9db1b05eb919620a001cf35b536423 diff --git a/package-lock.json b/package-lock.json index 24d0ae15c9a..a89cefc0413 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,7 @@ "packages": { "": { "name": "mattermost-mobile", - "version": "2.17.0", + "version": "2.18.0", "hasInstallScript": true, "license": "Apache 2.0", "dependencies": { @@ -77,7 +77,7 @@ "react-native-linear-gradient": "2.8.3", "react-native-localize": "3.1.0", "react-native-math-view": "3.9.5", - "react-native-navigation": "7.39.1", + "react-native-navigation": "7.40.0", "react-native-notifications": "5.1.0", "react-native-performance": "5.1.2", "react-native-permissions": "4.1.5", @@ -17221,9 +17221,9 @@ } }, "node_modules/react-native-navigation": { - "version": "7.39.1", - "resolved": "https://registry.npmjs.org/react-native-navigation/-/react-native-navigation-7.39.1.tgz", - "integrity": "sha512-VpJjrgoyolldUiUnR5zUzWamiSBlX0mv23kJAiSrwErfuVAXer7xxrF6B3o8eutx5B/DJ8SWOENGJfgmZ4rAbw==", + "version": "7.40.0", + "resolved": "https://registry.npmjs.org/react-native-navigation/-/react-native-navigation-7.40.0.tgz", + "integrity": "sha512-ZOtRCEEMtN+LfLuUrOmow/M2u3TeL0sXYJZdTM5pjk32cr6XHRusxQrzGCdl/GvMLHcBMGk41K2VhHvSYb+oFg==", "dependencies": { "hoist-non-react-statics": "3.x.x", "lodash": "4.17.x", diff --git a/package.json b/package.json index c62379314fd..553db9e8c53 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,7 @@ "react-native-linear-gradient": "2.8.3", "react-native-localize": "3.1.0", "react-native-math-view": "3.9.5", - "react-native-navigation": "7.39.1", + "react-native-navigation": "7.40.0", "react-native-notifications": "5.1.0", "react-native-performance": "5.1.2", "react-native-permissions": "4.1.5", diff --git a/patches/react-native-navigation+7.39.1.patch b/patches/react-native-navigation+7.40.0.patch similarity index 50% rename from patches/react-native-navigation+7.39.1.patch rename to patches/react-native-navigation+7.40.0.patch index 84d703ce387..9d32075b3cf 100644 --- a/patches/react-native-navigation+7.39.1.patch +++ b/patches/react-native-navigation+7.40.0.patch @@ -74,10 +74,25 @@ index 481aaf0..609e359 100644 mPermissionListener = listener; requestPermissions(permissions, requestCode); diff --git a/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationModule.java b/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationModule.java -index 4cc09eb..2c46d59 100644 +index 4cc09eb..857bbd4 100644 --- a/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationModule.java +++ b/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationModule.java -@@ -66,15 +66,22 @@ public class NavigationModule extends ReactContextBaseJavaModule { +@@ -31,6 +31,7 @@ import com.reactnativenavigation.viewcontrollers.viewcontroller.ViewController; + + import java.util.ArrayList; + import java.util.Objects; ++import java.util.Optional; + + import static com.reactnativenavigation.utils.UiUtils.pxToDp; + +@@ -60,21 +61,28 @@ public class NavigationModule extends ReactContextBaseJavaModule { + public void onHostPause() { + super.onHostPause(); + UiUtils.runOnMainThread(() -> { +- if (activity() != null) navigator().onHostPause(); ++ if (activity() != null) navigator().ifPresent(Navigator::onHostPause); + }); + } @Override public void onHostResume() { @@ -92,16 +107,16 @@ index 4cc09eb..2c46d59 100644 - UiUtils.runOnMainThread(() -> navigator().onHostResume()); + try { + eventEmitter = new EventEmitter(reactContext); -+ Navigator navigator = navigator(); -+ if (navigator != null) { -+ navigator().setEventEmitter(eventEmitter); ++ if (navigator().isPresent()) { ++ Navigator navigator = navigator().get(); ++ navigator.setEventEmitter(eventEmitter); + layoutFactory.init( + activity(), + eventEmitter, -+ navigator().getChildRegistry(), ++ navigator.getChildRegistry(), + ((NavigationApplication) activity().getApplication()).getExternalComponents() + ); -+ UiUtils.runOnMainThread(() -> navigator().onHostResume()); ++ UiUtils.runOnMainThread(navigator::onHostResume); + } + } catch (ClassCastException e) { + // The most current activity is not a NavigationActivity @@ -109,19 +124,126 @@ index 4cc09eb..2c46d59 100644 } }); } -@@ -212,7 +219,10 @@ public class NavigationModule extends ReactContextBaseJavaModule { +@@ -116,7 +124,7 @@ public class NavigationModule extends ReactContextBaseJavaModule { + final LayoutNode layoutTree = LayoutNodeParser.parse(Objects.requireNonNull(jsonParser.parse(rawLayoutTree).optJSONObject("root"))); + handle(() -> { + final ViewController viewController = layoutFactory.create(layoutTree); +- navigator().setRoot(viewController, new NativeCommandListener("setRoot", commandId, promise, eventEmitter, now), reactInstanceManager); ++ navigator().ifPresent(nav -> nav.setRoot(viewController, new NativeCommandListener("setRoot", commandId, promise, eventEmitter, now), reactInstanceManager)); + }); + } + +@@ -125,13 +133,13 @@ public class NavigationModule extends ReactContextBaseJavaModule { + handle(() -> { + Options defaultOptions = parse(options); + layoutFactory.setDefaultOptions(defaultOptions); +- navigator().setDefaultOptions(defaultOptions); ++ navigator().ifPresent(nav -> nav.setDefaultOptions(defaultOptions)); + }); + } + + @ReactMethod + public void mergeOptions(String onComponentId, @Nullable ReadableMap options) { +- handle(() -> navigator().mergeOptions(onComponentId, parse(options))); ++ handle(() -> navigator().ifPresent(nav -> nav.mergeOptions(onComponentId, parse(options)))); + } + + @ReactMethod +@@ -139,7 +147,7 @@ public class NavigationModule extends ReactContextBaseJavaModule { + final LayoutNode layoutTree = LayoutNodeParser.parse(jsonParser.parse(rawLayoutTree)); + handle(() -> { + final ViewController viewController = layoutFactory.create(layoutTree); +- navigator().push(onComponentId, viewController, new NativeCommandListener("push", commandId, promise, eventEmitter, now)); ++ navigator().ifPresent(nav -> nav.push(onComponentId, viewController, new NativeCommandListener("push", commandId, promise, eventEmitter, now))); + }); + } + +@@ -151,23 +159,23 @@ public class NavigationModule extends ReactContextBaseJavaModule { + final LayoutNode layoutTree = LayoutNodeParser.parse(jsonParser.parse(children.getMap(i))); + _children.add(layoutFactory.create(layoutTree)); + } +- navigator().setStackRoot(onComponentId, _children, new NativeCommandListener("setStackRoot", commandId, promise, eventEmitter, now)); ++ navigator().ifPresent(nav -> nav.setStackRoot(onComponentId, _children, new NativeCommandListener("setStackRoot", commandId, promise, eventEmitter, now))); + }); + } + + @ReactMethod + public void pop(String commandId, String componentId, @Nullable ReadableMap mergeOptions, Promise promise) { +- handle(() -> navigator().pop(componentId, parse(mergeOptions), new NativeCommandListener("pop", commandId, promise, eventEmitter, now))); ++ handle(() -> navigator().ifPresent(nav -> nav.pop(componentId, parse(mergeOptions), new NativeCommandListener("pop", commandId, promise, eventEmitter, now)))); + } + + @ReactMethod + public void popTo(String commandId, String componentId, @Nullable ReadableMap mergeOptions, Promise promise) { +- handle(() -> navigator().popTo(componentId, parse(mergeOptions), new NativeCommandListener("popTo", commandId, promise, eventEmitter, now))); ++ handle(() -> navigator().ifPresent(nav -> nav.popTo(componentId, parse(mergeOptions), new NativeCommandListener("popTo", commandId, promise, eventEmitter, now)))); + } + + @ReactMethod + public void popToRoot(String commandId, String componentId, @Nullable ReadableMap mergeOptions, Promise promise) { +- handle(() -> navigator().popToRoot(componentId, parse(mergeOptions), new NativeCommandListener("popToRoot", commandId, promise, eventEmitter, now))); ++ handle(() -> navigator().ifPresent(nav -> nav.popToRoot(componentId, parse(mergeOptions), new NativeCommandListener("popToRoot", commandId, promise, eventEmitter, now)))); } - private Navigator navigator() { + @ReactMethod +@@ -175,21 +183,21 @@ public class NavigationModule extends ReactContextBaseJavaModule { + final LayoutNode layoutTree = LayoutNodeParser.parse(jsonParser.parse(rawLayoutTree)); + handle(() -> { + final ViewController viewController = layoutFactory.create(layoutTree); +- navigator().showModal(viewController, new NativeCommandListener("showModal", commandId, promise, eventEmitter, now)); ++ navigator().ifPresent(nav -> nav.showModal(viewController, new NativeCommandListener("showModal", commandId, promise, eventEmitter, now))); + }); + } + + @ReactMethod + public void dismissModal(String commandId, String componentId, @Nullable ReadableMap mergeOptions, Promise promise) { + handle(() -> { +- navigator().mergeOptions(componentId, parse(mergeOptions)); +- navigator().dismissModal(componentId, new NativeCommandListener("dismissModal", commandId, promise, eventEmitter, now)); ++ navigator().ifPresent(nav -> nav.mergeOptions(componentId, parse(mergeOptions))); ++ navigator().ifPresent(nav -> nav.dismissModal(componentId, new NativeCommandListener("dismissModal", commandId, promise, eventEmitter, now))); + }); + } + + @ReactMethod + public void dismissAllModals(String commandId, @Nullable ReadableMap mergeOptions, Promise promise) { +- handle(() -> navigator().dismissAllModals(parse(mergeOptions), new NativeCommandListener("dismissAllModals", commandId, promise, eventEmitter, now))); ++ handle(() -> navigator().ifPresent(nav -> nav.dismissAllModals(parse(mergeOptions), new NativeCommandListener("dismissAllModals", commandId, promise, eventEmitter, now)))); + } + + @ReactMethod +@@ -197,22 +205,25 @@ public class NavigationModule extends ReactContextBaseJavaModule { + final LayoutNode layoutTree = LayoutNodeParser.parse(jsonParser.parse(rawLayoutTree)); + handle(() -> { + final ViewController viewController = layoutFactory.create(layoutTree); +- navigator().showOverlay(viewController, new NativeCommandListener("showOverlay", commandId, promise, eventEmitter, now)); ++ navigator().ifPresent(nav -> nav.showOverlay(viewController, new NativeCommandListener("showOverlay", commandId, promise, eventEmitter, now))); + }); + } + + @ReactMethod + public void dismissOverlay(String commandId, String componentId, Promise promise) { +- handle(() -> navigator().dismissOverlay(componentId, new NativeCommandListener("dismissOverlay", commandId, promise, eventEmitter, now))); ++ handle(() -> navigator().ifPresent(nav -> nav.dismissOverlay(componentId, new NativeCommandListener("dismissOverlay", commandId, promise, eventEmitter, now)))); + } + + @ReactMethod + public void dismissAllOverlays(String commandId, Promise promise) { +- handle(() -> navigator().dismissAllOverlays(new NativeCommandListener("dismissAllOverlays", commandId, promise, eventEmitter, now))); ++ handle(() -> navigator().ifPresent(nav -> nav.dismissAllOverlays(new NativeCommandListener("dismissAllOverlays", commandId, promise, eventEmitter, now)))); + } + +- private Navigator navigator() { - return activity().getNavigator(); ++ private Optional navigator() { + if (activity() instanceof NavigationActivity) { -+ return ((NavigationActivity)activity()).getNavigator(); ++ return Optional.ofNullable(((NavigationActivity)activity()).getNavigator()); + } -+ return null; ++ return Optional.empty(); } private Options parse(@Nullable ReadableMap mergeOptions) { -@@ -223,19 +233,23 @@ public class NavigationModule extends ReactContextBaseJavaModule { +@@ -223,22 +234,26 @@ public class NavigationModule extends ReactContextBaseJavaModule { protected void handle(Runnable task) { UiThread.post(() -> { @@ -144,12 +266,36 @@ index 4cc09eb..2c46d59 100644 } @Override - public void onCatalystInstanceDestroy() { +- public void onCatalystInstanceDestroy() { - final NavigationActivity navigationActivity = activity(); ++ public void invalidate() { + final NavigationActivity navigationActivity = (NavigationActivity)activity(); if (navigationActivity != null) { navigationActivity.onCatalystInstanceDestroy(); } +- super.onCatalystInstanceDestroy(); ++ super.invalidate(); + } + } +diff --git a/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/utils/ReactTypefaceUtils.java b/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/utils/ReactTypefaceUtils.java +index 834d734..3fc00c3 100644 +--- a/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/utils/ReactTypefaceUtils.java ++++ b/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/utils/ReactTypefaceUtils.java +@@ -96,12 +96,12 @@ public class ReactTypefaceUtils { + + int want = 0; + if ((weight == Typeface.BOLD) +- || ((oldStyle & Typeface.BOLD) != 0 && weight == ReactTextShadowNode.UNSET)) { ++ || ((oldStyle & Typeface.BOLD) != 0 && weight == -1)) { + want |= Typeface.BOLD; + } + + if ((style == Typeface.ITALIC) +- || ((oldStyle & Typeface.ITALIC) != 0 && style == ReactTextShadowNode.UNSET)) { ++ || ((oldStyle & Typeface.ITALIC) != 0 && style == -1)) { + want |= Typeface.ITALIC; + } + diff --git a/node_modules/react-native-navigation/lib/android/app/src/reactNative71/java/com/reactnativenavigation/react/ReactGateway.java b/node_modules/react-native-navigation/lib/android/app/src/reactNative71/java/com/reactnativenavigation/react/ReactGateway.java index 035ec31..630b8d4 100644 --- a/node_modules/react-native-navigation/lib/android/app/src/reactNative71/java/com/reactnativenavigation/react/ReactGateway.java