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');
|
2017-04-12 23:09:48 +00:00
|
|
|
const PropTypes = require('prop-types');
|
2015-03-06 00:36:41 +00:00
|
|
|
var StyleSheet = require('StyleSheet');
|
2015-04-02 20:35:03 +00:00
|
|
|
var TabBarItemIOS = require('TabBarItemIOS');
|
2017-03-24 07:22:57 +00:00
|
|
|
const ViewPropTypes = require('ViewPropTypes');
|
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
|
|
|
|
2017-08-18 01:36:54 +00:00
|
|
|
class TabBarIOS extends React.Component<{
|
|
|
|
style?: $FlowFixMe,
|
|
|
|
unselectedTintColor?: $FlowFixMe,
|
|
|
|
tintColor?: $FlowFixMe,
|
|
|
|
unselectedItemTintColor?: $FlowFixMe,
|
|
|
|
barTintColor?: $FlowFixMe,
|
2017-08-25 07:03:17 +00:00
|
|
|
barStyle?: 'default' | 'black',
|
2017-08-18 01:36:54 +00:00
|
|
|
translucent?: boolean,
|
|
|
|
itemPositioning?: 'fill' | 'center' | 'auto',
|
|
|
|
}> {
|
2016-07-26 08:00:02 +00:00
|
|
|
static Item = TabBarItemIOS;
|
|
|
|
|
2017-03-05 03:29:24 +00:00
|
|
|
// $FlowFixMe(>=0.41.0)
|
2016-07-26 08:00:02 +00:00
|
|
|
static propTypes = {
|
2017-03-24 07:22:57 +00:00
|
|
|
...ViewPropTypes,
|
|
|
|
style: ViewPropTypes.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,
|
2016-11-29 20:14:41 +00:00
|
|
|
/**
|
|
|
|
* Color of unselected tab icons. Available since iOS 10.
|
|
|
|
*/
|
|
|
|
unselectedItemTintColor: 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,
|
2017-08-25 07:03:17 +00:00
|
|
|
/**
|
|
|
|
* The style of the tab bar. Supported values are 'default', 'black'.
|
|
|
|
* Use 'black' instead of setting `barTintColor` to black. This produces
|
|
|
|
* a tab bar with the native iOS style with higher translucency.
|
|
|
|
*/
|
|
|
|
barStyle: PropTypes.oneOf(['default', 'black']),
|
2015-07-14 15:05:08 +00:00
|
|
|
/**
|
|
|
|
* A Boolean value that indicates whether the tab bar is translucent
|
|
|
|
*/
|
2017-04-12 23:09:48 +00:00
|
|
|
translucent: 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.
|
|
|
|
*/
|
2017-04-12 23:09:48 +00:00
|
|
|
itemPositioning: 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}
|
2016-11-29 20:14:41 +00:00
|
|
|
unselectedItemTintColor={this.props.unselectedItemTintColor}
|
2015-05-26 23:40:56 +00:00
|
|
|
tintColor={this.props.tintColor}
|
2015-07-14 15:05:08 +00:00
|
|
|
barTintColor={this.props.barTintColor}
|
2017-08-25 07:03:17 +00:00
|
|
|
barStyle={this.props.barStyle}
|
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;
|