Skip to content

Commit 923ff7f

Browse files
committed
deprecate WithParams functions
1 parent f780064 commit 923ff7f

File tree

6 files changed

+22
-28
lines changed

6 files changed

+22
-28
lines changed

src/BottomTabs.res

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ type navigatorModule
137137
module Make = () => unpack(createBottomTabNavigator()->adaptNavigatorModule)
138138

139139
module Navigation = {
140-
@send external jumpTo: (navigation, string) => unit = "jumpTo"
141-
@send
140+
@send external jumpTo: (navigation, string, ~params: 'params=?) => unit = "jumpTo"
141+
@deprecated("Use `jumpTo` with `~params` instead") @send
142142
external jumpToWithParams: (navigation, string, 'params) => unit = "jumpTo"
143143

144144
@send

src/Core.res

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,22 +64,18 @@ type layoutNavigatorParams = {
6464
module Navigation = {
6565
type t = navigation
6666

67-
@send external navigate: (t, string) => unit = "navigate"
68-
@send
67+
@send external navigate: (t, string, ~params: 'params=?) => unit = "navigate"
68+
@deprecated("Use `navigate` with `~params` instead") @send
6969
external navigateWithParams: (t, string, 'params) => unit = "navigate"
7070

71-
@send external navigateDeprecated: (t, string) => unit = "navigateDeprecated"
72-
@send
73-
external navigateDeprecatedWithParams: (t, string, 'params) => unit = "navigateDeprecated"
71+
@send external navigateDeprecated: (t, string, ~params: 'params=?) => unit = "navigateDeprecated"
7472

7573
@send external goBack: (navigation, unit) => unit = "goBack"
7674

7775
@send
7876
external reset: (navigation, navigationState) => unit = "reset"
7977

80-
@send external preload: (t, string) => unit = "preload"
81-
@send
82-
external preloadWithParams: (t, string, 'params) => unit = "preload"
78+
@send external preload: (t, string, ~params: 'params=?) => unit = "preload"
8379

8480
@send external isFocused: (navigation, unit) => bool = "isFocused"
8581

src/Example.bs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ function Example$MainStackScreen(props) {
4040
options: (function (props) {
4141
var params = props.route.params;
4242
return {
43-
title: params !== undefined ? Caml_option.valFromOption(params).name : "Reason",
4443
headerRight: (function (param) {
4544
return JsxRuntime.jsx(ReactNative.Button, {
4645
color: "#f00",
@@ -49,7 +48,8 @@ function Example$MainStackScreen(props) {
4948
}),
5049
title: "Info"
5150
});
52-
})
51+
}),
52+
title: params !== undefined ? Caml_option.valFromOption(params).name : "Reason"
5353
};
5454
}),
5555
component: Example$HomeScreen

src/MaterialBottomTabs.res

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ module Navigation = {
8484
@send
8585
external setOptions: (navigation, options) => unit = "setOptions"
8686

87-
@send external jumpTo: (navigation, string) => unit = "jumpTo"
88-
@send
87+
@send external jumpTo: (navigation, string, ~params: 'params=?) => unit = "jumpTo"
88+
@deprecated("Use `jumpTo` with `~params` instead") @send
8989
external jumpToWithParams: (navigation, string, 'params) => unit = "jumpTo"
9090

9191
@send

src/NativeStack.res

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -224,18 +224,17 @@ module Navigation = {
224224
@send
225225
external setOptions: (navigation, options) => unit = "setOptions"
226226

227-
@send external replace: (navigation, string) => unit = "replace"
228-
@send
227+
@send external replace: (navigation, string, ~params: 'params=?) => unit = "replace"
228+
@deprecated("Use `replace` with `~params` instead") @send
229229
external replaceWithParams: (navigation, string, 'params) => unit = "replace"
230230

231-
@send external push: (navigation, string) => unit = "push"
232-
@send external pushWithParams: (navigation, string, 'params) => unit = "push"
231+
@send external push: (navigation, string, ~params: 'params=?) => unit = "push"
232+
@deprecated("Use `push` with `~params` instead") @send
233+
external pushWithParams: (navigation, string, 'params) => unit = "push"
233234

234235
@send external pop: (navigation, ~count: int=?, unit) => unit = "pop"
235236

236-
@send external popTo: (navigation, string) => unit = "popTo"
237-
@send
238-
external popToWithParams: (navigation, string, 'params) => unit = "popTo"
237+
@send external popTo: (navigation, string, ~params: 'params=?) => unit = "popTo"
239238

240239
@send external popToTop: (navigation, unit) => unit = "popToTop"
241240

src/Stack.res

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -208,18 +208,17 @@ module Navigation = {
208208
@send
209209
external setOptions: (navigation, options) => unit = "setOptions"
210210

211-
@send external replace: (navigation, string) => unit = "replace"
212-
@send
211+
@send external replace: (navigation, string, ~params: 'params=?) => unit = "replace"
212+
@deprecated("Use `replace` with `~params` instead") @send
213213
external replaceWithParams: (navigation, string, 'params) => unit = "replace"
214214

215-
@send external push: (navigation, string) => unit = "push"
216-
@send external pushWithParams: (navigation, string, 'params) => unit = "push"
215+
@send external push: (navigation, string, ~params: 'params=?) => unit = "push"
216+
@deprecated("Use `push` with `~params` instead") @send
217+
external pushWithParams: (navigation, string, 'params) => unit = "push"
217218

218219
@send external pop: (navigation, ~count: int=?, unit) => unit = "pop"
219220

220-
@send external popTo: (navigation, string) => unit = "popTo"
221-
@send
222-
external popToWithParams: (navigation, string, 'params) => unit = "popTo"
221+
@send external popTo: (navigation, string, ~params: 'params=?) => unit = "popTo"
223222

224223
@send external popToTop: (navigation, unit) => unit = "popToTop"
225224

0 commit comments

Comments
 (0)