From f4e15cd071caec278d338c35784eec8507b1896f Mon Sep 17 00:00:00 2001 From: Eric Rozell Date: Fri, 17 Nov 2017 15:11:14 -0500 Subject: [PATCH] Minor bug in random generator for `selection` prop `.sort()` will sort on the string value by default, so if you generate [18, 8], they will stay in that order. Adding comparer to ensure values are sorted numerically. --- RNTester/js/TextInputExample.ios.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RNTester/js/TextInputExample.ios.js b/RNTester/js/TextInputExample.ios.js index 453bc269b9e89e..efb11653391e4a 100644 --- a/RNTester/js/TextInputExample.ios.js +++ b/RNTester/js/TextInputExample.ios.js @@ -284,7 +284,7 @@ class SelectionExample extends React.Component<$FlowFixMeProps, SelectionExample } selectRandom() { - var positions = [this.getRandomPosition(), this.getRandomPosition()].sort(); + var positions = [this.getRandomPosition(), this.getRandomPosition()].sort((a, b) => a - b); this.select(...positions); }