# scroll-view-react

> A scroll view built with react

Latest version **1.0.2** (published 2023-08-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install scroll-view-react
pnpm add scroll-view-react
yarn add scroll-view-react
bun add scroll-view-react
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2023-08-26 |
| First published | 2023-08-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | codersjj |
| Maintainers | codersjj |
| Keywords | react, ScrollView, component |

## Links

- npm: https://www.npmjs.com/package/scroll-view-react
- Repository: https://github.com/codersjj/scroll-view-react
- Issues: https://github.com/codersjj/scroll-view-react
- npm.io page: https://npm.io/package/scroll-view-react

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2023-08-26
- 1.0.1 — 2023-08-26

## README

# a React ScrollView component

## Installation

```bash
npm i scroll-view-react
```

## Example

```jsx
// index.jsx
import PropTypes from 'prop-types'
import React, { memo } from 'react'
import ScrollView from 'scroll-view-react'

import ProductItem from './ProductItem.jsx'

const MySection = memo(({ data = {} }) => {
  const { list = [{id: 1},{id: 2},{id: 3},{id: 4},{id: 5},{id: 6},{id: 7}] } = data

  return (
    <div className='list'>
      <ScrollView>
        {
          list.map((item) => {
            return <ProductItem key={item.id} itemData={item} itemWidth="20%" />
          })
        }
      </ScrollView>
    </div>
  )
})

MySection.propTypes = {
  data: PropTypes.object
}

export default MySection
```

```jsx
// ProductItem.jsx
import PropTypes from 'prop-types'
import React, { memo } from 'react'

import './style.css'

const ProductItem = memo(({ itemData, itemWidth }) => {
  return (
    <div style={{
      flexShrink: 0,
      display: 'flex',
      justifyContent: 'center',
      alignItems: 'center',
      boxSizing: 'border-box',
      padding: '0 8px',
      width: itemWidth,
      height: '200px',
      backgroundImage: 'linear-gradient(135deg, #42d392 25%, #647eff)',
      backgroundOrigin: 'content-box',
      backgroundRepeat: 'no-repeat'
    }}>
      {`ProductItem${itemData.id}`}
    </div>
  )
})

ProductItem.propTypes = {
  itemData: PropTypes.object,
  itemWidth: PropTypes.string
}

export default ProductItem
```

```css
/* style.css */
.list .control.left {
  transform: translate(calc(-50% + 8px), -50%) !important;
}

.list .control.right {
  transform: translate(calc(50% - 8px), -50%) !important;
}
```

## References

### ScrollView Component

```jsx
import ScrollView from 'scroll-view-react'
```

### Props

| Property | Description | Type |
| -------- | ----------- | ---- |
| showMask | Whether to display a masking effect when the button appears. | boolean |

---
_Source: https://npm.io/package/scroll-view-react · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
