diff --git a/packages/react-navigation/examples/NavigationPlayground/yarn.lock b/packages/react-navigation/examples/NavigationPlayground/yarn.lock
index 5dafc489..d2fa3f4a 100644
--- a/packages/react-navigation/examples/NavigationPlayground/yarn.lock
+++ b/packages/react-navigation/examples/NavigationPlayground/yarn.lock
@@ -590,8 +590,8 @@
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d"
"@types/node@*":
- version "10.1.2"
- resolved "https://registry.yarnpkg.com/@types/node/-/node-10.1.2.tgz#1b928a0baa408fc8ae3ac012cc81375addc147c6"
+ version "10.3.1"
+ resolved "https://registry.yarnpkg.com/@types/node/-/node-10.3.1.tgz#51092fbacaed768a122a293814474fbf6e5e8b6d"
abab@^1.0.4:
version "1.0.4"
@@ -619,8 +619,8 @@ acorn-globals@^4.1.0:
acorn "^5.0.0"
acorn@^5.0.0, acorn@^5.3.0:
- version "5.5.3"
- resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.5.3.tgz#f473dd47e0277a08e28e9bec5aeeb04751f0b8c9"
+ version "5.6.2"
+ resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.6.2.tgz#b1da1d7be2ac1b4a327fb9eab851702c5045b4e7"
agent-base@4, agent-base@^4.1.0, agent-base@^4.2.0:
version "4.2.0"
@@ -855,8 +855,8 @@ assign-symbols@^1.0.0:
resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367"
ast-types@0.x.x:
- version "0.11.4"
- resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.11.4.tgz#76f930930e9571851ba282a9a0f6923f29f6be2f"
+ version "0.11.5"
+ resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.11.5.tgz#9890825d660c03c28339f315e9fa0a360e31ec28"
astral-regex@^1.0.0:
version "1.0.0"
@@ -1195,8 +1195,8 @@ babel-plugin-transform-class-properties@^6.18.0, babel-plugin-transform-class-pr
babel-template "^6.24.1"
babel-plugin-transform-decorators-legacy@^1.3.4:
- version "1.3.4"
- resolved "https://registry.yarnpkg.com/babel-plugin-transform-decorators-legacy/-/babel-plugin-transform-decorators-legacy-1.3.4.tgz#741b58f6c5bce9e6027e0882d9c994f04f366925"
+ version "1.3.5"
+ resolved "https://registry.yarnpkg.com/babel-plugin-transform-decorators-legacy/-/babel-plugin-transform-decorators-legacy-1.3.5.tgz#0e492dffa0edd70529072887f8aa86d4dd8b40a1"
dependencies:
babel-plugin-syntax-decorators "^6.1.18"
babel-runtime "^6.2.0"
@@ -1678,8 +1678,8 @@ bcrypt-pbkdf@^1.0.0:
tweetnacl "^0.14.3"
big-integer@^1.6.7:
- version "1.6.28"
- resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.28.tgz#8cef0fda3ccde8759c2c66efcfacc35aea658283"
+ version "1.6.30"
+ resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.30.tgz#7796f04acdd6ba56345f19049c8fffd427f09d16"
bluebird@^2.10.2:
version "2.11.0"
@@ -1773,28 +1773,28 @@ bser@^2.0.0:
dependencies:
node-int64 "^0.4.0"
-buffer-alloc-unsafe@^0.1.0:
- version "0.1.1"
- resolved "https://registry.yarnpkg.com/buffer-alloc-unsafe/-/buffer-alloc-unsafe-0.1.1.tgz#ffe1f67551dd055737de253337bfe853dfab1a6a"
+buffer-alloc-unsafe@^1.1.0:
+ version "1.1.0"
+ resolved "https://registry.yarnpkg.com/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz#bd7dc26ae2972d0eda253be061dba992349c19f0"
buffer-alloc@^1.1.0:
- version "1.1.0"
- resolved "https://registry.yarnpkg.com/buffer-alloc/-/buffer-alloc-1.1.0.tgz#05514d33bf1656d3540c684f65b1202e90eca303"
+ version "1.2.0"
+ resolved "https://registry.yarnpkg.com/buffer-alloc/-/buffer-alloc-1.2.0.tgz#890dd90d923a873e08e10e5fd51a57e5b7cce0ec"
dependencies:
- buffer-alloc-unsafe "^0.1.0"
- buffer-fill "^0.1.0"
+ buffer-alloc-unsafe "^1.1.0"
+ buffer-fill "^1.0.0"
buffer-equal-constant-time@1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz#f8e71132f7ffe6e01a5c9697a4c6f3e48d5cc819"
-buffer-fill@^0.1.0:
- version "0.1.1"
- resolved "https://registry.yarnpkg.com/buffer-fill/-/buffer-fill-0.1.1.tgz#76d825c4d6e50e06b7a31eb520c04d08cc235071"
+buffer-fill@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/buffer-fill/-/buffer-fill-1.0.0.tgz#f8f78b76789888ef39f205cd637f68e702122b2c"
buffer-from@^1.0.0:
- version "1.0.0"
- resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.0.0.tgz#4cb8832d23612589b0406e9e2956c17f06fdf531"
+ version "1.1.0"
+ resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.0.tgz#87fcaa3a298358e0ade6e442cfce840740d1ad04"
builtin-modules@^1.0.0:
version "1.1.1"
@@ -2053,10 +2053,10 @@ component-type@^1.2.1:
resolved "https://registry.yarnpkg.com/component-type/-/component-type-1.2.1.tgz#8a47901700238e4fc32269771230226f24b415a9"
compressible@~2.0.13:
- version "2.0.13"
- resolved "https://registry.yarnpkg.com/compressible/-/compressible-2.0.13.tgz#0d1020ab924b2fdb4d6279875c7d6daba6baa7a9"
+ version "2.0.14"
+ resolved "https://registry.yarnpkg.com/compressible/-/compressible-2.0.14.tgz#326c5f507fbb055f54116782b969a81b67a29da7"
dependencies:
- mime-db ">= 1.33.0 < 2"
+ mime-db ">= 1.34.0 < 2"
compression@^1.7.1:
version "1.7.2"
@@ -2124,8 +2124,8 @@ cookie@0.3.1:
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb"
cookiejar@^2.1.0:
- version "2.1.1"
- resolved "https://registry.yarnpkg.com/cookiejar/-/cookiejar-2.1.1.tgz#41ad57b1b555951ec171412a81942b1e8200d34a"
+ version "2.1.2"
+ resolved "https://registry.yarnpkg.com/cookiejar/-/cookiejar-2.1.2.tgz#dd8a235530752f988f9a0844f3fc589e3111125c"
copy-descriptor@^0.1.0:
version "0.1.1"
@@ -2136,8 +2136,8 @@ core-js@^1.0.0:
resolved "https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636"
core-js@^2.2.2, core-js@^2.4.0, core-js@^2.4.1, core-js@^2.5.0, core-js@^2.5.6:
- version "2.5.6"
- resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.6.tgz#0fe6d45bf3cac3ac364a9d72de7576f4eb221b9d"
+ version "2.5.7"
+ resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.7.tgz#f972608ff0cead68b841a16a932d0b183791814e"
core-util-is@1.0.2, core-util-is@~1.0.0:
version "1.0.2"
@@ -2254,9 +2254,9 @@ deep-diff@0.3.4:
version "0.3.4"
resolved "https://registry.yarnpkg.com/deep-diff/-/deep-diff-0.3.4.tgz#aac5c39952236abe5f037a2349060ba01b00ae48"
-deep-extend@^0.5.1:
- version "0.5.1"
- resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.5.1.tgz#b894a9dd90d3023fbf1c55a394fb858eb2066f1f"
+deep-extend@^0.6.0:
+ version "0.6.0"
+ resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac"
deep-is@~0.1.3:
version "0.1.3"
@@ -2267,8 +2267,8 @@ deepmerge@^1.3.0, deepmerge@^1.5.1:
resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-1.5.2.tgz#10499d868844cdad4fee0842df8c7f6f0c95a753"
deepmerge@^2.1.0:
- version "2.1.0"
- resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-2.1.0.tgz#511a54fff405fc346f0240bb270a3e9533a31102"
+ version "2.1.1"
+ resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-2.1.1.tgz#e862b4e45ea0555072bf51e7fd0d9845170ae768"
default-require-extensions@^1.0.0:
version "1.0.0"
@@ -2426,8 +2426,8 @@ errorhandler@^1.5.0:
escape-html "~1.0.3"
es-abstract@^1.5.1:
- version "1.11.0"
- resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.11.0.tgz#cce87d518f0496893b1a30cd8461835535480681"
+ version "1.12.0"
+ resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.12.0.tgz#9dbbdd27c6856f0001421ca18782d786bf8a6165"
dependencies:
es-to-primitive "^1.1.1"
function-bind "^1.1.1"
@@ -2974,7 +2974,7 @@ ftp@~0.3.10:
readable-stream "1.1.x"
xregexp "2.0.0"
-function-bind@^1.0.2, function-bind@^1.1.1:
+function-bind@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d"
@@ -3202,10 +3202,10 @@ has-values@^1.0.0:
kind-of "^4.0.0"
has@^1.0.1:
- version "1.0.1"
- resolved "https://registry.yarnpkg.com/has/-/has-1.0.1.tgz#8461733f538b0837c9361e39a9ab9e9704dc2f28"
+ version "1.0.3"
+ resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796"
dependencies:
- function-bind "^1.0.2"
+ function-bind "^1.1.1"
hasbin@^1.2.3:
version "1.2.3"
@@ -3731,8 +3731,8 @@ istanbul-lib-source-maps@^1.2.1:
source-map "^0.5.3"
istanbul-lib-source-maps@^1.2.4:
- version "1.2.4"
- resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.2.4.tgz#cc7ccad61629f4efff8e2f78adb8c522c9976ec7"
+ version "1.2.5"
+ resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.2.5.tgz#ffe6be4e7ab86d3603e4290d54990b14506fc9b1"
dependencies:
debug "^3.1.0"
istanbul-lib-coverage "^1.2.0"
@@ -4069,8 +4069,8 @@ js-tokens@^3.0.0, js-tokens@^3.0.2:
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b"
js-yaml@^3.7.0:
- version "3.11.0"
- resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.11.0.tgz#597c1a8bd57152f26d622ce4117851a51f5ebaef"
+ version "3.12.0"
+ resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1"
dependencies:
argparse "^1.0.7"
esprima "^4.0.0"
@@ -4661,14 +4661,18 @@ micromatch@^3.1.4, micromatch@^3.1.8:
snapdragon "^0.8.1"
to-regex "^3.0.2"
-"mime-db@>= 1.33.0 < 2", mime-db@~1.33.0:
- version "1.33.0"
- resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.33.0.tgz#a3492050a5cb9b63450541e39d9788d2272783db"
+"mime-db@>= 1.34.0 < 2":
+ version "1.34.0"
+ resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.34.0.tgz#452d0ecff5c30346a6dc1e64b1eaee0d3719ff9a"
mime-db@~1.23.0:
version "1.23.0"
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.23.0.tgz#a31b4070adaea27d732ea333740a64d0ec9a6659"
+mime-db@~1.33.0:
+ version "1.33.0"
+ resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.33.0.tgz#a3492050a5cb9b63450541e39d9788d2272783db"
+
mime-types@2.1.11:
version "2.1.11"
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.11.tgz#c259c471bda808a85d6cd193b430a5fae4473b3c"
@@ -4750,8 +4754,8 @@ mkdirp@*, mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.1:
minimist "0.0.8"
moment@2.x.x, moment@^2.10.6:
- version "2.22.1"
- resolved "https://registry.yarnpkg.com/moment/-/moment-2.22.1.tgz#529a2e9bf973f259c9643d237fda84de3a26e8ad"
+ version "2.22.2"
+ resolved "https://registry.yarnpkg.com/moment/-/moment-2.22.2.tgz#3c257f9839fc0e93ff53149632239eb90783ff66"
morgan@^1.9.0:
version "1.9.0"
@@ -4944,8 +4948,8 @@ number-is-nan@^1.0.0:
resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d"
nwsapi@^2.0.0:
- version "2.0.0"
- resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.0.0.tgz#7c8faf4ad501e1d17a651ebc5547f966b547c5c7"
+ version "2.0.1"
+ resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.0.1.tgz#a50d59a2dcb14b6931401171713ced2d0eb3468f"
oauth-sign@~0.8.2:
version "0.8.2"
@@ -5378,7 +5382,7 @@ prop-types@15.5.8:
dependencies:
fbjs "^0.8.9"
-prop-types@^15.5.10, prop-types@^15.5.8, prop-types@^15.6.0:
+prop-types@^15.5.10, prop-types@^15.5.8, prop-types@^15.6.0, prop-types@^15.6.1:
version "15.6.1"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.6.1.tgz#36644453564255ddda391191fb3a125cbdf654ca"
dependencies:
@@ -5414,6 +5418,10 @@ pseudomap@^1.0.1, pseudomap@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3"
+psl@^1.1.24:
+ version "1.1.27"
+ resolved "https://registry.yarnpkg.com/psl/-/psl-1.1.27.tgz#2b2c77019db86855170d903532400bf71ee085b6"
+
punycode@1.3.2:
version "1.3.2"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d"
@@ -5487,10 +5495,10 @@ raw-body@2.3.3, raw-body@^2.2.0:
unpipe "1.0.0"
rc@^1.1.7:
- version "1.2.7"
- resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.7.tgz#8a10ca30d588d00464360372b890d06dacd02297"
+ version "1.2.8"
+ resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed"
dependencies:
- deep-extend "^0.5.1"
+ deep-extend "^0.6.0"
ini "~1.3.0"
minimist "^1.2.0"
strip-json-comments "~2.0.1"
@@ -5654,7 +5662,13 @@ react-native-tab-view@^0.0.77:
dependencies:
prop-types "^15.6.0"
-react-native-tab-view@~0.0.77, react-native-tab-view@~0.0.78:
+react-native-tab-view@^1.0.0:
+ version "1.0.2"
+ resolved "https://registry.yarnpkg.com/react-native-tab-view/-/react-native-tab-view-1.0.2.tgz#66e0bc6d38a227ed2b212e3a256b7902f6ce02ed"
+ dependencies:
+ prop-types "^15.6.1"
+
+react-native-tab-view@~0.0.77:
version "0.0.78"
resolved "https://registry.yarnpkg.com/react-native-tab-view/-/react-native-tab-view-0.0.78.tgz#9b90730d89cbd34a03f0e0ab10e74ca7af945560"
dependencies:
@@ -5744,6 +5758,12 @@ react-navigation-deprecated-tab-navigator@1.3.0:
dependencies:
react-native-tab-view "^0.0.77"
+react-navigation-drawer@0.2.0:
+ version "0.2.0"
+ resolved "https://registry.yarnpkg.com/react-navigation-drawer/-/react-navigation-drawer-0.2.0.tgz#906f78c35f82f6ee39c3ca1d275f1a71e80e2c57"
+ dependencies:
+ react-native-drawer-layout-polyfill "^1.3.2"
+
react-navigation-header-buttons@^0.0.4:
version "0.0.4"
resolved "https://registry.yarnpkg.com/react-navigation-header-buttons/-/react-navigation-header-buttons-0.0.4.tgz#90dd7617aec31eeb35c600eb90afe40f9b0dc43b"
@@ -5769,15 +5789,15 @@ react-navigation-tabs@0.2.0-rc.0:
react-native-safe-area-view "^0.7.0"
react-native-tab-view "~0.0.77"
-react-navigation-tabs@0.3.0:
- version "0.3.0"
- resolved "https://registry.yarnpkg.com/react-navigation-tabs/-/react-navigation-tabs-0.3.0.tgz#b1fe7ef1c665dd8928fafcc8622616e220ae5efa"
+react-navigation-tabs@0.5.0:
+ version "0.5.0"
+ resolved "https://registry.yarnpkg.com/react-navigation-tabs/-/react-navigation-tabs-0.5.0.tgz#74d5511270742a0b67c46fe65a1b19e553763819"
dependencies:
hoist-non-react-statics "^2.5.0"
- prop-types "^15.6.0"
+ prop-types "^15.6.1"
react-lifecycles-compat "^3.0.4"
react-native-safe-area-view "^0.7.0"
- react-native-tab-view "~0.0.78"
+ react-native-tab-view "^1.0.0"
"react-navigation@link:../..":
version "0.0.0"
@@ -5955,8 +5975,8 @@ regenerator-transform@^0.10.0:
private "^0.1.6"
regenerator-transform@^0.12.3:
- version "0.12.3"
- resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.12.3.tgz#459adfb64f6a27164ab991b7873f45ab969eca8b"
+ version "0.12.4"
+ resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.12.4.tgz#aa9b6c59f4b97be080e972506c560b3bccbfcff0"
dependencies:
private "^0.1.6"
@@ -6189,7 +6209,7 @@ safe-regex@^1.1.0:
dependencies:
ret "~0.1.10"
-"safer-buffer@>= 2.1.2 < 3":
+"safer-buffer@>= 2.1.2 < 3", safer-buffer@^2.0.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
@@ -6491,13 +6511,14 @@ sprintf-js@~1.0.2:
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
sshpk@^1.7.0:
- version "1.14.1"
- resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.14.1.tgz#130f5975eddad963f1d56f92b9ac6c51fa9f83eb"
+ version "1.14.2"
+ resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.14.2.tgz#c6fc61648a3d9c4e764fd3fcdf4ea105e492ba98"
dependencies:
asn1 "~0.2.3"
assert-plus "^1.0.0"
dashdash "^1.12.0"
getpass "^0.1.1"
+ safer-buffer "^2.0.2"
optionalDependencies:
bcrypt-pbkdf "^1.0.0"
ecc-jsbn "~0.1.1"
@@ -6807,7 +6828,14 @@ topo@2.x.x:
dependencies:
hoek "4.x.x"
-tough-cookie@>=2.3.3, tough-cookie@^2.3.3, tough-cookie@~2.3.3:
+tough-cookie@>=2.3.3, tough-cookie@^2.3.3:
+ version "2.4.2"
+ resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.4.2.tgz#aa9133154518b494efab98a58247bfc38818c00c"
+ dependencies:
+ psl "^1.1.24"
+ punycode "^1.4.1"
+
+tough-cookie@~2.3.3:
version "2.3.4"
resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.4.tgz#ec60cee38ac675063ffc97a5c18970578ee83655"
dependencies:
@@ -7069,8 +7097,8 @@ which-module@^2.0.0:
resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a"
which@^1.2.12, which@^1.2.14, which@^1.2.9, which@^1.3.0:
- version "1.3.0"
- resolved "https://registry.yarnpkg.com/which/-/which-1.3.0.tgz#ff04bdfc010ee547d780bec38e1ac1c2777d253a"
+ version "1.3.1"
+ resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a"
dependencies:
isexe "^2.0.0"
diff --git a/packages/react-navigation/package.json b/packages/react-navigation/package.json
index 25da5a20..4258cd5e 100644
--- a/packages/react-navigation/package.json
+++ b/packages/react-navigation/package.json
@@ -35,9 +35,9 @@
"path-to-regexp": "^1.7.0",
"prop-types": "^15.5.10",
"react-lifecycles-compat": "^3",
- "react-native-drawer-layout-polyfill": "^1.3.2",
"react-native-safe-area-view": "^0.8.0",
"react-navigation-deprecated-tab-navigator": "1.3.0",
+ "react-navigation-drawer": "0.2.0",
"react-navigation-tabs": "0.5.0"
},
"devDependencies": {
diff --git a/packages/react-navigation/src/navigators/__tests__/DrawerNavigator-test.js b/packages/react-navigation/src/navigators/__tests__/DrawerNavigator-test.js
deleted file mode 100644
index 24675c39..00000000
--- a/packages/react-navigation/src/navigators/__tests__/DrawerNavigator-test.js
+++ /dev/null
@@ -1,33 +0,0 @@
-import React, { Component } from 'react';
-import { View } from 'react-native';
-import renderer from 'react-test-renderer';
-
-import DrawerNavigator from '../createDrawerNavigator';
-
-class HomeScreen extends Component {
- static navigationOptions = ({ navigation }) => ({
- title: `Welcome ${
- navigation.state.params ? navigation.state.params.user : 'anonymous'
- }`,
- gesturesEnabled: true,
- });
-
- render() {
- return null;
- }
-}
-
-const routeConfig = {
- Home: {
- screen: HomeScreen,
- },
-};
-
-describe('DrawerNavigator', () => {
- it('renders successfully', () => {
- const MyDrawerNavigator = DrawerNavigator(routeConfig);
- const rendered = renderer.create().toJSON();
-
- expect(rendered).toMatchSnapshot();
- });
-});
diff --git a/packages/react-navigation/src/navigators/__tests__/__snapshots__/DrawerNavigator-test.js.snap b/packages/react-navigation/src/navigators/__tests__/__snapshots__/DrawerNavigator-test.js.snap
deleted file mode 100644
index efed0e60..00000000
--- a/packages/react-navigation/src/navigators/__tests__/__snapshots__/DrawerNavigator-test.js.snap
+++ /dev/null
@@ -1,243 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`DrawerNavigator renders successfully 1`] = `
-
-
-
-
-
-
-
-
-
-
-
-
-
- Welcome anonymous
-
-
-
-
-
-
-
-
-
-
-
-`;
diff --git a/packages/react-navigation/src/navigators/createDrawerNavigator.js b/packages/react-navigation/src/navigators/createDrawerNavigator.js
deleted file mode 100644
index 2a1a98d7..00000000
--- a/packages/react-navigation/src/navigators/createDrawerNavigator.js
+++ /dev/null
@@ -1,72 +0,0 @@
-import React from 'react';
-import { Dimensions, Platform, ScrollView } from 'react-native';
-import SafeAreaView from 'react-native-safe-area-view';
-
-import createNavigator from './createNavigator';
-import createNavigationContainer from '../createNavigationContainer';
-import DrawerRouter from '../routers/DrawerRouter';
-import DrawerView from '../views/Drawer/DrawerView';
-import DrawerItems from '../views/Drawer/DrawerNavigatorItems';
-
-// A stack navigators props are the intersection between
-// the base navigator props (navgiation, screenProps, etc)
-// and the view's props
-
-const defaultContentComponent = props => (
-
-
-
-
-
-);
-
-const DefaultDrawerConfig = {
- drawerWidth: () => {
- /*
- * Default drawer width is screen width - header height
- * with a max width of 280 on mobile and 320 on tablet
- * https://material.io/guidelines/patterns/navigation-drawer.html
- */
- const { height, width } = Dimensions.get('window');
- const smallerAxisSize = Math.min(height, width);
- const isLandscape = width > height;
- const isTablet = smallerAxisSize >= 600;
- const appBarHeight = Platform.OS === 'ios' ? (isLandscape ? 32 : 44) : 56;
- const maxWidth = isTablet ? 320 : 280;
-
- return Math.min(smallerAxisSize - appBarHeight, maxWidth);
- },
- contentComponent: defaultContentComponent,
- drawerPosition: 'left',
- drawerBackgroundColor: 'white',
- useNativeAnimations: true,
-};
-
-const DrawerNavigator = (routeConfigs, config = {}) => {
- const mergedConfig = { ...DefaultDrawerConfig, ...config };
-
- const {
- order,
- paths,
- initialRouteName,
- backBehavior,
- getCustomActionCreators,
- ...drawerConfig
- } = mergedConfig;
-
- const routerConfig = {
- order,
- paths,
- initialRouteName,
- backBehavior,
- getCustomActionCreators,
- };
-
- const drawerRouter = DrawerRouter(routeConfigs, routerConfig);
-
- const navigator = createNavigator(DrawerView, drawerRouter, drawerConfig);
-
- return createNavigationContainer(navigator);
-};
-
-export default DrawerNavigator;
diff --git a/packages/react-navigation/src/react-navigation.js b/packages/react-navigation/src/react-navigation.js
index b62a3633..277862eb 100644
--- a/packages/react-navigation/src/react-navigation.js
+++ b/packages/react-navigation/src/react-navigation.js
@@ -32,13 +32,13 @@ module.exports = {
return require('./navigators/createSwitchNavigator').default;
},
get createDrawerNavigator() {
- return require('./navigators/createDrawerNavigator').default;
+ return require('react-navigation-drawer').createDrawerNavigator;
},
get DrawerNavigator() {
console.warn(
'The DrawerNavigator function name is deprecated, please use createDrawerNavigator instead'
);
- return require('./navigators/createDrawerNavigator').default;
+ return require('react-navigation-drawer').createDrawerNavigator;
},
get createTabNavigator() {
console.warn(
@@ -69,7 +69,7 @@ module.exports = {
return require('./routers/StackActions').default;
},
get DrawerActions() {
- return require('./routers/DrawerActions').default;
+ return require('react-navigation-drawer').DrawerActions;
},
get getNavigationActionCreators() {
return require('./routers/getNavigationActionCreators').default;
@@ -83,7 +83,7 @@ module.exports = {
return require('./routers/TabRouter').default;
},
get DrawerRouter() {
- return require('./routers/DrawerRouter').default;
+ return require('react-navigation-drawer').DrawerRouter;
},
get SwitchRouter() {
return require('./routers/SwitchRouter').default;
@@ -122,13 +122,13 @@ module.exports = {
// DrawerView
get DrawerView() {
- return require('./views/Drawer/DrawerView').default;
+ return require('react-navigation-drawer').DrawerView;
},
get DrawerItems() {
- return require('./views/Drawer/DrawerNavigatorItems').default;
+ return require('react-navigation-drawer').DrawerNavigatorItems;
},
get DrawerSidebar() {
- return require('./views/Drawer/DrawerSidebar').default;
+ return require('react-navigation-drawer').DrawerSidebar;
},
// TabView
diff --git a/packages/react-navigation/src/routers/DrawerActions.js b/packages/react-navigation/src/routers/DrawerActions.js
deleted file mode 100644
index 5dae0d31..00000000
--- a/packages/react-navigation/src/routers/DrawerActions.js
+++ /dev/null
@@ -1,28 +0,0 @@
-const OPEN_DRAWER = 'Navigation/OPEN_DRAWER';
-const CLOSE_DRAWER = 'Navigation/CLOSE_DRAWER';
-const TOGGLE_DRAWER = 'Navigation/TOGGLE_DRAWER';
-
-const openDrawer = payload => ({
- type: OPEN_DRAWER,
- ...payload,
-});
-
-const closeDrawer = payload => ({
- type: CLOSE_DRAWER,
- ...payload,
-});
-
-const toggleDrawer = payload => ({
- type: TOGGLE_DRAWER,
- ...payload,
-});
-
-export default {
- OPEN_DRAWER,
- CLOSE_DRAWER,
- TOGGLE_DRAWER,
-
- openDrawer,
- closeDrawer,
- toggleDrawer,
-};
diff --git a/packages/react-navigation/src/routers/DrawerRouter.js b/packages/react-navigation/src/routers/DrawerRouter.js
deleted file mode 100644
index 856e46da..00000000
--- a/packages/react-navigation/src/routers/DrawerRouter.js
+++ /dev/null
@@ -1,98 +0,0 @@
-import SwitchRouter from './SwitchRouter';
-import NavigationActions from '../NavigationActions';
-
-import invariant from '../utils/invariant';
-import withDefaultValue from '../utils/withDefaultValue';
-
-import DrawerActions from './DrawerActions';
-
-const getActiveRouteKey = route => {
- if (route.routes && route.routes[route.index]) {
- return getActiveRouteKey(route.routes[route.index]);
- }
- return route.key;
-};
-
-export default (routeConfigs, config = {}) => {
- config = { ...config };
- config = withDefaultValue(config, 'resetOnBlur', false);
- config = withDefaultValue(config, 'backBehavior', 'initialRoute');
-
- const switchRouter = SwitchRouter(routeConfigs, config);
-
- return {
- ...switchRouter,
-
- getActionCreators(route, navStateKey) {
- return {
- openDrawer: () => DrawerActions.openDrawer({ key: navStateKey }),
- closeDrawer: () => DrawerActions.closeDrawer({ key: navStateKey }),
- toggleDrawer: () => DrawerActions.toggleDrawer({ key: navStateKey }),
- ...switchRouter.getActionCreators(route, navStateKey),
- };
- },
-
- getStateForAction(action, state) {
- // Set up the initial state if needed
- if (!state) {
- return {
- ...switchRouter.getStateForAction(action, undefined),
- isDrawerOpen: false,
- };
- }
-
- const isRouterTargeted = action.key == null || action.key === state.key;
-
- if (isRouterTargeted) {
- // Only handle actions that are meant for this drawer, as specified by action.key.
-
- if (action.type === DrawerActions.CLOSE_DRAWER && state.isDrawerOpen) {
- return {
- ...state,
- isDrawerOpen: false,
- };
- }
-
- if (action.type === DrawerActions.OPEN_DRAWER && !state.isDrawerOpen) {
- return {
- ...state,
- isDrawerOpen: true,
- };
- }
-
- if (action.type === DrawerActions.TOGGLE_DRAWER) {
- return {
- ...state,
- isDrawerOpen: !state.isDrawerOpen,
- };
- }
- }
-
- // Fall back on switch router for screen switching logic, and handling of child routers
- const switchedState = switchRouter.getStateForAction(action, state);
-
- if (switchedState === null) {
- // The switch router or a child router is attempting to swallow this action. We return null to allow this.
- return null;
- }
-
- // Has the switch router changed the state?
- if (switchedState !== state) {
- if (getActiveRouteKey(switchedState) !== getActiveRouteKey(state)) {
- // If any navigation has happened, make sure to close the drawer
- return {
- ...switchedState,
- isDrawerOpen: false,
- };
- }
-
- // At this point, return the state as defined by the switch router.
- // The active route key hasn't changed, so this most likely means that a child router has returned
- // a new state like a param change, but the same key is still active and the drawer will remain open
- return switchedState;
- }
-
- return state;
- },
- };
-};
diff --git a/packages/react-navigation/src/routers/__tests__/DrawerRouter-test.js b/packages/react-navigation/src/routers/__tests__/DrawerRouter-test.js
deleted file mode 100644
index 7b738321..00000000
--- a/packages/react-navigation/src/routers/__tests__/DrawerRouter-test.js
+++ /dev/null
@@ -1,176 +0,0 @@
-/* eslint react/display-name:0 */
-
-import React from 'react';
-import DrawerRouter from '../DrawerRouter';
-
-import NavigationActions from '../../NavigationActions';
-import DrawerActions from '../../routers/DrawerActions';
-
-const INIT_ACTION = { type: NavigationActions.INIT };
-
-describe('DrawerRouter', () => {
- test('Handles basic tab logic', () => {
- const ScreenA = () =>
;
- const ScreenB = () => ;
- const router = DrawerRouter({
- Foo: { screen: ScreenA },
- Bar: { screen: ScreenB },
- });
- const state = router.getStateForAction(INIT_ACTION);
- const expectedState = {
- index: 0,
- isTransitioning: false,
- routes: [
- { key: 'Foo', routeName: 'Foo', params: undefined },
- { key: 'Bar', routeName: 'Bar', params: undefined },
- ],
- isDrawerOpen: false,
- };
- expect(state).toEqual(expectedState);
- const state2 = router.getStateForAction(
- { type: NavigationActions.NAVIGATE, routeName: 'Bar' },
- state
- );
- const expectedState2 = {
- index: 1,
- isTransitioning: false,
- routes: [
- { key: 'Foo', routeName: 'Foo', params: undefined },
- { key: 'Bar', routeName: 'Bar', params: undefined },
- ],
- isDrawerOpen: false,
- };
- expect(state2).toEqual(expectedState2);
- expect(router.getComponentForState(expectedState)).toEqual(ScreenA);
- expect(router.getComponentForState(expectedState2)).toEqual(ScreenB);
- });
-
- test('Handles initial route navigation', () => {
- const FooScreen = () => ;
- const BarScreen = () => ;
- const router = DrawerRouter(
- {
- Foo: {
- screen: FooScreen,
- },
- Bar: {
- screen: BarScreen,
- },
- },
- { initialRouteName: 'Bar' }
- );
- const state = router.getStateForAction({
- type: NavigationActions.NAVIGATE,
- routeName: 'Foo',
- });
- expect(state).toEqual({
- index: 0,
- isDrawerOpen: false,
- isTransitioning: false,
- routes: [
- {
- key: 'Foo',
- params: undefined,
- routeName: 'Foo',
- },
- {
- key: 'Bar',
- params: undefined,
- routeName: 'Bar',
- },
- ],
- });
- });
-
- test('Drawer opens closes and toggles', () => {
- const ScreenA = () => ;
- const ScreenB = () => ;
- const router = DrawerRouter({
- Foo: { screen: ScreenA },
- Bar: { screen: ScreenB },
- });
- const state = router.getStateForAction(INIT_ACTION);
- expect(state.isDrawerOpen).toEqual(false);
- const state2 = router.getStateForAction(
- { type: DrawerActions.OPEN_DRAWER },
- state
- );
- expect(state2.isDrawerOpen).toEqual(true);
- const state3 = router.getStateForAction(
- { type: DrawerActions.CLOSE_DRAWER },
- state2
- );
- expect(state3.isDrawerOpen).toEqual(false);
- const state4 = router.getStateForAction(
- { type: DrawerActions.TOGGLE_DRAWER },
- state3
- );
- expect(state4.isDrawerOpen).toEqual(true);
- });
-
- test('Drawer opens closes with key targeted', () => {
- const ScreenA = () => ;
- const ScreenB = () => ;
- const router = DrawerRouter({
- Foo: { screen: ScreenA },
- Bar: { screen: ScreenB },
- });
- const state = router.getStateForAction(INIT_ACTION);
- const state2 = router.getStateForAction(
- { type: DrawerActions.OPEN_DRAWER, key: 'wrong' },
- state
- );
- expect(state2.isDrawerOpen).toEqual(false);
- const state3 = router.getStateForAction(
- { type: DrawerActions.OPEN_DRAWER, key: state.key },
- state2
- );
- expect(state3.isDrawerOpen).toEqual(true);
- });
-});
-
-test('Nested routers bubble up blocked actions', () => {
- const ScreenA = () => ;
- ScreenA.router = {
- getStateForAction(action, lastState) {
- if (action.type === 'CHILD_ACTION') return null;
- return lastState;
- },
- };
- const ScreenB = () => ;
- const router = DrawerRouter({
- Foo: { screen: ScreenA },
- Bar: { screen: ScreenB },
- });
- const state = router.getStateForAction(INIT_ACTION);
-
- const state2 = router.getStateForAction({ type: 'CHILD_ACTION' }, state);
- expect(state2).toEqual(null);
-});
-
-test('Drawer stays open when child routers return new state', () => {
- const ScreenA = () => ;
- ScreenA.router = {
- getStateForAction(action, lastState = { changed: false }) {
- if (action.type === 'CHILD_ACTION')
- return { ...lastState, changed: true };
- return lastState;
- },
- };
- const router = DrawerRouter({
- Foo: { screen: ScreenA },
- });
-
- const state = router.getStateForAction(INIT_ACTION);
- expect(state.isDrawerOpen).toEqual(false);
-
- const state2 = router.getStateForAction(
- { type: DrawerActions.OPEN_DRAWER, key: state.key },
- state
- );
- expect(state2.isDrawerOpen).toEqual(true);
-
- const state3 = router.getStateForAction({ type: 'CHILD_ACTION' }, state2);
- expect(state3.isDrawerOpen).toEqual(true);
- expect(state3.routes[0].changed).toEqual(true);
-});
diff --git a/packages/react-navigation/src/routers/__tests__/Routers-test.js b/packages/react-navigation/src/routers/__tests__/Routers-test.js
index 2d7b2cb8..a8e00e42 100644
--- a/packages/react-navigation/src/routers/__tests__/Routers-test.js
+++ b/packages/react-navigation/src/routers/__tests__/Routers-test.js
@@ -5,10 +5,8 @@ import React from 'react';
import StackRouter from '../StackRouter';
import TabRouter from '../TabRouter';
import SwitchRouter from '../SwitchRouter';
-import DrawerRouter from '../DrawerRouter';
import NavigationActions from '../../NavigationActions';
-import DrawerActions from '../DrawerActions';
import { _TESTING_ONLY_normalize_keys } from '../KeyGenerator';
beforeEach(() => {
@@ -18,7 +16,6 @@ beforeEach(() => {
const ROUTERS = {
TabRouter,
StackRouter,
- DrawerRouter,
SwitchRouter,
};
@@ -471,53 +468,3 @@ test('Inner actions are only unpacked if the current tab matches', () => {
innerState && comparable(innerState)
);
});
-
-test('DrawerRouter will close drawer on child navigaton, not on child param changes', () => {
- class FooView extends React.Component {
- render() {
- return ;
- }
- }
- const BarRouter = SwitchRouter({
- Qux: FooView,
- Quo: FooView,
- });
- class BarView extends React.Component {
- static router = BarRouter;
- render() {
- return ;
- }
- }
- const router = DrawerRouter({
- Bar: BarView,
- Foo: FooView,
- });
-
- const emptyState = router.getStateForAction(NavigationActions.init());
- const initState = router.getStateForAction(
- DrawerActions.openDrawer(),
- emptyState
- );
- expect(initState.isDrawerOpen).toBe(true);
-
- const state0 = router.getStateForAction(
- NavigationActions.navigate({ routeName: 'Quo' }),
- initState
- );
- expect(state0.isDrawerOpen).toBe(false);
-
- const initSwitchState = initState.routes[initState.index];
- const initQuxState = initSwitchState.routes[initSwitchState.index];
-
- const state1 = router.getStateForAction(
- NavigationActions.setParams({
- key: initQuxState.key,
- params: { foo: 'bar' },
- }),
- initState
- );
- expect(state1.isDrawerOpen).toBe(true);
- const state1switchState = state1.routes[state1.index];
- const state1quxState = state1switchState.routes[state1switchState.index];
- expect(state1quxState.params.foo).toEqual('bar');
-});
diff --git a/packages/react-navigation/src/views/Drawer/DrawerNavigatorItems.js b/packages/react-navigation/src/views/Drawer/DrawerNavigatorItems.js
deleted file mode 100644
index 0667c9cd..00000000
--- a/packages/react-navigation/src/views/Drawer/DrawerNavigatorItems.js
+++ /dev/null
@@ -1,119 +0,0 @@
-import React from 'react';
-import { View, Text, Platform, StyleSheet } from 'react-native';
-import SafeAreaView from 'react-native-safe-area-view';
-
-import TouchableItem from '../TouchableItem';
-
-/**
- * Component that renders the navigation list in the drawer.
- */
-const DrawerNavigatorItems = ({
- navigation: { state, navigate },
- items,
- activeItemKey,
- activeTintColor,
- activeBackgroundColor,
- inactiveTintColor,
- inactiveBackgroundColor,
- getLabel,
- renderIcon,
- onItemPress,
- itemsContainerStyle,
- itemStyle,
- labelStyle,
- activeLabelStyle,
- inactiveLabelStyle,
- iconContainerStyle,
- drawerPosition,
-}) => (
-
- {items.map((route, index) => {
- const focused = activeItemKey === route.key;
- const color = focused ? activeTintColor : inactiveTintColor;
- const backgroundColor = focused
- ? activeBackgroundColor
- : inactiveBackgroundColor;
- const scene = { route, index, focused, tintColor: color };
- const icon = renderIcon(scene);
- const label = getLabel(scene);
- const extraLabelStyle = focused ? activeLabelStyle : inactiveLabelStyle;
- return (
- {
- onItemPress({ route, focused });
- }}
- delayPressIn={0}
- >
-
-
- {icon ? (
-
- {icon}
-
- ) : null}
- {typeof label === 'string' ? (
-
- {label}
-
- ) : (
- label
- )}
-
-
-
- );
- })}
-
-);
-
-/* Material design specs - https://material.io/guidelines/patterns/navigation-drawer.html#navigation-drawer-specs */
-DrawerNavigatorItems.defaultProps = {
- activeTintColor: '#2196f3',
- activeBackgroundColor: 'rgba(0, 0, 0, .04)',
- inactiveTintColor: 'rgba(0, 0, 0, .87)',
- inactiveBackgroundColor: 'transparent',
-};
-
-const styles = StyleSheet.create({
- container: {
- paddingVertical: 4,
- },
- item: {
- flexDirection: 'row',
- alignItems: 'center',
- },
- icon: {
- marginHorizontal: 16,
- width: 24,
- alignItems: 'center',
- },
- inactiveIcon: {
- /*
- * Icons have 0.54 opacity according to guidelines
- * 100/87 * 54 ~= 62
- */
- opacity: 0.62,
- },
- label: {
- margin: 16,
- fontWeight: 'bold',
- },
-});
-
-export default DrawerNavigatorItems;
diff --git a/packages/react-navigation/src/views/Drawer/DrawerSidebar.js b/packages/react-navigation/src/views/Drawer/DrawerSidebar.js
deleted file mode 100644
index faf3adf0..00000000
--- a/packages/react-navigation/src/views/Drawer/DrawerSidebar.js
+++ /dev/null
@@ -1,105 +0,0 @@
-import React from 'react';
-import { StyleSheet, View } from 'react-native';
-
-import NavigationActions from '../../NavigationActions';
-import StackActions from '../../routers/StackActions';
-import invariant from '../../utils/invariant';
-
-/**
- * Component that renders the sidebar screen of the drawer.
- */
-
-class DrawerSidebar extends React.PureComponent {
- _getScreenOptions = routeKey => {
- const descriptor = this.props.descriptors[routeKey];
- invariant(
- descriptor.options,
- 'Cannot access screen descriptor options from drawer sidebar'
- );
- return descriptor.options;
- };
-
- _getLabel = ({ focused, tintColor, route }) => {
- const { drawerLabel, title } = this._getScreenOptions(route.key);
- if (drawerLabel) {
- return typeof drawerLabel === 'function'
- ? drawerLabel({ tintColor, focused })
- : drawerLabel;
- }
-
- if (typeof title === 'string') {
- return title;
- }
-
- return route.routeName;
- };
-
- _renderIcon = ({ focused, tintColor, route }) => {
- const { drawerIcon } = this._getScreenOptions(route.key);
- if (drawerIcon) {
- return typeof drawerIcon === 'function'
- ? drawerIcon({ tintColor, focused })
- : drawerIcon;
- }
- return null;
- };
-
- _onItemPress = ({ route, focused }) => {
- if (!focused) {
- let subAction;
- // TODO (v3): Revisit and repeal this behavior:
- // if the child screen is a StackRouter then always navigate to its first screen (see #1914)
- if (route.index != null && route.index !== 0) {
- subAction = StackActions.reset({
- index: 0,
- actions: [
- NavigationActions.navigate({
- routeName: route.routes[0].routeName,
- }),
- ],
- });
- }
- this.props.navigation.dispatch(
- NavigationActions.navigate({
- routeName: route.routeName,
- action: subAction,
- })
- );
- }
- };
-
- render() {
- const ContentComponent = this.props.contentComponent;
- if (!ContentComponent) {
- return null;
- }
- const { state } = this.props.navigation;
- invariant(typeof state.index === 'number', 'should be set');
- return (
-
-
-
- );
- }
-}
-
-export default DrawerSidebar;
-
-const styles = StyleSheet.create({
- container: {
- flex: 1,
- },
-});
diff --git a/packages/react-navigation/src/views/Drawer/DrawerView.js b/packages/react-navigation/src/views/Drawer/DrawerView.js
deleted file mode 100644
index d5f8578b..00000000
--- a/packages/react-navigation/src/views/Drawer/DrawerView.js
+++ /dev/null
@@ -1,127 +0,0 @@
-import React from 'react';
-import { Dimensions } from 'react-native';
-import DrawerLayout from 'react-native-drawer-layout-polyfill';
-
-import DrawerSidebar from './DrawerSidebar';
-import NavigationActions from '../../NavigationActions';
-import DrawerActions from '../../routers/DrawerActions';
-
-/**
- * Component that renders the drawer.
- */
-export default class DrawerView extends React.PureComponent {
- _drawerState = 'closed';
-
- state = {
- drawerWidth:
- typeof this.props.navigationConfig.drawerWidth === 'function'
- ? this.props.navigationConfig.drawerWidth()
- : this.props.navigationConfig.drawerWidth,
- };
-
- componentDidMount() {
- Dimensions.addEventListener('change', this._updateWidth);
- }
-
- componentWillUnmount() {
- Dimensions.removeEventListener('change', this._updateWidth);
- }
-
- componentDidUpdate(prevProps, prevState) {
- const { isDrawerOpen } = this.props.navigation.state;
- const wasDrawerOpen = prevProps.navigation.state.isDrawerOpen;
-
- if (isDrawerOpen && !wasDrawerOpen && this._drawerState === 'closed') {
- this._drawerState = 'opening';
- this._drawer.openDrawer();
- } else if (wasDrawerOpen && !isDrawerOpen && this._drawerState === 'open') {
- this._drawerState = 'closing';
- this._drawer.closeDrawer();
- }
- }
-
- _handleDrawerOpen = () => {
- const { navigation } = this.props;
- const { isDrawerOpen } = navigation.state;
- if (!isDrawerOpen && this._drawerState === 'closed') {
- navigation.dispatch({ type: DrawerActions.OPEN_DRAWER });
- }
- this._drawerState = 'open';
- };
-
- _handleDrawerClose = () => {
- const { navigation } = this.props;
- const { isDrawerOpen } = navigation.state;
- if (isDrawerOpen && this._drawerState === 'open') {
- navigation.dispatch({ type: DrawerActions.CLOSE_DRAWER });
- }
- this._drawerState = 'closed';
- };
-
- _updateWidth = () => {
- const drawerWidth =
- typeof this.props.navigationConfig.drawerWidth === 'function'
- ? this.props.navigationConfig.drawerWidth()
- : this.props.navigationConfig.drawerWidth;
-
- if (this.state.drawerWidth !== drawerWidth) {
- this.setState({ drawerWidth });
- }
- };
-
- _renderNavigationView = () => {
- return (
-
- );
- };
-
- render() {
- const { state } = this.props.navigation;
- const activeKey = state.routes[state.index].key;
- const descriptor = this.props.descriptors[activeKey];
-
- const DrawerScreen = descriptor.getComponent();
-
- const { drawerLockMode } = descriptor.options;
-
- return (
- {
- this._drawer = c;
- }}
- drawerLockMode={
- drawerLockMode ||
- (this.props.screenProps && this.props.screenProps.drawerLockMode) ||
- this.props.navigationConfig.drawerLockMode
- }
- drawerBackgroundColor={
- this.props.navigationConfig.drawerBackgroundColor
- }
- drawerWidth={this.state.drawerWidth}
- onDrawerOpen={this._handleDrawerOpen}
- onDrawerClose={this._handleDrawerClose}
- useNativeAnimations={this.props.navigationConfig.useNativeAnimations}
- renderNavigationView={this._renderNavigationView}
- drawerPosition={
- this.props.navigationConfig.drawerPosition === 'right'
- ? DrawerLayout.positions.Right
- : DrawerLayout.positions.Left
- }
- >
-
-
- );
- }
-}
diff --git a/packages/react-navigation/yarn.lock b/packages/react-navigation/yarn.lock
index 739f2499..b840592d 100644
--- a/packages/react-navigation/yarn.lock
+++ b/packages/react-navigation/yarn.lock
@@ -4823,6 +4823,12 @@ react-navigation-deprecated-tab-navigator@1.3.0:
dependencies:
react-native-tab-view "^0.0.77"
+react-navigation-drawer@0.2.0:
+ version "0.2.0"
+ resolved "https://registry.yarnpkg.com/react-navigation-drawer/-/react-navigation-drawer-0.2.0.tgz#906f78c35f82f6ee39c3ca1d275f1a71e80e2c57"
+ dependencies:
+ react-native-drawer-layout-polyfill "^1.3.2"
+
react-navigation-tabs@0.5.0:
version "0.5.0"
resolved "https://registry.yarnpkg.com/react-navigation-tabs/-/react-navigation-tabs-0.5.0.tgz#74d5511270742a0b67c46fe65a1b19e553763819"