From 9069a530b03b264ced8fd5815faa2731cb85daa6 Mon Sep 17 00:00:00 2001 From: Liangyu Date: Mon, 22 May 2017 11:08:37 +0800 Subject: [PATCH] fix some bugs --- components/SegmentedBar/SegmentedItem.js | 2 +- components/SegmentedView/SegmentedSheet.js | 6 ++++-- components/SegmentedView/SegmentedView.js | 13 +++++++++++-- docs/cn/SegmentedView.md | 9 --------- example/views/SegmentedViewExample.js | 5 ++++- package.json | 2 +- 6 files changed, 21 insertions(+), 16 deletions(-) diff --git a/components/SegmentedBar/SegmentedItem.js b/components/SegmentedBar/SegmentedItem.js index ab4039b..c732a2f 100644 --- a/components/SegmentedBar/SegmentedItem.js +++ b/components/SegmentedBar/SegmentedItem.js @@ -51,7 +51,7 @@ export default class SegmentedItem extends Component { textStyle = [{ color: Theme.sbBtnActiveTitleColor, fontSize: Theme.sbBtnActiveTextFontSize, - }].concat(titleStyle).concat(activeTitleStyle); + }].concat(activeTitleStyle); } else { textStyle = [{ color: Theme.sbBtnTitleColor, diff --git a/components/SegmentedView/SegmentedSheet.js b/components/SegmentedView/SegmentedSheet.js index 5db419f..6dccc1d 100644 --- a/components/SegmentedView/SegmentedSheet.js +++ b/components/SegmentedView/SegmentedSheet.js @@ -3,7 +3,7 @@ 'use strict'; import React, {Component, PropTypes} from 'react'; -import {View} from 'react-native'; +import {View, Text} from 'react-native'; import Theme from 'teaset/themes/Theme'; @@ -12,11 +12,13 @@ export default class SegmentedSheet extends Component { static propTypes = { ...View.propTypes, title: PropTypes.oneOfType([PropTypes.element, PropTypes.string, PropTypes.number]).isRequired, + titleStyle: Text.propTypes.style, + activeTitleStyle: Text.propTypes.style, badge: PropTypes.oneOfType([PropTypes.element, PropTypes.string, PropTypes.number]), }; render() { - let {style, ...others} = this.props; + let {style, title, titleStyle, activeTitleStyle, badge, ...others} = this.props; style = [{flexGrow: 1}].concat(style); return ; } diff --git a/components/SegmentedView/SegmentedView.js b/components/SegmentedView/SegmentedView.js index 7117e3e..691daed 100644 --- a/components/SegmentedView/SegmentedView.js +++ b/components/SegmentedView/SegmentedView.js @@ -86,7 +86,7 @@ export default class SegmentedView extends Component { } renderBar() { - let {barPosition, barStyle, justifyItem, indicatorType, indicatorPosition, animated, autoScroll, onChange, children} = this.props; + let {barPosition, barStyle, justifyItem, indicatorType, indicatorPosition, indicatorLineColor, indicatorLineWidth, indicatorPositionPadding, animated, autoScroll, onChange, children} = this.props; if (!indicatorPosition && barPosition == 'bottom') { indicatorPosition = 'top'; @@ -98,13 +98,22 @@ export default class SegmentedView extends Component { justifyItem={justifyItem} indicatorType={indicatorType} indicatorPosition={indicatorPosition} + indicatorLineColor={indicatorLineColor} + indicatorLineWidth={indicatorLineWidth} + indicatorPositionPadding={indicatorPositionPadding} animated={animated} autoScroll={autoScroll} activeIndex={this.activeIndex} onChange={index => this.onSegmentedBarChange(index)} > {children.map((item, index) => ( - + ))} ); diff --git a/docs/cn/SegmentedView.md b/docs/cn/SegmentedView.md index e6e5f8b..79923d5 100644 --- a/docs/cn/SegmentedView.md +++ b/docs/cn/SegmentedView.md @@ -28,7 +28,6 @@ SegmentedView 组件定义一个分段器组件, 一般用于同一页面中多 | Prop | Type | Default | Note | |---|---|---|---| | [Sheet](#segmentedviewsheet--props) | class | | 分段器 Sheet 组件。 -| [Button](#segmentedviewbutton--props) | class | | 分段器按钮组件。
此组件由 Sheet 组件自动渲染, 无须代码显式声明, 但可以修改 SegmentedView.Button 为自定义类以更改分段器按钮组件。