From 2b5453e0e603c2f3b51aaf5a411cc6f861b76526 Mon Sep 17 00:00:00 2001 From: John Shelley Date: Mon, 5 Mar 2018 20:24:01 -0600 Subject: [PATCH 1/6] Disallow topbar overscroll --- index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index f53489b..5f53924 100644 --- a/index.js +++ b/index.js @@ -188,7 +188,12 @@ class SortableListView extends React.Component { this.moveY = layout.pageY + layout.frameHeight / 2 + gestureState.dy this.direction = gestureState.dy >= this.dy ? 'down' : 'up' this.dy = gestureState.dy - onPanResponderMoveCb(e, gestureState) + var { height, width } = Dimensions.get('window'); + const adjustedListHeight = height - this.listLayout.height; + if (gestureState.moveY > adjustedListHeight) + { + onPanResponderMoveCb(e, gestureState) + } }, onPanResponderGrant: () => { From 00166b64a0f7be5e90184a0ee466a57a8c2de653 Mon Sep 17 00:00:00 2001 From: John Shelley Date: Mon, 5 Mar 2018 22:37:39 -0600 Subject: [PATCH 2/6] Remove LayoutAnimation until fixed --- Sortable/example.js | 4 +++- index.js | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Sortable/example.js b/Sortable/example.js index 1da4468..45881ad 100644 --- a/Sortable/example.js +++ b/Sortable/example.js @@ -5,6 +5,7 @@ let { Text, TouchableHighlight, View, + UIManager, } = require('react-native'); @@ -88,9 +89,10 @@ let RowComponent = React.createClass({ let MyComponent = React.createClass({ render: function() { + UIManager.setLayoutAnimationEnabledExperimental && UIManager.setLayoutAnimationEnabledExperimental(true); return ( - + Sortable = 0) { - LayoutAnimation.easeInEaseOut() + // TODO: Fix for Android and Windows + // LayoutAnimation.easeInEaseOut() this._previouslyHovering = this.state.hovering this.__activeY = this.panY this.setState({ @@ -391,7 +392,8 @@ class SortableListView extends React.Component { handleRowActive = row => { if (this.props.disableSorting) return this.state.pan.setValue({ x: 0, y: 0 }) - LayoutAnimation.easeInEaseOut() + // TODO: Fix for Android and Windows + // LayoutAnimation.easeInEaseOut() this.moveY = row.layout.pageY + row.layout.frameHeight / 2 this.setState( { From 58921497adecc57f1381d47443bb1711e04b0882 Mon Sep 17 00:00:00 2001 From: John Shelley Date: Mon, 5 Mar 2018 22:45:17 -0600 Subject: [PATCH 3/6] Use pre-extracted HEIGHT const --- index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/index.js b/index.js index 19f7b28..9683c00 100644 --- a/index.js +++ b/index.js @@ -188,8 +188,7 @@ class SortableListView extends React.Component { this.moveY = layout.pageY + layout.frameHeight / 2 + gestureState.dy this.direction = gestureState.dy >= this.dy ? 'down' : 'up' this.dy = gestureState.dy - var { height, width } = Dimensions.get('window'); - const adjustedListHeight = height - this.listLayout.height; + const adjustedListHeight = HEIGHT - this.listLayout.height; if (gestureState.moveY > adjustedListHeight) { onPanResponderMoveCb(e, gestureState) From c826ddcc7184ae5d2218da2f30c5b232e999b504 Mon Sep 17 00:00:00 2001 From: John Shelley Date: Tue, 6 Mar 2018 08:03:09 -0600 Subject: [PATCH 4/6] Update platform check --- index.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 9683c00..72d620c 100644 --- a/index.js +++ b/index.js @@ -5,6 +5,7 @@ import { ListView, Dimensions, PanResponder, + Platform, LayoutAnimation, InteractionManager, } from 'react-native' @@ -378,8 +379,10 @@ class SortableListView extends React.Component { if (!isLast) i-- if (String(i) !== this.state.hovering && i >= 0) { - // TODO: Fix for Android and Windows - // LayoutAnimation.easeInEaseOut() + if (Platform.OS === 'ios') { + // TODO: Fix for Android and Windows https://github.com/facebook/react-native/issues/13207 + // LayoutAnimation.easeInEaseOut() + } this._previouslyHovering = this.state.hovering this.__activeY = this.panY this.setState({ @@ -391,8 +394,10 @@ class SortableListView extends React.Component { handleRowActive = row => { if (this.props.disableSorting) return this.state.pan.setValue({ x: 0, y: 0 }) - // TODO: Fix for Android and Windows - // LayoutAnimation.easeInEaseOut() + if (Platform.OS === 'ios') { + // TODO: Fix for Android and Windows https://github.com/facebook/react-native/issues/13207 + // LayoutAnimation.easeInEaseOut() + } this.moveY = row.layout.pageY + row.layout.frameHeight / 2 this.setState( { From 9910fbf5e9336c94e38109ed4b433528f99677e2 Mon Sep 17 00:00:00 2001 From: Keaton Greve Date: Tue, 6 Mar 2018 13:44:59 -0600 Subject: [PATCH 5/6] suppress a warning --- index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/index.js b/index.js index 72d620c..ac7bcfd 100644 --- a/index.js +++ b/index.js @@ -29,6 +29,7 @@ class Row extends React.Component { } handlePress = e => { + e.persist(); // suppresses an RN warning on Row press if (!this.refs.view) return this.refs.view.measure( (frameX, frameY, frameWidth, frameHeight, pageX, pageY) => { From 5f23b5d885d2110ff26bd18314b8cc4bc162c901 Mon Sep 17 00:00:00 2001 From: John Shelley Date: Fri, 18 Jan 2019 15:16:25 -0600 Subject: [PATCH 6/6] Allow ease animations on iOS for now --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index ac7bcfd..7375a5f 100644 --- a/index.js +++ b/index.js @@ -382,7 +382,7 @@ class SortableListView extends React.Component { if (String(i) !== this.state.hovering && i >= 0) { if (Platform.OS === 'ios') { // TODO: Fix for Android and Windows https://github.com/facebook/react-native/issues/13207 - // LayoutAnimation.easeInEaseOut() + LayoutAnimation.easeInEaseOut() } this._previouslyHovering = this.state.hovering this.__activeY = this.panY @@ -397,7 +397,7 @@ class SortableListView extends React.Component { this.state.pan.setValue({ x: 0, y: 0 }) if (Platform.OS === 'ios') { // TODO: Fix for Android and Windows https://github.com/facebook/react-native/issues/13207 - // LayoutAnimation.easeInEaseOut() + LayoutAnimation.easeInEaseOut() } this.moveY = row.layout.pageY + row.layout.frameHeight / 2 this.setState(