Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hikouki/react-native-use-scroll-indicator

React hooks for ScrollView indicator of react-native.
https://github.com/hikouki/react-native-use-scroll-indicator

indicator react-native scroll

Last synced: 12 days ago
JSON representation

React hooks for ScrollView indicator of react-native.

Awesome Lists containing this project

README

        

# react-native-use-scroll-indicator

React hooks for ScrollView indicator of react-native.

## Installation

```
npm install react-native-use-scroll-indicator
```

## Usage

Horizontal Indicator.

```tsx
import React from 'react';
import {Animated} from 'react-native';
import {HorizontalScrollIndicator} from 'react-native-use-scroll-indicator';

export default function Screen() {
...

return (

{({ref, onLayout, onContentSizeChange, onScroll}) => (

)}

);
}
```

Vertical Indicator.

```tsx
import React from 'react';
import {Animated} from 'react-native';
import {VerticalScrollIndicator} from 'react-native-use-scroll-indicator';

export default function Screen() {
...

return (

{({ref, onLayout, onContentSizeChange, onScroll}) => (

)}

);
}
```

Without Component.

```tsx
import React from 'react';
import {View, Animated} from 'react-native';
import {useScrollIndicator} from react-native-use-scroll-indicator';

export default function Screen() {
const {moveX, indicator, viewportSize, onLayout, onContentSizeChange, onScroll} =
useScrollIndicator();
const scale = 0.8;

return (






);
}
```

## Interface

### HorizontalScrollIndicator

| Prop | Required | Type |
|-------------------------|:--------:|-----------------------|
| children | ☑️ | Function |
| containerStyle | | StyleProp\ |
| indicatorContainerStyle | | StyleProp\ |
| indicatorStyle | | StyleProp\ |
| scale | | number |

### VerticalScrollIndicator

| Prop | Required | Type |
|-------------------------|:--------:|-----------------------|
| children | ☑️ | Function |
| containerStyle | | StyleProp\ |
| indicatorContainerStyle | | StyleProp\ |
| indicatorStyle | | StyleProp\ |
| scale | | number |

## LICENSE

MIT