-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace
ScrollView.scrollTo()
API with something less ambiguous.
Summary: public The current `ScrollView.scrollTo()` API is confusing due to the `(y, x)` parameter order, and the boolean `animated` argument. E.g. ScrollView.scrollTo(5, 0, true) // what do these arguments mean? This diff replaces the API with a configuration object, so the arguments are all explicit: ScrollView.scrollTo({x: 0, y: 5, animated: true}) // much better The `scrollTo()` method checks the argument types, and provides backwards compatibility with the old argument format for now. Using the old API will generate a warning, and this will eventually be upgraded to an error. Reviewed By: davidaurelio Differential Revision: D2892287 fb-gh-sync-id: cec4d504242391267c6e863816b6180ced7a7d5e
- Loading branch information
1 parent
5f4390b
commit 6941c4e
Showing
3 changed files
with
89 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6941c4e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nicklockwood http://www.2ality.com/2011/11/keyword-parameters.html would be even better
6941c4e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@skv-headless that syntax doesn't play very nicely with flow annotations unfortunately. But if I understand the spec correctly, the syntax at the call site is the same anyway.