Original file line numberDiff line numberDiff line change
Expand Up@@ -31,7 +31,7 @@ yarn add rescript-react-navigation
```

`rescript-react-navigation` should be added to `bs-dependencies` in your
`bsconfig.json`:
`rescript.json`:

```diff
{
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,6 +6,16 @@ open ReactNative

type tabBarLabelPosition = [#"below-icon" | #"beside-icon"]

type tabBarPosition = [#bottom | #top | #left | #right]

type tabBarVariant = [#uikit | #material]

type animation = [
| #fade
| #shift
| #none
]

type tabBarIconOptions = {
focused: bool,
color: string,
Expand All@@ -29,9 +39,8 @@ type rec options = {
tabBarBadge?: string,
tabBarBadgeStyle?: Style.t,
tabBarAccessibilityLabel?: string,
tabBarTestID?: string,
tabBarButtonTestID?: string,
tabBarButton?: unit => React.element, // TODO: props
tabBarColor?: Color.t,
tabBarActiveTintColor?: string,
tabBarInactiveTintColor?: string,
tabBarActiveBackgroundColor?: string,
Expand All@@ -40,11 +49,15 @@ type rec options = {
tabBarItemStyle?: Style.t,
tabBarStyle?: Style.t,
tabBarBackground?: unit => React.element,
tabBarPosition?: tabBarPosition,
tabBarVariant?: tabBarVariant,
sceneStyle?: Style.t,
\"lazy"?: bool,
unmountOnBlur?: bool,
popToTopOnBlur?: bool,
freezeOnBlur?: bool,
header?: headerParams => React.element,
headerShown?: bool,
animation?: animation,
// Header props from https://reactnavigation.org/docs/elements#header
headerTitle?: Header.headerTitle,
headerTitleAlign?: Header.headerTitleAlign,
Expand DownExpand Up@@ -82,8 +95,8 @@ module type NavigatorModule = {
~screenOptions: screenOptionsParams => options=?,
~backBehavior: backBehavior=?,
~detachInactiveScreens: bool=?,
~sceneContainerStyle: Style.t=?,
~tabBar: unit => React.element=?,
~layout: layoutNavigatorParams => React.element=?,
~children: React.element,
) => React.element
}
Expand DownExpand Up@@ -124,8 +137,8 @@ type navigatorModule
module Make = () => unpack(createBottomTabNavigator()->adaptNavigatorModule)

module Navigation = {
@send external jumpTo: (navigation, string) => unit = "jumpTo"
@send
@send external jumpTo: (navigation, string, ~params: 'params=?) => unit = "jumpTo"
@deprecated("Use `jumpTo` with `~params` instead") @send
external jumpToWithParams: (navigation, string, 'params) => unit = "jumpTo"

@send
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -45,14 +45,14 @@ type rec options = {
drawerHideStatusBarOnOpen?: bool,
drawerStatusBarAnimation?: drawerStatusBarAnimation,
overlayColor?: Color.t,
sceneContainerStyle?: Style.t,
sceneStyle?: Style.t,
gestureEnabled?: bool,
gestureHandlerProps?: gestureHandlerProps,
swipeEnabled?: bool,
swipeEdgeWidth?: float,
swipeMinDistance?: float,
keyboardDismissMode?: keyboardDismissMode,
unmountOnBlur?: bool,
popToTopOnBlur?: bool,
freezeOnBlur?: bool,
headerShown?: bool,
header?: headerProps => React.element,
Expand DownExpand Up@@ -104,6 +104,7 @@ module type NavigatorModule = {
~detachInactiveScreens: bool=?,
~useLegacyImplementation: bool=?,
~drawerContent: React.component<contentComponentProps>=?,
~layout: layoutNavigatorParams => React.element=?,
~children: React.element=?,
) => React.element
}
Expand DownExpand Up@@ -147,7 +148,7 @@ module Navigation = {
@send
external setOptions: (navigation, options) => unit = "setOptions"

@send external jumpTo: (navigation, ~name: string, ~params: 'params=?, unit) => unit = "jumpTo"
@send external jumpTo: (navigation, ~name: string, ~params: 'params=?) => unit = "jumpTo"
@send external openDrawer: navigation => unit = "openDrawer"
@send external closeDrawer: navigation => unit = "closeDrawer"
@send external toggleDrawer: navigation => unit = "toggleDrawer"
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,9 +5,15 @@ var Header = {};

var HeaderBackground = {};

var HeaderTitle = {};

var HeaderButton = {};

var HeaderBackButton = {};

exports.Header = Header;
exports.HeaderBackground = HeaderBackground;
exports.HeaderTitle = HeaderTitle;
exports.HeaderButton = HeaderButton;
exports.HeaderBackButton = HeaderBackButton;
/* No side effect */
Loading
Loading