Skip to content

Commit

Permalink
deps: Upgrade to react-navigation v3.
Browse files Browse the repository at this point in the history
In this commit:

- Update react-navigation and its libdef, handle breaking changes in
  code

- Update react-navigation-redux-helpers to keep compatibility;
  handle breaking changes and let it wrap AppNavigator in its
  preferred way

- Add react-navigation-stack and react-navigation-drawer to prepare
  for the requirement in v4 that we depend on these directly. Match
  the versions of these (and that of react-navigation-tabs, which
  we're already depending on) to the versions react-navigation v3
  has for these in its `dependencies` in its `package.json`. Grab a
  compatible libdef for react-navigation-stack.

- Add @react-navigation/core, @react-navigation/native, and
  react-native-gesture-handler to satisfy peer dependencies. Follow
  instructions for some additional setup for
  react-native-gesture-handler in Jest config and `MainActivity.kt`.

- Add a note about a console error that we're getting, which will go
  away in react-navigation v4. It doesn't seem to break any
  functionality.

Also, run `yarn yarn-deduplicate && yarn` as prompted by
`tools/test deps`.

See more detail on GitHub at
zulip#4249 (comment).

Fixes: zulip#3649
  • Loading branch information
chrisbobbe committed Sep 11, 2020
1 parent b8fa279 commit 4dd91a2
Show file tree
Hide file tree
Showing 12 changed files with 1,413 additions and 338 deletions.
6 changes: 5 additions & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ node_modules/warning/.*

.*/node_modules/react-native-notifications/.*
.*/node_modules/react-native-tab-view/.*
.*/node_modules/react-navigation-redux-helpers/.*

# Some mistakes in these types got fixed in v2.4.1 of this library,
# but we can't use that until we're on react-navigation v4 (#4248).
.*/node_modules/react-navigation-tabs/.*

.*/node_modules/react-native-safe-area/.*
.*/node_modules/flow-coverage-report/.*
.*/node_modules/@snyk/.*
Expand Down
11 changes: 11 additions & 0 deletions android/app/src/main/java/com/zulipmobile/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ import android.os.Bundle
import android.util.Log
import android.webkit.WebView
import com.facebook.react.ReactActivity
import com.facebook.react.ReactActivityDelegate;
import com.facebook.react.ReactRootView;
import com.facebook.react.ReactApplication
import com.facebook.react.bridge.Arguments
import com.facebook.react.bridge.WritableMap
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
import com.zulipmobile.notifications.*
import com.zulipmobile.sharing.SharingModule

Expand All @@ -23,6 +26,14 @@ open class MainActivity : ReactActivity() {
return "ZulipMobile"
}

override fun createReactActivityDelegate(): ReactActivityDelegate {
return object : ReactActivityDelegate(this, mainComponentName) {
override fun createRootView(): ReactRootView {
return RNGestureHandlerEnabledRootView(this@MainActivity)
}
}
}

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
WebView.setWebContentsDebuggingEnabled(true)
Expand Down
Loading

0 comments on commit 4dd91a2

Please sign in to comment.