ScrollView
Official documentation This module below has been implemented but not properly documented. You may find below partial documentation or just raw code to show you requirements for its usage.
If you want you can help us to improve the situation by editing this file.
Scrolls to a given x
, y
offset, either immediately, with a smooth animation, or, for Android only, a custom animation duration time.
let scrollParams = (~x: float, ~y: float, ~animated: bool=?, ~duration: float=?, unit) => unit;
let scrollTo = (scrollView, scrollParams) => unit;
open ReactNative;
[@react.component]
let make = () => {
let scrollViewRef = React.useRef(Js.Nullable.null);
<ScrollView ref={scrollViewRef->Ref.value}>
<TouchableOpacity
onPress={_ =>
switch (scrollViewRef.current->Js.Nullable.toOption) {
| Some(scrollView) =>
scrollView->ScrollView.scrollTo(
ScrollView.scrollToParams(~x=0., ~y=0., ~animated=true, ()),
)
| _ => ()
}
}>
<Text> "ScrollTo 0, 0"->React.string </Text>
</TouchableOpacity>
</ScrollView>;
};
Scrolls to the end of the ScrollView
with an animation. If this is a vertical ScrollView
scrolls to the bottom. If this is a horizontal ScrollView
scrolls to the right.
let scrollToEnd = (scrollView) => unit;
Similar to scrollToEnd
, with options for animation or, for Android only duration.
let scrollToEndOptions = (~animated: bool=?, ~duration: float=?, unit) => unit;
let scrollToEndWithOptions = (scrollView, scrollParams) => unit;