mx-artifacts
Advanced tools
Comparing version 0.0.15 to 0.0.16
@@ -13,7 +13,8 @@ /** | ||
let groupDataName = this.props.groupDataName; | ||
let items = !!this.props.data && !!this.props.data[groupDataName]? this.props.data[groupDataName].length : 0 ; //TODO: 异常判断 数据名称 | ||
return { | ||
itemHeight:this.props.itemHeight, | ||
open: false, | ||
fadeAnim: new Animated.Value(0), | ||
items: !!this.props.data && !!this.props.data[groupDataName]? this.props.data[groupDataName].length : 0 //TODO: 异常判断 数据名称 | ||
open: this.props.isOpen, | ||
fadeAnim: this.props.isOpen?new Animated.Value(items * this.props.itemHeight):new Animated.Value(0), | ||
items: items, | ||
}; | ||
@@ -25,5 +26,5 @@ }, | ||
let items = !!nextProps.data && !!nextProps.data[groupDataName]? nextProps.data[groupDataName].length : 0; | ||
this.setState({items: items}); | ||
this.setState({items: items,open:nextProps.isOpen}); | ||
if(this.state.open) | ||
if(this.state.open || nextProps.isOpen) | ||
if(Platform.OS == 'ios'){ | ||
@@ -35,2 +36,9 @@ Animated.timing( // Uses easing functions | ||
} | ||
if(!nextProps.isOpen){ | ||
Animated.timing( // Uses easing functions | ||
this.state.fadeAnim, // The value to drive | ||
{toValue: 0, duration: 0} // Configuration | ||
).start(); | ||
} | ||
}, | ||
@@ -37,0 +45,0 @@ |
@@ -23,6 +23,6 @@ /** | ||
groupRender: function(dataSource, groupItemRender, groupTitleRender ,groupDataName, itemHeight, groundColor, arrowColor, groupTitleColor, titleBorderColor) { | ||
groupRender: function(dataSource, groupItemRender, groupTitleRender ,groupDataName, itemHeight, groundColor, arrowColor, groupTitleColor, titleBorderColor, isOpen) { | ||
let groups = []; | ||
for(let j=0 ;!!dataSource && !!dataSource.length && j < dataSource.length ; j++){ | ||
groups.push(<ItemsGroup key={j} index={j} titleBorderColor={titleBorderColor} groupTitleColor={groupTitleColor} arrowColor={arrowColor} groundColor={groundColor} itemHeight={itemHeight} data={dataSource[j]} titleRender={groupTitleRender} itemRender={groupItemRender} groupDataName={groupDataName}/>); | ||
groups.push(<ItemsGroup key={j} index={j} titleBorderColor={titleBorderColor} groupTitleColor={groupTitleColor} arrowColor={arrowColor} groundColor={groundColor} itemHeight={itemHeight} data={dataSource[j]} titleRender={groupTitleRender} itemRender={groupItemRender} groupDataName={groupDataName} isOpen={isOpen}/>); | ||
} | ||
@@ -33,7 +33,7 @@ return groups; | ||
render: function() { | ||
let {dataSource, groupItemRender, groupTitleRender, groupDataName, itemHeight, groundColor, arrowColor, groupTitleColor, groupBorderColor, titleBorderColor} = this.props; | ||
let {dataSource, groupItemRender, groupTitleRender, groupDataName, itemHeight, groundColor, arrowColor, groupTitleColor, groupBorderColor, titleBorderColor,isOpen} = this.props; | ||
let height = itemHeight; | ||
return ( | ||
<ScrollView style={{flexDirection: 'column', backgroundColor:groundColor}}> | ||
{this.groupRender(dataSource, groupItemRender, groupTitleRender, groupDataName, itemHeight, groundColor, arrowColor, groupTitleColor, titleBorderColor)} | ||
{this.groupRender(dataSource, groupItemRender, groupTitleRender, groupDataName, itemHeight, groundColor, arrowColor, groupTitleColor, titleBorderColor, isOpen)} | ||
<View style={{backgroundColor:groupTitleColor,height:height,borderTopWidth:1,borderColor: groupBorderColor}}></View> | ||
@@ -40,0 +40,0 @@ </ScrollView> |
{ | ||
"name": "mx-artifacts", | ||
"version": "0.0.15", | ||
"version": "0.0.16", | ||
"description": "Artifacts of mx.", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
248921
1974