react-native-drag-sort
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -5,5 +5,4 @@ import React, {Component} from 'react' | ||
const PropTypes = require('prop-types') | ||
const {width,height} = Dimensions.get('window') | ||
const {width} = Dimensions.get('window') | ||
const measureDelay = 100 | ||
const defaultZIndex = 8 | ||
@@ -342,39 +341,3 @@ const touchZIndex = 99 | ||
> | ||
{ | ||
this.state.dataSource.map((item,index)=>{ | ||
const transformObj = {} | ||
transformObj[this.props.scaleStatus] = item.scaleValue | ||
return ( | ||
<Animated.View | ||
key={item.originIndex} | ||
ref={(ref) => this.sortRefs.set(index,ref)} | ||
{...this._panResponder.panHandlers} | ||
style={[styles.item,{ | ||
marginTop: this.props.marginChildrenTop, | ||
marginBottom: this.props.marginChildrenBottom, | ||
marginLeft: this.props.marginChildrenLeft, | ||
marginRight: this.props.marginChildrenRight, | ||
left: item.position.x, | ||
top: item.position.y, | ||
opacity: item.scaleValue.interpolate({ | ||
inputRange:[1,maxScale], | ||
outputRange:[1,minOpacity] | ||
}), | ||
transform: [transformObj] | ||
}]}> | ||
<TouchableOpacity | ||
activeOpacity = {1} | ||
onPressOut={()=> this.onPressOut()} | ||
onLongPress={()=>this.startTouch(index)} | ||
onPress={()=>{ | ||
if (this.props.onClickItem) { | ||
this.props.onClickItem(this.getOriginalData(),item.data,index) | ||
} | ||
}}> | ||
{this.props.renderItem(item.data,index)} | ||
</TouchableOpacity> | ||
</Animated.View> | ||
) | ||
}) | ||
} | ||
{this._renderItemView()} | ||
</View> | ||
@@ -384,2 +347,41 @@ ) | ||
_renderItemView = () => { | ||
return this.state.dataSource.map((item,index)=>{ | ||
const transformObj = {} | ||
transformObj[this.props.scaleStatus] = item.scaleValue | ||
const key = this.props.keyExtractor ? this.props.keyExtractor(item.data,index) : item.originIndex | ||
return ( | ||
<Animated.View | ||
key={key} | ||
ref={(ref) => this.sortRefs.set(index,ref)} | ||
{...this._panResponder.panHandlers} | ||
style={[styles.item,{ | ||
marginTop: this.props.marginChildrenTop, | ||
marginBottom: this.props.marginChildrenBottom, | ||
marginLeft: this.props.marginChildrenLeft, | ||
marginRight: this.props.marginChildrenRight, | ||
left: item.position.x, | ||
top: item.position.y, | ||
opacity: item.scaleValue.interpolate({ | ||
inputRange:[1,maxScale], | ||
outputRange:[1,minOpacity] | ||
}), | ||
transform: [transformObj] | ||
}]}> | ||
<TouchableOpacity | ||
activeOpacity = {1} | ||
onPressOut={()=> this.onPressOut()} | ||
onLongPress={()=>this.startTouch(index)} | ||
onPress={()=>{ | ||
if (this.props.onClickItem) { | ||
this.props.onClickItem(this.getOriginalData(),item.data,index) | ||
} | ||
}}> | ||
{this.props.renderItem(item.data,index)} | ||
</TouchableOpacity> | ||
</Animated.View> | ||
) | ||
}) | ||
} | ||
componentWillUnmount() { | ||
@@ -410,3 +412,4 @@ if (this.isScaleRecovery) clearTimeout(this.isScaleRecovery) | ||
scaleStatus: PropTypes.oneOf('scale','scaleX','scaleY'), | ||
fixedItems: PropTypes.array | ||
fixedItems: PropTypes.array, | ||
keyExtractor: PropTypes.func | ||
} | ||
@@ -413,0 +416,0 @@ |
{ | ||
"name": "react-native-drag-sort", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "Drag and drop sort control for react-native", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31800
367