2015-03-06 00:36:41 +00:00
|
|
|
/**
|
2015-03-23 20:35:08 +00:00
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the BSD-style license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
2015-03-06 00:36:41 +00:00
|
|
|
*
|
|
|
|
* @providesModule TabBarIOS
|
2015-03-25 19:55:10 +00:00
|
|
|
* @flow
|
2015-03-06 00:36:41 +00:00
|
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
|
2015-12-23 03:29:01 +00:00
|
|
|
var ColorPropType = require('ColorPropType');
|
2015-03-06 00:36:41 +00:00
|
|
|
var React = require('React');
|
|
|
|
var StyleSheet = require('StyleSheet');
|
2015-04-02 20:35:03 +00:00
|
|
|
var TabBarItemIOS = require('TabBarItemIOS');
|
|
|
|
var View = require('View');
|
2015-03-06 00:36:41 +00:00
|
|
|
|
2015-04-22 04:07:17 +00:00
|
|
|
var requireNativeComponent = require('requireNativeComponent');
|
2015-03-06 00:36:41 +00:00
|
|
|
|
2016-07-26 08:00:02 +00:00
|
|
|
class TabBarIOS extends React.Component {
|
|
|
|
props: {
|
|
|
|
style?: $FlowFixMe,
|
|
|
|
unselectedTintColor?: $FlowFixMe,
|
|
|
|
tintColor?: $FlowFixMe,
|
|
|
|
barTintColor?: $FlowFixMe,
|
|
|
|
translucent?: boolean,
|
|
|
|
itemPositioning?: 'fill' | 'center' | 'auto',
|
|
|
|
};
|
2015-04-02 20:35:03 +00:00
|
|
|
|
2016-07-26 08:00:02 +00:00
|
|
|
static Item = TabBarItemIOS;
|
|
|
|
|
|
|
|
static propTypes = {
|
2015-11-18 19:34:05 +00:00
|
|
|
...View.propTypes,
|
2015-04-02 20:35:03 +00:00
|
|
|
style: View.propTypes.style,
|
2016-05-03 12:39:21 +00:00
|
|
|
/**
|
|
|
|
* Color of text on unselected tabs
|
|
|
|
*/
|
|
|
|
unselectedTintColor: ColorPropType,
|
2015-05-26 23:40:56 +00:00
|
|
|
/**
|
|
|
|
* Color of the currently selected tab icon
|
|
|
|
*/
|
2015-12-23 03:29:01 +00:00
|
|
|
tintColor: ColorPropType,
|
2015-05-26 23:40:56 +00:00
|
|
|
/**
|
|
|
|
* Background color of the tab bar
|
|
|
|
*/
|
2015-12-23 03:29:01 +00:00
|
|
|
barTintColor: ColorPropType,
|
2015-07-14 15:05:08 +00:00
|
|
|
/**
|
|
|
|
* A Boolean value that indicates whether the tab bar is translucent
|
|
|
|
*/
|
|
|
|
translucent: React.PropTypes.bool,
|
2016-05-21 00:17:29 +00:00
|
|
|
/**
|
|
|
|
* Specifies tab bar item positioning. Available values are:
|
|
|
|
* - fill - distributes items across the entire width of the tab bar
|
|
|
|
* - center - centers item in the available tab bar space
|
|
|
|
* - auto (default) - distributes items dynamically according to the
|
|
|
|
* user interface idiom. In a horizontally compact environment (e.g. iPhone 5)
|
|
|
|
* this value defaults to `fill`, in a horizontally regular one (e.g. iPad)
|
|
|
|
* it defaults to center.
|
|
|
|
*/
|
|
|
|
itemPositioning: React.PropTypes.oneOf(['fill', 'center', 'auto']),
|
2016-07-26 08:00:02 +00:00
|
|
|
};
|
2015-04-02 20:35:03 +00:00
|
|
|
|
2016-07-26 08:00:02 +00:00
|
|
|
render() {
|
2015-03-06 00:36:41 +00:00
|
|
|
return (
|
2015-05-26 23:40:56 +00:00
|
|
|
<RCTTabBar
|
|
|
|
style={[styles.tabGroup, this.props.style]}
|
2016-05-03 12:39:21 +00:00
|
|
|
unselectedTintColor={this.props.unselectedTintColor}
|
2015-05-26 23:40:56 +00:00
|
|
|
tintColor={this.props.tintColor}
|
2015-07-14 15:05:08 +00:00
|
|
|
barTintColor={this.props.barTintColor}
|
2016-05-21 00:17:29 +00:00
|
|
|
itemPositioning={this.props.itemPositioning}
|
2015-07-14 15:05:08 +00:00
|
|
|
translucent={this.props.translucent !== false}>
|
2016-07-26 08:00:02 +00:00
|
|
|
{
|
|
|
|
// $FlowFixMe found when converting React.createClass to ES6
|
|
|
|
this.props.children}
|
2015-03-17 10:08:46 +00:00
|
|
|
</RCTTabBar>
|
2015-03-06 00:36:41 +00:00
|
|
|
);
|
|
|
|
}
|
2016-07-26 08:00:02 +00:00
|
|
|
}
|
2015-03-06 00:36:41 +00:00
|
|
|
|
|
|
|
var styles = StyleSheet.create({
|
|
|
|
tabGroup: {
|
|
|
|
flex: 1,
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-04-22 04:07:17 +00:00
|
|
|
var RCTTabBar = requireNativeComponent('RCTTabBar', TabBarIOS);
|
2015-03-06 00:36:41 +00:00
|
|
|
|
|
|
|
module.exports = TabBarIOS;
|