Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

reason-react-native: add example for ScrollView scrollTo method#577

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
MoOx merged 5 commits intomasterfromscrolltoexample
Aug 28, 2019
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletionsreason-react-native/src/components/ScrollView.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,6 +4,67 @@ title: ScrollView
wip: true
---

## Methods

### `scrollTo`

Scrolls to a given `x`, `y` offset, either immediately, with a smooth animation, or,
for Android only, a custom animation duration time.

```reason
let scrollParams = (~x: float, ~y: float, ~animated: bool=?, ~duration: float=?, unit) => unit;

let scrollTo = (scrollView, scrollParams) => unit;
```

#### `scrollTo` Example

```reason
open ReactNative;

[@react.component]
let make = () => {
let scrollViewRef = React.useRef(Js.Nullable.null);
<ScrollView ref=scrollViewRef>
<TouchableOpacity
onPress={_ =>
switch (scrollViewRef->React.Ref.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>;
};
```

### `scrollToEnd`

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.

```reason
let scrollToEnd = (scrollView) => unit;
```

### `scrollToEndWithOptions`

Similar to `scrollToEnd`, with options for animation or, for Android only duration.

```reason
let scrollToEndOptions = (~animated: bool=?, ~duration: float=?, unit) => unit;

let scrollToEndWithOptions = (scrollView, scrollParams) => unit;
```

---


```reason
include ScrollViewElement;

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp