Skip to content

Commit

Permalink
Improve stack and material top tabs (#51)
Browse files Browse the repository at this point in the history
* Improve `Stack` by adding:
- `headerBackTestID` screen option
- `getId` screen prop

* Add `swipeEnabled` option to `MaterialTopTabs`
  • Loading branch information
reck753 authored Apr 13, 2022
1 parent 289a117 commit b77432d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/MaterialTopTabs.res
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ module Make = (
~tabBarTestID: string=?,
~_lazy: bool=?,
~lazyPlaceholder: React.component<{"route": route}>=?,
~swipeEnabled: bool=?,
~tabBarActiveTintColor: string=?,
~tabBarInactiveTintColor: string=?,
~tabBarPressColor: string=?,
Expand Down Expand Up @@ -224,6 +225,8 @@ module Make = (
| @as("on-drag") #onDrag
| #none
]=?,
// Setting `swipeEnabled` through props is deprecated.
// Set it through screen options instead!
~swipeEnabled: bool=?,
~swipeVelocityImpact: float=?,
~sceneContainerStyle: ReactNative.Style.t=?,
Expand Down
7 changes: 7 additions & 0 deletions src/Stack.res
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ module Make = (
~headerBackAllowFontScaling: bool=?,
~headerBackground: headerBackgroundOptions => React.element=?,
~headerBackImage: backImage=?,
~headerBackTestID: string=?,
~headerBackTitle: string=?,
~headerBackTitleStyle: ReactNative.Style.t=?,
~headerBackTitleVisible: bool=?,
Expand Down Expand Up @@ -260,6 +261,9 @@ module Make = (
}
type optionsCallback = optionsProps => options

type getIdProps = {params: M.params}
type getIdCallback = getIdProps => option<string>

type groupProps = {screenOptions: option<optionsCallback>}

type navigatorProps = {
Expand All @@ -273,6 +277,7 @@ module Make = (
type screenProps<'params> = {
name: string,
options: option<optionsCallback>,
getId: option<getIdCallback>,
initialParams: option<'params>,
component: option<React.component<{"navigation": navigation, "route": route}>>,
children: option<renderCallbackProp => React.element>,
Expand All @@ -291,6 +296,7 @@ module Make = (
external makeProps: (
~name: string,
~options: optionsCallback=?,
~getId: getIdCallback=?,
~initialParams: M.params=?,
~children: renderCallbackProp => React.element,
~key: string=?,
Expand All @@ -304,6 +310,7 @@ module Make = (
external makeProps: (
~name: string,
~options: optionsCallback=?,
~getId: getIdCallback=?,
~initialParams: M.params=?,
~component: React.component<{"navigation": navigation, "route": route}>,
~key: string=?,
Expand Down

0 comments on commit b77432d

Please sign in to comment.