Browse files

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.

Found a bug in RNTester.

Ran RNTester and confirmed that bug could be reproduced.

[IOS][BUGFIX][RNTester] - patch test to implement desired behavior.
Closes #16871

Differential Revision: D6371550

Pulled By: shergin

fbshipit-source-id: 84866d1eb02c2be51cd15a60490604d28fa18973
  • Loading branch information...
rozele authored and facebook-github-bot committed Nov 20, 2017
1 parent 6b26971 commit 766f020e68abfc121ea6a9f92e0640368d69dae7
Showing with 1 addition and 1 deletion.
  1. +1 −1 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);;

0 comments on commit 766f020

Please sign in to comment.