From b89bf1eb7e345ca8171790a958f03a641e0cc516 Mon Sep 17 00:00:00 2001 From: vknez Date: Mon, 20 Sep 2021 10:32:10 +0200 Subject: [PATCH] Fix `navigateBy*` functions (#46) - `navigateBy` didn't accept `navigation` --- src/Core.bs.js | 16 ++++++++-------- src/Core.res | 14 +++++++++----- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/Core.bs.js b/src/Core.bs.js index cd66376..20c3d31 100644 --- a/src/Core.bs.js +++ b/src/Core.bs.js @@ -3,17 +3,17 @@ var Caml_option = require("rescript/lib/js/caml_option.js"); function NavigationHelpersCommon(M) { - var navigateByKey = function (key, params, param) { + var navigateByKey = function (key, params, navigation) { var tmp = { key: key }; if (params !== undefined) { tmp.params = Caml_option.valFromOption(params); } - tmp.navigate(); + navigation.navigate(tmp); }; - var navigateByName = function (name, key, params, param) { + var navigateByName = function (name, key, params, navigation) { var tmp = { name: name }; @@ -23,7 +23,7 @@ function NavigationHelpersCommon(M) { if (params !== undefined) { tmp.params = Caml_option.valFromOption(params); } - tmp.navigate(); + navigation.navigate(tmp); }; return { @@ -37,17 +37,17 @@ function EventConsumer(M) { } function NavigationScreenProp(M) { - var navigateByKey = function (key, params, param) { + var navigateByKey = function (key, params, navigation) { var tmp = { key: key }; if (params !== undefined) { tmp.params = Caml_option.valFromOption(params); } - tmp.navigate(); + navigation.navigate(tmp); }; - var navigateByName = function (name, key, params, param) { + var navigateByName = function (name, key, params, navigation) { var tmp = { name: name }; @@ -57,7 +57,7 @@ function NavigationScreenProp(M) { if (params !== undefined) { tmp.params = Caml_option.valFromOption(params); } - tmp.navigate(); + navigation.navigate(tmp); }; return { diff --git a/src/Core.res b/src/Core.res index d3077c3..eec7c81 100644 --- a/src/Core.res +++ b/src/Core.res @@ -39,13 +39,17 @@ module NavigationHelpersCommon = ( unit, ) => navigationParams = "" - @send external navigateBy: navigationParams => unit = "navigate" + @send external navigateBy: (navigation, navigationParams) => unit = "navigate" - let navigateByKey = (~key: string, ~params: option=?, _) => - navigateBy(navigateByKeyParams(~key, ~params?, ())) + let navigateByKey = (~key: string, ~params: option=?, navigation) => + navigateBy(navigation, navigateByKeyParams(~key, ~params?, ())) - let navigateByName = (~name: string, ~key: option=?, ~params: option=?, _) => - navigateBy(navigateByNameParams(~name, ~key?, ~params?, ())) + let navigateByName = ( + ~name: string, + ~key: option=?, + ~params: option=?, + navigation, + ) => navigateBy(navigation, navigateByNameParams(~name, ~key?, ~params?, ())) @send external replace: (navigation, string) => unit = "replace" @send