Skip to content

Commit 766f020

Browse files
rozelefacebook-github-bot
authored andcommittedNov 20, 2017
Minor bug in random generator for selection prop
Summary: `.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
1 parent 6b26971 commit 766f020

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎RNTester/js/TextInputExample.ios.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ class SelectionExample extends React.Component<$FlowFixMeProps, SelectionExample
284284
}
285285

286286
selectRandom() {
287-
var positions = [this.getRandomPosition(), this.getRandomPosition()].sort();
287+
var positions = [this.getRandomPosition(), this.getRandomPosition()].sort((a, b) => a - b);
288288
this.select(...positions);
289289
}
290290

0 commit comments

Comments
 (0)
Please sign in to comment.