Skip to content

Commit

Permalink
Fix the problem that maxScale is less than 1
Browse files Browse the repository at this point in the history
  • Loading branch information
mochixuan committed Oct 22, 2020
1 parent 7e44dec commit 9cf4681
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions Example/app/widget/AutoDragSortableView.js
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,9 @@ export default class AutoDragSortableView extends Component{
}

_renderItemView = () => {
const {maxScale, minOpacity} = this.props
const inputRange = maxScale >= 1 ? [1, maxScale] : [maxScale, 1]
const outputRange = maxScale >= 1 ? [1, minOpacity] : [minOpacity, 1]
return this.state.dataSource.map((item,index)=>{
const transformObj = {}
transformObj[this.props.scaleStatus] = item.scaleValue
Expand All @@ -630,10 +633,7 @@ export default class AutoDragSortableView extends Component{
marginRight: this.props.marginChildrenRight,
left: item.position.x,
top: item.position.y,
opacity: item.scaleValue.interpolate({
inputRange:[1,this.props.maxScale],
outputRange:[1,this.props.minOpacity]
}),
opacity: item.scaleValue.interpolate({inputRange,outputRange}),
transform: [transformObj]
}]}>
<TouchableOpacity
Expand Down
8 changes: 4 additions & 4 deletions Example/app/widget/DragSortableView.js
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,9 @@ export default class DragSortableView extends Component{
}

_renderItemView = () => {
const {maxScale, minOpacity} = this.props
const inputRange = maxScale >= 1 ? [1, maxScale] : [maxScale, 1]
const outputRange = maxScale >= 1 ? [1, minOpacity] : [minOpacity, 1]
return this.state.dataSource.map((item,index)=>{
const transformObj = {}
transformObj[this.props.scaleStatus] = item.scaleValue
Expand All @@ -439,10 +442,7 @@ export default class DragSortableView extends Component{
marginRight: this.props.marginChildrenRight,
left: item.position.x,
top: item.position.y,
opacity: item.scaleValue.interpolate({
inputRange:[1,this.props.maxScale],
outputRange:[1,this.props.minOpacity]
}),
opacity: item.scaleValue.interpolate({inputRange,outputRange}),
transform: [transformObj]
}]}>
<TouchableOpacity
Expand Down
8 changes: 4 additions & 4 deletions lib/AutoDragSortableView.js
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,9 @@ export default class AutoDragSortableView extends Component{
}

_renderItemView = () => {
const {maxScale, minOpacity} = this.props
const inputRange = maxScale >= 1 ? [1, maxScale] : [maxScale, 1]
const outputRange = maxScale >= 1 ? [1, minOpacity] : [minOpacity, 1]
return this.state.dataSource.map((item,index)=>{
const transformObj = {}
transformObj[this.props.scaleStatus] = item.scaleValue
Expand All @@ -630,10 +633,7 @@ export default class AutoDragSortableView extends Component{
marginRight: this.props.marginChildrenRight,
left: item.position.x,
top: item.position.y,
opacity: item.scaleValue.interpolate({
inputRange:[1,this.props.maxScale],
outputRange:[1,this.props.minOpacity]
}),
opacity: item.scaleValue.interpolate({inputRange,outputRange}),
transform: [transformObj]
}]}>
<TouchableOpacity
Expand Down
8 changes: 4 additions & 4 deletions lib/DragSortableView.js
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,9 @@ export default class DragSortableView extends Component{
}

_renderItemView = () => {
const {maxScale, minOpacity} = this.props
const inputRange = maxScale >= 1 ? [1, maxScale] : [maxScale, 1]
const outputRange = maxScale >= 1 ? [1, minOpacity] : [minOpacity, 1]
return this.state.dataSource.map((item,index)=>{
const transformObj = {}
transformObj[this.props.scaleStatus] = item.scaleValue
Expand All @@ -439,10 +442,7 @@ export default class DragSortableView extends Component{
marginRight: this.props.marginChildrenRight,
left: item.position.x,
top: item.position.y,
opacity: item.scaleValue.interpolate({
inputRange:[1,this.props.maxScale],
outputRange:[1,this.props.minOpacity]
}),
opacity: item.scaleValue.interpolate({inputRange,outputRange}),
transform: [transformObj]
}]}>
<TouchableOpacity
Expand Down
2 changes: 1 addition & 1 deletion lib/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-drag-sort",
"version": "2.3.7",
"version": "2.3.8",
"description": "Drag and drop sort control for react-native",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 9cf4681

Please sign in to comment.