mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-29 04:35:36 +08:00
Improve ScrollView docs and types
Summary: I was reading through the ScrollView code and realized that the documentation was incomplete, and some of the flow types were wrong. Reviewed By: yungsters Differential Revision: D13583133 fbshipit-source-id: 11c495681e9671e078e4d2c9df76c25b04558696
This commit is contained in:
committed by
Facebook Github Bot
parent
adc1a95a3b
commit
ca70e8e469
@@ -599,7 +599,11 @@ class ScrollView extends React.Component<Props, State> {
|
|||||||
*
|
*
|
||||||
* 3. Mixin methods access other mixin methods via dynamic dispatch using
|
* 3. Mixin methods access other mixin methods via dynamic dispatch using
|
||||||
* this. Since mixin methods are bound to the component instance, we need
|
* this. Since mixin methods are bound to the component instance, we need
|
||||||
* to copy all mixin methods to the component instance.
|
* to copy all mixin methods to the component instance. This is also
|
||||||
|
* necessary because getScrollResponder() is a public method that returns
|
||||||
|
* an object that can be used to execute all scrollResponder methods.
|
||||||
|
* Since the object returned from that method is the ScrollView instance,
|
||||||
|
* we need to bind all mixin methods to the ScrollView instance.
|
||||||
*/
|
*/
|
||||||
for (const key in ScrollResponder.Mixin) {
|
for (const key in ScrollResponder.Mixin) {
|
||||||
if (
|
if (
|
||||||
@@ -672,8 +676,14 @@ class ScrollView extends React.Component<Props, State> {
|
|||||||
* implement this method so that they can be composed while providing access
|
* implement this method so that they can be composed while providing access
|
||||||
* to the underlying scroll responder's methods.
|
* to the underlying scroll responder's methods.
|
||||||
*/
|
*/
|
||||||
getScrollResponder(): ScrollView {
|
getScrollResponder(): {
|
||||||
return this;
|
...typeof ScrollView,
|
||||||
|
...typeof ScrollResponder.Mixin,
|
||||||
|
} {
|
||||||
|
return ((this: any): {
|
||||||
|
...typeof ScrollView,
|
||||||
|
...typeof ScrollResponder.Mixin,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getScrollableNode(): any {
|
getScrollableNode(): any {
|
||||||
|
|||||||
Reference in New Issue
Block a user