react-native-navigation的迁移库

Changelog

6.1.1

Fixed

iOS

6.1.0

Added

Fixed

iOS

Android

6.0.1

Fixed

iOS

6.0.0

This release changes how layout.backgroundColor work on iOS to add parity with Android.

  • layout.backgroundColor - applies background color to parent layouts (Stack, BottomTabs, SideMenu etc)
  • layout.componentBackgroundColor - applies background color only to components

Fixed

Android

  • Fix custom push animations not working #c9232cb by guyca

    iOS

  • Remove draw behind deprecation #950642d by yogevbd

  • Fix layout.backgroundColor being applied to components, it’s now applied to parent layouts #950642d by yogevbd

  • Implement layout.componentBackgroundColor which is applied only to component ViewControllers #950642d by yogevbd

5.1.1

Fixed

iOS

  • Apply extendedLayoutIncludesOpaqueBars true on all viewControllers (this commit was originally added to v4 and was left out of v5 my mistake) #9fefeca

    Android

  • Fix crash when mergeOptions were called before stack view was created #defc2aa by guyca

5.1.0

Added

iOS

5.0.0

This release is focuses on shared element transition and on improving the installation process of the library.

Upgrading from V4

Remove missingDimensionStrategy from app/build.gradle

Since RNN supports multiple react-native versions, the library has multiple flavors, each targeting a different RN version. We now chose the appropriate flavor based on the react-native version installed in node_modules.

-missingDimensionStrategy "RNN.reactNativeVersion", "reactNativeXX" // Where XX is the minor number of the react-native version you're using

Declare Kotlin version in build.gradle

We’re starting to migrate RNN to Kotlin. All new code is written in Kotlin and existing code will be gradually converted to Kotlin. This requires you to declare the Kotlin version you’re using in your project.

buildscript {
    ext {
+        kotlinVersion = "1.3.61" // Or any other kotlin version following 1.3.x
+        RNNKotlinVersion = kotlinVersion
+        RNNKotlinStdlib = "kotlin-stdlib-jdk8"
    }
    dependencies {
+        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"    
    }
}

Update MainApplication.java

In an effort to simplify RNN’s integrations process as much as possible, we’re minimizing the changes required to both MainApplication and MainActivity.

+import com.facebook.react.PackageList;

public class MainApplication extends NavigationApplication {
-    @Override
-    protected ReactNativeHost createReactNativeHost() {
-    return new NavigationReactNativeHost(this) {  
+    private final ReactNativeHost mReactNativeHost =
            new NavigationReactNativeHost(this) {
                @Override
                protected String getJSMainModuleName() {
                    return "index";
                }

+                @Override
+                public boolean getUseDeveloperSupport() {
+                    return BuildConfig.DEBUG;
+                }

+                @Override
+                public List<ReactPackage> getPackages() {
+                    ArrayList<ReactPackage> packages = new PackageList(this).getPackages();
+                    return packages;
+                }
+            }
-    }

+    @Override
+    public ReactNativeHost getReactNativeHost() {
+        return mReactNativeHost;
+    }

-    @Override
-    public boolean isDebug() {
-        return BuildConfig.DEBUG;
-    }

-    @Nullable
-    @Override
-    public List<ReactPackage> createAdditionalReactPackages() {
-        List<ReactPackage> packages = new ArrayList<>();
-        return packages;
-    }
}

Update settings.gradle

Since RNN now supports auto linking, declaring the dependency manually is no longer needed.

-include ':react-native-navigation'
-project(':react-native-navigation').projectDir = new File(rootProject.projectDir, '../../lib/android/app/')

Make sure your app supports auto linking

Update app/build.gradle

Add these lines to the bottom of your app/build.gradle file.

+apply from: file("../../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle")
+applyNativeModulesAppBuildGradle(project)

Update settings.gradle

+apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle")
+applyNativeModulesSettingsGradle(settings)
include ':app'

Remove RNN pod from podspec

As RNN is now autolinked, remove its pod from your podspec file. This will ensure the correct version is linked when running pod install

- pod 'ReactNativeNavigation', :podspec => '../node_modules/react-native-navigation/ReactNativeNavigation.podspec'

Breaking Changes

Modal animation parity

show and dismiss animation api have been fixed and are now in parity with Android api. If you’ve defined a custom modal animation, you can now consolidate the animation declarations.

New Android + iOS API Unsupported iOS API
```js options: { animations: { showModal: { alpha: { from: 0, to: 1, duration: 250, } } } } ``` ```js options: { animations: { showModal: { content: { alpha: { from: 0, to: 1, duration: 250 } } } } } ```

drawBehind is deprecated on iOS

❗️topBar and bottomTabs drawBehind option will be removed in the next major version.

The drawBehind option has been an anti pattern on iOS from the start and was introduced only for parity with Android api. On iOS, when a ScrollView or a SafeAreaView are used as screen root; the system handles insets automatically. As adoption of notch devices increases, developers use these views regularly, rendering the drawBehind option useless.

During the migration phase, leave Android options unchanged and set drawBehind: true to both TopBar and BottomTabs in default options.

Android: Animation values are now declared in dp

If you’re animating translationY or translationX pass these values in dp instead of pixels. This is especially relevant to values returned by await Navigation.constants() api as these values are returned in dp. Now, if you’d like to use them in animations, you can do so without converting to pixels.

4.8.1

Fixed

Android

4.8.0

Fixed

Android

  • Support react-native-youtube #ffbd288 by guyca

    iOS

  • Fix wrong SafeAreaView margins when using bottomTabs.drawBehind: true #527fd49 by yogevbd

4.7.1

Fixed

4.7.0

Added

4.6.0

Added

Android

  • Adapt NavigationBar buttons color according to NavigationBar background color #6521177 by rverbytskyi

Fixed

Android

  • Disable TopBar scroll when nestedScrollEnabled is enabled #9a361a4 by guyca
  • Reject promise when trying to push two children with same id #27ceea8 by guyca
  • Fix drawBehind in default options not working #0e93366 by guyca

iOS

4.5.4

4.5.2 - 4.5.3

Fixed

Android

  • Fix NPE when updating tabs before tab views are created #fccfb4d by guyca

4.5.1

Fixed

iOS

4.5.0

Added

4.4.0

Added

Android

  • Added TitleState showWhenActiveForce option for bottomTabs #cf18e2d by BenJeau

Fixed

Android

  • Apply BottomTabs visibility only if child is visible #6ffb301 by guyca

Fixed

4.3.0

Fixed

iOS

  • Fixed pushing external ViewControllers to stack inside a modal #4b14c87 by yogevbd

4.2.0

Fixed

Android

  • Support hiding back button with mergeOptions #3f17dc4 by guyca

    4.1.0

    Added

  • Send componentType field in componentDidAppear and componentDidDisappear events #3878b68 by guyca and yogevbd

    Fixed

  • Add typing for children on TopTabs #1f611c6 by aalises

    Android

  • Apply translucent StatusBAr flag only if needed #6782362 by guyca

    iOS

  • Fix topBar.title.component measurement on iOS 10 #82e4807 by yogevbd

  • Remove yellow boxes from title and button components #b82d87f by yogevbd

4.0.9

Fixed

iOS

Fixed

Android

  • Fix incorrect bottom inset when hiding BottomTabs in default options #d0c21e4 by guyca

    iOS

  • Fix topBar transparent background on iOS 12 #cd3d347 by yogevbd

4.0.6

Fixed

  • Fix native bottomTab.icon resource not working #aa1870a by guyca

iOS

4.0.5

Fixed

Android

4.0.4

Fixed

iOS

4.0.3

Added

iOS

Fixed

iOS

4.0.2

Fixed

iOS

4.0.1

Fixed

iOS

Android

4.0.0

Added

iOS

  • Support Xcode 11 - Xcode 10 is no longer supported
  • Support centering bottomTab icons using bottomTabs.titleDisplayMode #26d3d82 by yogevbd
  • Prevent creation of button react view with the same componentId #1807c5b by yogevbd

Fixed

iOS

Android

  • Automatically apply DrawBehind when tabs are hidden #002b7d8 by guyca
  • Fix button disabled color has no effect #b66ff1d by guyca
  • Fix BottomTabs background color changing to white background sometimes #57eb0db by guyca

3.7.0

Added

Android

3.6.0

Added

Fixed

Android

  • Include commandName in commandCompleted event #b904608 by jpgarcia
  • Fix crash when title component is destroyed right after being attached #39ee170 by guyca
  • Fix NPE when component appears under certain conditions #35851fc by heroic
  • Apply layout direction directly on TopBar buttons container #14b5221 by guyca

3.5.1

Fixed

iOS

  • Fix title component disappearing after mergeOptions #6d446a8 by guyca

3.5.0

Fixed

Android

3.4.0

Added

  • [stable] Introduce Navigation.updateProps command #0eb0570 by guyca

Android

Fixed

3.3.0

Added

Fixed

Android

3.2.0

Added

Android

Fixed

iOS

  • Fix applying merged backButton options #aef5b2e by guyca
  • Remove duplicate setDefaultOptions in UIViewController categories #0d31e30 by danilobuerger
  • Don’t consume SideMenu enabled option after applying it in mergeOptions #9faf458 by guyca
  • supportedInterfaceOrientations didn’t take default orientation value into account #9faf458 by guyca
  • SideMenu always returned the centre ViewController as the current child and didn’t take open SideMenu into account #9faf458 by guyca
  • Stop recursive double setting of default options #d5c92b1 by danilobuerger
  • Immediately unmount buttons removed by mergeOptions, instead of unmounting them when screen is unmounted #65dde34 by yogevbd

Android

3.1.2

Fixed

iOS

  • Fix replacing react title with text title not working #b434b4f by FRizzonelli
  • Fix merging TopBar title, buttons and status bar options, broke in 3.1.1 #5409a62 by guyca

3.1.1

Fixed

Android

  • Fix defaultOptions not being applied if called after setRoot #338b096 by guyca

    3.1.0

    Added

  • Support passing null color to StatusBar backgroundColor and bottom tab icon color #3519837 by guyca

Fixed

Android

3.0.0

Android

  • Support RN 0.60
  • Migrate to AndroidX
  • Improve draw behind StatusBar
    Added statusBar.translucent boolean property
  • BottomTabs are not pushed upwards when keyboard opens
  • Removed SyncUiImplementation SyncUiImplementation was used to overcome a bug in RN’s UiImplementation. This workaround was added to RN’s UiImplementation in RN 0.60 and can be removed from RNN.

If you’re using SyncUiImplementation your app will fail to compile after upgrading to v3. Simply remove the following code from your MainApplication.java

  - import com.facebook.react.uimanager.UIImplementationProvider;
  - import com.reactnativenavigation.react.SyncUiImplementation;


  - @override
  - protected UIImplementationProvider getUIImplementationProvider() {
  -     return new SyncUiImplementation.Provider();
  - }
  • BottomTab badge and dot indicator are not animated by default.

    • The following option will show a badge with animation

      bottomTab: {
      badge: 'new,
      animateBadge: true
      }
      
    • The following option will show a dot indicator with animation

      bottomTab: {
      dotIndicator: {
      visible: true,
      animate: true
      }
      }
      
  • Stack, BottomTabs and SideMenu are drawn behind StatusBar.
    While parent controllers are drawn behind the StatusBar, their background isn’t. This means that when transitioning from a destinations drawn under the StatusBar to a destination drawn behind it, the application’s default background color will be visible behind the StatusBar. If you application’s theme is dark, you might want to change the windowBackground property to mitigate this: Add the following to your application’s style.xml

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
      <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
          <item name="android:windowBackground">@color/backgroundColor</item>
      </style>
    
      <!--This is your application's default background color.
      It will be visible when the app is first opened (while the splash layout is visible)
      and when transitioning between a destination a screen drawn under the StatusBar to
      a destination drawn behind it-->
      <item name="backgroundColor" type="color">#f00</item>
    </resources>
    

    2.29.0

    Added

  • Introduce Navigation.updateProps command #0eb0570 by guyca

    Fixed

    iOS

  • Fix compilation error on Xcode 10.x #99ddcd8 and #83f03cd by yogevbd

    Android

  • Don’t merge null bottomTab.selectedIconColor and bottomTab.iconColor #c48ed74 by guyca

    2.28.0

    Added

  • Support updating component props with Navigation.mergeOptions #291f161 by justtal

    Android

  • Support bottomTab.selectedIcon #45e8389 by guyca

    2.27.7

    Added

    iOS

  • Font weight option support on iOS #f283e15 by yogevbd

2.27.6

Fixed

iOS

  • Fix status bar disappear when presenting native camera screen on iOS #6cfde5e by yogevbd

2.27.5

Fixed

iOS

2.27.4

Fixed

iOS

  • Immediately unmount buttons removed by mergeOptions, instead of unmounting them when screen is unmounted #65dde34 by yogevbd
  • Don’t consume SideMenu enabled option after applying it in mergeOptions #9faf458 by guyca
  • supportedInterfaceOrientations didn’t take default orientation value into account #9faf458 by guyca
  • SideMenu always returned the centre ViewController as the current child and didn’t take open SideMenu into account #9faf458 by guyca
  • Remove duplicate setDefaultOptions in UIViewController categories #452c4e6 by danilobuerger

2.27.3

Fixed

iOS

2.27.2

Fixed

iOS

  • Fix TopBar, title, buttons and StatusBar which broke in the previous release #8044b2d by guyca

2.27.1

Fixed

iOS

  • Fix defaultOptions not being applied if called after setRoot #338b096 by guyca

2.27.0

Added

  • Support passing null color to StatusBar backgroundColor and bottom tab icon color #3519837 by guyca

Fixed

Android

2.26.1

Fixed

iOS

2.26.0

Fixed

Android

  • Apply TopBar buttons only if they are different than current buttons #f15e9b3 by guyca

2.25.0

Fixed

Android

  • Ensure appLaunched event is emitted only when app is resumed #21584fd by guyca

2.24.0

Added

Fixed

Android

iOS

2.23.0

Added

Fixed

Android

iOS

2.22.3

Fixed

iOS

  • Fix Constants.topBarHeight being zero if root ViewController isn’t a NavigationViewController #f19e523 by guyca

2.22.2

Added

iOS

  • Support changing javascript bundle location in runtime #8959d68 by yogevbd

Fixed

iOS

2.22.1

Fixed

iOS

Android

2.21.1

Fixed

iOS

2.21.0

Added

Fixed

  • Safer check around component listener trigger #51d1b66 by dozoisch

    Android

  • Emit SideMenu visibility events #7ee9c12 by guyca

  • Fix setStackRoot crash when called with the same id #3c08b1c by guyca

  • Fix crashes related to race conditions around ViewController.destroy #f2e46ea by guyca

2.20.2

Fixed

iOS

2.20.1

Fixed

2.20.0

Fixed

  • Include PassProps in layout parameter of CommandListener #d3d01c2 by yogevbd

    Android

  • Fix TopBar background React component flicker when pushing screens #99032e0 by FRizzonelli

2.19.1

Fixed

Android

2.19.0

Added

Fixed

iOS

Android

  • Fixed buggy currentTabIndex when calling setRoot multiple times #cd182f4 by guyca

2.18.5

Fixed

iOS

  • Handle simultaneous recognizers, Fixes a crash when tapping on the screen with other gesture recognizers active #a5b9f58 by jordoh

2.18.4

Fixed

iOS

2.18.3

Fixed

iOS

2.18.2

Fixed

iOS

2.18.1

Fixed

iOS

2.18.0

Fixed

2.17.0

Fixed

iOS

Android

2.16.0

Fixed

iOS

2.15.0

Added

Fixed

iOS

  • Fix prevent retaining button component in componentRegistry #0186b1a by yogevbd
  • Fix and refactor animations options #a98f187 by yogevbd
  • Fix display empty custom topBar background over valid custom background #6cb1e18 by RoTTex

2.14.0

Fixed

Android

iOS

2.13.1

Fixed

2.13.0

Added

  • Add enabled? property to interface OptionsAnimationProperties #6065bd1 by taichi-jp

Fixed

iOS

Android

2.12.0

Added

Android

Fixed

iOS

2.11.0

Fixed

iOS

Android

2.10.0

Added

iOS

Fixed

iOS

Android

2.9.0

Fixed

iOS

Android

2.8.0

Added

  • passProps passed to setStackRoot and showOverlay can specify type with generics #bc23fba by henrikra
  • passProps passed to showModal can specify type with generics #34f37aa by ruscoder

Android

Fixed

iOS

2.7.1

Fixed

Android

  • Fix broken static options provided as objects #4d82292 by guyca

2.7.0

Added

Fixed

Android

2.6.0

Added

iOS

Fixed

Android

iOS

2.5.2

Fixed

Android

2.5.1

Fixed

Android

2.5.0

Fixed

Android

iOS

2.4.0

Added

Android

Fixed

Android

  • Fix closing sideMenu when pushing a screen #dc739de by guyca
  • Orientation.hasValue returns false for default orientation #43ae659 by guyca
  • Measure TopBar buttons using using MeasureSpec.UNSPECIFIED #dd93c51 by guyca

v2.3.0

Added

Android

  • Add layout.componentBackgroundColor option - This option is used to set background color only for component layouts. #cb48065 by guyca

Fixed

  • SetStackRoot now accepts an array of children which will replace the current children. #2365e02 by guyca

Android

v2.2.5

Added

Fixed

iOS

  • Fix setting bottomTabs.currentTabIndex on bottomTabs init #631e7db by yogevbd

v2.2.2 - v2.2.4

Skipped versions due to CI maintenance

v2.2.1

Fixed

iOS

  • Fix title.font when subtitle supplied - Font wasn’t applied on title, when subtitel was provided. #14a5b74 by yogevbd
  • Fix invisible modals edge case. When an Overlay was displayed before setRoot was called, Consecutive Modals and Overlays were attached to the wrong window. #b40f8ed by yogevbd

v2.2.0

Added

iOS

Fixed

iOS

  • popGesture on stack root freezes the app #4388 by yogevbd
  • setRoot on main application window - fix setRoot on iPad a3922f8 by yogevbd
  • Fix “Multiple commands produce…” build error on Xcode 10 #b5d300f by yogevbd

Android

2.1.3

Added

iOS

Fixed

  • Avoid calling component generators on registerComponent #708d594 by yogevbd