Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/Core.bs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand All @@ -23,7 +23,7 @@ function NavigationHelpersCommon(M) {
if (params !== undefined) {
tmp.params = Caml_option.valFromOption(params);
}
tmp.navigate();
navigation.navigate(tmp);

};
return {
Expand All @@ -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
};
Expand All @@ -57,7 +57,7 @@ function NavigationScreenProp(M) {
if (params !== undefined) {
tmp.params = Caml_option.valFromOption(params);
}
tmp.navigate();
navigation.navigate(tmp);

};
return {
Expand Down
14 changes: 9 additions & 5 deletions src/Core.res
Original file line number Diff line number Diff line change
Expand Up @@ -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<M.params>=?, _) =>
navigateBy(navigateByKeyParams(~key, ~params?, ()))
let navigateByKey = (~key: string, ~params: option<M.params>=?, navigation) =>
navigateBy(navigation, navigateByKeyParams(~key, ~params?, ()))

let navigateByName = (~name: string, ~key: option<string>=?, ~params: option<M.params>=?, _) =>
navigateBy(navigateByNameParams(~name, ~key?, ~params?, ()))
let navigateByName = (
~name: string,
~key: option<string>=?,
~params: option<M.params>=?,
navigation,
) => navigateBy(navigation, navigateByNameParams(~name, ~key?, ~params?, ()))

@send external replace: (navigation, string) => unit = "replace"
@send
Expand Down