2015-03-05 16:36:41 -08:00
|
|
|
/**
|
2015-03-23 13:35:08 -07: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-05 16:36:41 -08:00
|
|
|
*
|
|
|
|
* @providesModule TabBarIOS
|
2015-03-25 12:55:10 -07:00
|
|
|
* @flow
|
2015-03-05 16:36:41 -08:00
|
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
|
2015-12-22 19:29:01 -08:00
|
|
|
var ColorPropType = require('ColorPropType');
|
2015-03-05 16:36:41 -08:00
|
|
|
var React = require('React');
|
2017-04-12 16:09:48 -07:00
|
|
|
const PropTypes = require('prop-types');
|
2015-03-05 16:36:41 -08:00
|
|
|
var StyleSheet = require('StyleSheet');
|
2015-04-02 13:35:03 -07:00
|
|
|
var TabBarItemIOS = require('TabBarItemIOS');
|
2017-03-24 00:22:57 -07:00
|
|
|
const ViewPropTypes = require('ViewPropTypes');
|
2015-03-05 16:36:41 -08:00
|
|
|
|
2015-04-21 21:07:17 -07:00
|
|
|
var requireNativeComponent = require('requireNativeComponent');
|
2015-03-05 16:36:41 -08:00
|
|
|
|
2016-07-26 01:00:02 -07:00
|
|
|
class TabBarIOS extends React.Component {
|
|
|
|
props: {
|
|
|
|
style?: $FlowFixMe,
|
|
|
|
unselectedTintColor?: $FlowFixMe,
|
|
|
|
tintColor?: $FlowFixMe,
|
2016-11-29 12:14:41 -08:00
|
|
|
unselectedItemTintColor?: $FlowFixMe,
|
2016-07-26 01:00:02 -07:00
|
|
|
barTintColor?: $FlowFixMe,
|
|
|
|
translucent?: boolean,
|
|
|
|
itemPositioning?: 'fill' | 'center' | 'auto',
|
|
|
|
};
|
2015-04-02 13:35:03 -07:00
|
|
|
|
2016-07-26 01:00:02 -07:00
|
|
|
static Item = TabBarItemIOS;
|
|
|
|
|
2017-03-04 19:29:24 -08:00
|
|
|
// $FlowFixMe(>=0.41.0)
|
2016-07-26 01:00:02 -07:00
|
|
|
static propTypes = {
|
2017-03-24 00:22:57 -07:00
|
|
|
...ViewPropTypes,
|
|
|
|
style: ViewPropTypes.style,
|
2016-05-03 05:39:21 -07:00
|
|
|
/**
|
|
|
|
* Color of text on unselected tabs
|
|
|
|
*/
|
|
|
|
unselectedTintColor: ColorPropType,
|
2015-05-26 16:40:56 -07:00
|
|
|
/**
|
|
|
|
* Color of the currently selected tab icon
|
|
|
|
*/
|
2015-12-22 19:29:01 -08:00
|
|
|
tintColor: ColorPropType,
|
2016-11-29 12:14:41 -08:00
|
|
|
/**
|
|
|
|
* Color of unselected tab icons. Available since iOS 10.
|
|
|
|
*/
|
|
|
|
unselectedItemTintColor: ColorPropType,
|
2015-05-26 16:40:56 -07:00
|
|
|
/**
|
|
|
|
* Background color of the tab bar
|
|
|
|
*/
|
2015-12-22 19:29:01 -08:00
|
|
|
barTintColor: ColorPropType,
|
2015-07-14 08:05:08 -07:00
|
|
|
/**
|
|
|
|
* A Boolean value that indicates whether the tab bar is translucent
|
|
|
|
*/
|
2017-04-12 16:09:48 -07:00
|
|
|
translucent: PropTypes.bool,
|
2016-05-20 17:17:29 -07: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.
|
|
|
|
*/
|
2017-04-12 16:09:48 -07:00
|
|
|
itemPositioning: PropTypes.oneOf(['fill', 'center', 'auto']),
|
2016-07-26 01:00:02 -07:00
|
|
|
};
|
2015-04-02 13:35:03 -07:00
|
|
|
|
2016-07-26 01:00:02 -07:00
|
|
|
render() {
|
2015-03-05 16:36:41 -08:00
|
|
|
return (
|
2015-05-26 16:40:56 -07:00
|
|
|
<RCTTabBar
|
|
|
|
style={[styles.tabGroup, this.props.style]}
|
2016-05-03 05:39:21 -07:00
|
|
|
unselectedTintColor={this.props.unselectedTintColor}
|
2016-11-29 12:14:41 -08:00
|
|
|
unselectedItemTintColor={this.props.unselectedItemTintColor}
|
2015-05-26 16:40:56 -07:00
|
|
|
tintColor={this.props.tintColor}
|
2015-07-14 08:05:08 -07:00
|
|
|
barTintColor={this.props.barTintColor}
|
2016-05-20 17:17:29 -07:00
|
|
|
itemPositioning={this.props.itemPositioning}
|
2015-07-14 08:05:08 -07:00
|
|
|
translucent={this.props.translucent !== false}>
|
2016-07-26 01:00:02 -07:00
|
|
|
{
|
|
|
|
// $FlowFixMe found when converting React.createClass to ES6
|
|
|
|
this.props.children}
|
2015-03-17 03:08:46 -07:00
|
|
|
</RCTTabBar>
|
2015-03-05 16:36:41 -08:00
|
|
|
);
|
|
|
|
}
|
2016-07-26 01:00:02 -07:00
|
|
|
}
|
2015-03-05 16:36:41 -08:00
|
|
|
|
|
|
|
var styles = StyleSheet.create({
|
|
|
|
tabGroup: {
|
|
|
|
flex: 1,
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-04-21 21:07:17 -07:00
|
|
|
var RCTTabBar = requireNativeComponent('RCTTabBar', TabBarIOS);
|
2015-03-05 16:36:41 -08:00
|
|
|
|
|
|
|
module.exports = TabBarIOS;
|