From d218f90cde33a32e778e4cd87b74afc8a6e03916 Mon Sep 17 00:00:00 2001
From: Luke Barnard <lukeb@openmarket.com>
Date: Fri, 7 Apr 2017 11:31:52 +0100
Subject: [PATCH] Fix infinite pagination/glitches with pagination

I think this was being caused by a bug introduced in 47f29b that meant that `backwards` was actually being used as `forwards`.
---
 src/components/structures/ScrollPanel.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/components/structures/ScrollPanel.js b/src/components/structures/ScrollPanel.js
index 63725b8b86..83bec03e9e 100644
--- a/src/components/structures/ScrollPanel.js
+++ b/src/components/structures/ScrollPanel.js
@@ -345,7 +345,7 @@ module.exports = React.createClass({
         //
         // If backwards is true, we unpaginate (remove) tiles from the back (top).
         for (let i = 0; i < tiles.length; i++) {
-            const tile = tiles[backwards ? tiles.length - 1 - i : i];
+            const tile = tiles[backwards ? i : tiles.length - 1 - i];
             // Subtract height of tile as if it were unpaginated
             excessHeight -= tile.clientHeight;
             // The tile may not have a scroll token, so guard it