From 033a02fc8bfcf91c1d7d15ec5625797c4fe8b73c Mon Sep 17 00:00:00 2001 From: Timur Gibadullin Date: Thu, 27 Apr 2017 14:33:08 +0300 Subject: [PATCH] Fix the component appearance --- src/SortableList.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/SortableList.js b/src/SortableList.js index 58027c8..22a3ae7 100644 --- a/src/SortableList.js +++ b/src/SortableList.js @@ -50,6 +50,7 @@ export default class SortableList extends Component { _contentOffset = {x: 0, y: 0}; state = { + animated: false, order: this.props.order || Object.keys(this.props.data), rowsLayouts: null, containerLayout: null, @@ -71,9 +72,9 @@ export default class SortableList extends Component { if (data && nextData && !shallowEqual(data, nextData)) { uniqueRowKey.id++; - this._areRowsAnimated = false; this._rowsLayouts = []; this.setState({ + animated: false, data: nextData, containerLayout: null, rowsLayouts: null, @@ -146,8 +147,9 @@ export default class SortableList extends Component { } render() { - const {contentContainerStyle, horizontal, style: containerStyle} = this.props; - const {contentHeight, contentWidth, scrollEnabled} = this.state; + const {contentContainerStyle, horizontal, style} = this.props; + const {animated, contentHeight, contentWidth, scrollEnabled} = this.state; + const containerStyle = StyleSheet.flatten([style, {opacity: Number(animated)}]) const innerContainerStyle = [styles.container]; let {refreshControl} = this.props; @@ -164,7 +166,7 @@ export default class SortableList extends Component { } return ( - + (this._areRowsAnimated = true)); + }, () => { + this.setState({animated: true}); + }); }); }); }