Skip to content

Commit

Permalink
Added TabBarIOS and TabBarItemIOS (facebook#50)
Browse files Browse the repository at this point in the history
* Added TabBarIOS and TabBarItemIOS

* Updated status.md

* Added interface files for tabBar

* Renamed tabbar components

* Added types to tabBarIOS
  • Loading branch information
lpalmes authored and saschatimme committed Aug 2, 2017
1 parent 371989f commit 978f42c
Show file tree
Hide file tree
Showing 7 changed files with 138 additions and 11 deletions.
4 changes: 2 additions & 2 deletions STATUS.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
- [ ] SnapshotViewIOS
- [x] StatusBar
- [x] Switch
- [ ] TabBarIOS
- [ ] TabBarIOS.Item
- [x] TabBarIOS
- [x] TabBarIOS.Item
- [x] Text
- [x] TextInput
- [ ] ToolbarAndroid
Expand Down
2 changes: 1 addition & 1 deletion src/appStateRe.re
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ external addEventListener : string => (unit => unit) => unit =
"" [@@bs.scope "AppState"] [@@bs.module "react-native"];

external removeEventListener : string => (unit => unit) => unit =
"" [@@bs.scope "AppState"] [@@bs.module "react-native"];
"" [@@bs.scope "AppState"] [@@bs.module "react-native"];
36 changes: 36 additions & 0 deletions src/components/tabBarIOSRe.re
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
external tabBarIOS : ReasonReact.reactClass = "TabBarIOS" [@@bs.module "react-native"];

let make
::barTintColor=?
::itemPositioning=?
::style=?
::tintColor=?
::translucent=?
::unselectedItemTintColor=?
::unselectedTintColor=? =>
ReasonReact.wrapJsForReason
reactClass::tabBarIOS
props::
Js.Undefined.(
{
"barTintColor": from_opt barTintColor,
"itemPositioning":
from_opt (
UtilsRN.option_map
(
fun x =>
switch x {
| `default => "default"
| `lightContent => "light-content"
| `darkContent => "dark-content"
}
)
itemPositioning
),
"style": from_opt style,
"tintColor": from_opt tintColor,
"translucent": from_opt (UtilsRN.optBoolToOptJsBoolean translucent),
"unselectedItemTintColor": from_opt unselectedItemTintColor,
"unselectedTintColor": from_opt unselectedTintColor
}
);
10 changes: 10 additions & 0 deletions src/components/tabBarIOSRe.rei
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
let make:
barTintColor::string? =>
itemPositioning::[ | `fill | `center | `auto]? =>
style::StyleRe.t? =>
tintColor::string? =>
translucent::bool? =>
unselectedItemTintColor::string? =>
unselectedTintColor::string? =>
array ReasonReact.reactElement =>
ReasonReact.component ReasonReact.stateless ReasonReact.noRetainedProps;
31 changes: 31 additions & 0 deletions src/components/tabBarItemIOSRe.re
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
external tabBarItemIOS : ReasonReact.reactClass =
"Item" [@@bs.scope "TabBarIOS"] [@@bs.module "react-native"];

let make
title::(title: option string)=?
badgeColor::(badgeColor: option string)=?
::badge=?
::icon=?
::onPress=?
::renderAsOriginal=?
::style=?
::selected=?
::selectedIcon=?
::isTVSelectable=? =>
ReasonReact.wrapJsForReason
reactClass::tabBarItemIOS
props::
Js.Undefined.(
{
"badgeColor": from_opt badgeColor,
"title": from_opt title,
"badge": from_opt badge,
"icon": from_opt icon,
"onPress": from_opt onPress,
"renderAsOriginal": from_opt (UtilsRN.optBoolToOptJsBoolean renderAsOriginal),
"selected": from_opt (UtilsRN.optBoolToOptJsBoolean selected),
"selectedIcon": from_opt selectedIcon,
"style": from_opt style,
"isTVSelectable": from_opt (UtilsRN.optBoolToOptJsBoolean isTVSelectable)
}
);
13 changes: 13 additions & 0 deletions src/components/tabBarItemIOSRe.rei
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
let make:
title::string? =>
badgeColor::string? =>
badge::string? =>
icon::ImageRe.Image.imageSource? =>
onPress::'c? =>
renderAsOriginal::bool? =>
style::StyleRe.t? =>
selected::bool? =>
selectedIcon::ImageRe.Image.imageSource? =>
isTVSelectable::bool? =>
array ReasonReact.reactElement =>
ReasonReact.component ReasonReact.stateless ReasonReact.noRetainedProps;
53 changes: 45 additions & 8 deletions src/reactNative.re
Original file line number Diff line number Diff line change
@@ -1,63 +1,100 @@
/**
* Components
*/

module ActivityIndicator = ActivityIndicatorRe;

module Button = ButtonRe;

module DatePickerIOS = DatePickerIOSRe;

module FlatList = FlatListRe;

module Modal = ModalRe;

module Picker = PickerRe;

module RefreshControl = RefreshControlRe;

module ScrollView = ScrollViewRe.ScrollView;

module SectionList = SectionListRe;

module Slider = SliderRe;

module StatusBar = StatusBarRe;

module Switch = SwitchRe;

module TabBarIOS = TabBarIOSRe;

module TabBarItemIOS = TabBarItemIOSRe;

module Text = TextRe.Text;

module TextInput = TextInputRe;

module TouchableHighlight = TouchableHighlightRe;

module TouchableOpacity = TouchableOpacityRe;

module TouchableWithoutFeedback = TouchableWithoutFeedbackRe;

module WebView = WebViewRe;

module View = {
include ViewRe.View;
include ResponderUtils;
};

module Image = ImageRe.Image;

module Animated = {
include AnimatedRe;
module Text = AnimatedComponentsRe.Text;
module ScrollView = AnimatedComponentsRe.ScrollView;
module View = AnimatedComponentsRe.View;
module Image = AnimatedComponentsRe.Image;
include AnimatedRe;
module Text = AnimatedComponentsRe.Text;
module ScrollView = AnimatedComponentsRe.ScrollView;
module View = AnimatedComponentsRe.View;
module Image = AnimatedComponentsRe.Image;
};


/**
* APIs
*/

module Alert = AlertRe;

module AlertIOS = AlertIOSRe;

module AppRegistry = AppRegistryRe;

module AppState = AppStateRe;

module AsyncStorage = AsyncStorageRe;

module BackHandler = BackHandlerRe;

module Dimensions = DimensionsRe;

module Linking = LinkingRe;

module NativeModules = NativeModulesRe;

module NativeEventEmitter = NativeEventEmitterRe;

module Platform = PlatformRe;

module StyleSheet = StyleSheetRe;

module PanResponder = {
include PanResponderRe;
include PanResponderUtils;
};

module Vibration = VibrationRe;


/**
* New Modules due to Reason
*/

module Packager = PackagerRe;

module Style = StyleRe;

0 comments on commit 978f42c

Please sign in to comment.