-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* First run at v5 bindings * fix: add missing Interop.js * fix: add route to navigation component props * fix: add route type to functor
- Loading branch information
Showing
17 changed files
with
1,708 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
'use strict'; | ||
|
||
var Core$ReactNavigation = require("./Core.bs.js"); | ||
var BottomTabs = require("@react-navigation/bottom-tabs"); | ||
|
||
function BottomTabNavigationProp(M) { | ||
var include = Core$ReactNavigation.NavigationScreenProp(M); | ||
return { | ||
navigateByKey: include.navigateByKey, | ||
navigateByName: include.navigateByName | ||
}; | ||
} | ||
|
||
function Make(M) { | ||
var M$1 = { }; | ||
var include = Core$ReactNavigation.NavigationScreenProp(M$1); | ||
var Navigation_navigateByKey = include.navigateByKey; | ||
var Navigation_navigateByName = include.navigateByName; | ||
var Navigation = { | ||
navigateByKey: Navigation_navigateByKey, | ||
navigateByName: Navigation_navigateByName | ||
}; | ||
var stack = BottomTabs.createBottomTabNavigator(); | ||
var make = stack.Screen; | ||
var $$Screen = { | ||
make: make | ||
}; | ||
var make$1 = stack.Navigator; | ||
var $$Navigator = { | ||
make: make$1 | ||
}; | ||
return { | ||
Navigation: Navigation, | ||
stack: stack, | ||
Screen: $$Screen, | ||
Navigator: $$Navigator | ||
}; | ||
} | ||
|
||
exports.BottomTabNavigationProp = BottomTabNavigationProp; | ||
exports.Make = Make; | ||
/* @react-navigation/bottom-tabs Not a pure module */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,180 @@ | ||
open Core; | ||
|
||
type options; | ||
|
||
module BottomTabNavigationProp = (M: { | ||
type params; | ||
type options; | ||
}) => { | ||
include NavigationScreenProp(M); | ||
|
||
type t = navigation; | ||
|
||
[@bs.send] external jumpTo: (t, string) => unit = "jumpTo"; | ||
[@bs.send] | ||
external jumpToWithParams: (t, string, M.params) => unit = "jumpTo"; | ||
}; | ||
|
||
module Make = (M: {type params;}) => { | ||
module Navigation = | ||
BottomTabNavigationProp({ | ||
include M; | ||
type nonrec options = options; | ||
}); | ||
|
||
type animatedNode = ReactNative.Animated.Value.t; | ||
|
||
type scene = { | ||
. | ||
"index": int, | ||
"focused": bool, | ||
"tintColor": string, | ||
}; | ||
|
||
class type virtual baseBottomTabBarOptions = { | ||
pub keyboardHidesTabBar: option(bool); | ||
pub activeBackgroundColor: option(string); | ||
pub inactiveBackgroundColor: option(string); | ||
pub allowFontScaling: option(bool); | ||
pub showLabel: option(bool); | ||
pub showIcon: option(bool); | ||
pub labelStyle: option(ReactNative.Style.t); | ||
pub tabStyle: option(ReactNative.Style.t); | ||
pub labelPosition: option({. "deviceOrientation": string} => string); | ||
pub adaptive: option(bool); | ||
pub style: option(ReactNative.Style.t); | ||
}; | ||
|
||
class type virtual bottomTabBarOptions = { | ||
as 'self; | ||
constraint 'self = #baseBottomTabBarOptions; | ||
pub activeTintColor: option(string); | ||
pub inactiveTintColor: option(string); | ||
}; | ||
|
||
type accessibilityRole = string; | ||
type accessibilityStates = array(string); | ||
class type virtual bottomTabBarProps = { | ||
as 'self; | ||
constraint 'self = #baseBottomTabBarOptions; | ||
pub state: navigationState(M.params); | ||
pub navigation: navigation; | ||
pub onTabPress: {. "route": route(M.params)} => unit; | ||
pub onTabLongPress: {. "route": route(M.params)} => unit; | ||
pub getAccessibilityLabel: | ||
{. "route": route(M.params)} => Js.nullable(string); | ||
pub getAccessibilityRole: | ||
{. "route": route(M.params)} => Js.nullable(accessibilityRole); | ||
pub getAccessibilityStates: | ||
{. "route": route(M.params)} => Js.nullable(accessibilityStates); | ||
pub getButtonComponent: | ||
{. "route": route(M.params)} => Js.nullable(React.element); | ||
//pub getLabelText: {. "route": route(M.params)} => ...; | ||
pub getTestID: {. "route": route(M.params)} => Js.nullable(string); | ||
pub renderIcon: | ||
{ | ||
. | ||
"route": route(M.params), | ||
"focused": bool, | ||
"tintColor": string, | ||
"horizontal": bool, | ||
} => | ||
React.element; | ||
pub activeTintColor: string; | ||
pub inactiveTintColor: string; | ||
}; | ||
|
||
[@bs.obj] | ||
external bottomTabBarOptions: | ||
( | ||
~keyboardHidesTabBar: bool=?, | ||
~activeTintColor: string=?, | ||
~inactiveTintColor: string=?, | ||
~activeBackgroundColor: string=?, | ||
~inactiveBackgroundColor: string=?, | ||
~allowFontScaling: bool=?, | ||
~showLabel: bool=?, | ||
~showIcon: bool=?, | ||
~labelStyle: ReactNative.Style.t=?, | ||
~tabStyle: ReactNative.Style.t=?, | ||
~labelPosition: {. "deviceOrientation": string} => string=?, | ||
~adaptive: bool=?, | ||
~style: ReactNative.Style.t=? | ||
) => | ||
bottomTabBarOptions = | ||
""; | ||
|
||
[@bs.obj] | ||
external options: | ||
( | ||
~title: string=?, | ||
//TODO: dynamic, missing static option: React.ReactNode | ||
~tabBarLabel: scene => React.element=?, | ||
//TODO: dynamic, missing static option: React.ReactNode | ||
~tabBarIcon: scene => React.element=?, | ||
~tabBarAccessibilityLabel: string=?, | ||
~tabBarTestID: string=?, | ||
~tabBarVisible: bool=?, | ||
~tabBarButtonComponent: React.element=?, | ||
unit | ||
) => | ||
options = | ||
""; | ||
|
||
type optionsProps = | ||
{ | ||
. | ||
"navigation": navigation, | ||
"route": route(M.params), | ||
} => | ||
options; | ||
|
||
type navigatorProps; | ||
|
||
type screenProps; | ||
|
||
[@bs.module "@react-navigation/bottom-tabs"] | ||
external make: | ||
unit => | ||
{ | ||
. | ||
"Navigator": navigatorProps => React.element, | ||
"Screen": screenProps => React.element, | ||
} = | ||
"createBottomTabNavigator"; | ||
|
||
let stack = make(); | ||
|
||
module Screen = { | ||
[@bs.obj] | ||
external makeProps: | ||
( | ||
~name: string, | ||
~options: optionsProps=?, | ||
~initialParams: M.params=?, | ||
~component: React.component({. "navigation": navigation}), | ||
unit | ||
) => | ||
screenProps = | ||
""; | ||
let make = stack##"Screen"; | ||
}; | ||
|
||
module Navigator = { | ||
[@bs.obj] | ||
external makeProps: | ||
( | ||
~initialRouteName: string=?, | ||
~screenOptions: optionsProps=?, | ||
~children: React.element, | ||
~_lazy: bool=?, | ||
~tabBarComponent: React.component(Js.t(bottomTabBarProps))=?, | ||
~tabBarOptions: bottomTabBarOptions=?, | ||
unit | ||
) => | ||
navigatorProps = | ||
""; | ||
|
||
let make = stack##"Navigator"; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
'use strict'; | ||
|
||
var Caml_option = require("bs-platform/lib/js/caml_option.js"); | ||
|
||
function NavigationHelpersCommon(M) { | ||
var navigateByKey = function (key, params, unit) { | ||
var tmp = { | ||
key: key | ||
}; | ||
if (params !== undefined) { | ||
tmp.params = Caml_option.valFromOption(params); | ||
} | ||
tmp.navigate(); | ||
return /* () */0; | ||
}; | ||
var navigateByName = function (name, key, params, unit) { | ||
var tmp = { | ||
name: name | ||
}; | ||
if (key !== undefined) { | ||
tmp.key = Caml_option.valFromOption(key); | ||
} | ||
if (params !== undefined) { | ||
tmp.params = Caml_option.valFromOption(params); | ||
} | ||
tmp.navigate(); | ||
return /* () */0; | ||
}; | ||
return { | ||
navigateByKey: navigateByKey, | ||
navigateByName: navigateByName | ||
}; | ||
} | ||
|
||
function EventConsumer(M) { | ||
return { }; | ||
} | ||
|
||
function NavigationScreenProp(M) { | ||
var navigateByKey = function (key, params, unit) { | ||
var tmp = { | ||
key: key | ||
}; | ||
if (params !== undefined) { | ||
tmp.params = Caml_option.valFromOption(params); | ||
} | ||
tmp.navigate(); | ||
return /* () */0; | ||
}; | ||
var navigateByName = function (name, key, params, unit) { | ||
var tmp = { | ||
name: name | ||
}; | ||
if (key !== undefined) { | ||
tmp.key = Caml_option.valFromOption(key); | ||
} | ||
if (params !== undefined) { | ||
tmp.params = Caml_option.valFromOption(params); | ||
} | ||
tmp.navigate(); | ||
return /* () */0; | ||
}; | ||
return { | ||
navigateByKey: navigateByKey, | ||
navigateByName: navigateByName | ||
}; | ||
} | ||
|
||
exports.NavigationHelpersCommon = NavigationHelpersCommon; | ||
exports.EventConsumer = EventConsumer; | ||
exports.NavigationScreenProp = NavigationScreenProp; | ||
/* No side effect */ |
Oops, something went wrong.