Git Product home page Git Product logo

react-scopy-scroll's Introduction

React-Scopy-Scroll

An Infinite scope-view-calculated scroll based on react-suctom-scroll package for ReactJS

NOT READY FOR PRODUCTION YET

Installation

npm i react-scopy-scroll --save
import ScopyScroll from 'react-scopy-scroll';

How to change the design ?

Your own custom design can be applied by styling these 2 classes in your css:

  • rcs-custom-scrollbar - this class styles the container of the scroll handle, you can use it if your handle width is greater than the default.
  • rcs-inner-handle - this class styles the handle itself, you can use it to change the color, background, border and such of the handle

You can see a usage example in example/firstComp/firstComp.scss

Custom Scroll Options (react props)

  • allowOuterScroll : boolean, default false. Blocks outer scroll while scrolling the content
  • heightRelativeToParent : string, default undefined. Content height limit is relative to parent - the value should be the height limit.
  • flex : number, default undefined. If present will apply to the content wrapped by the custom scroll. This prop represents flex size. It is only relevant if the parent of customScroll has display: flex. See example below. This prop will override any value given to heightRelativeToParent when setting the height of customScroll.
  • onScroll - function, default undefined. Listener that will be called on each scroll.
  • addScrolledClass : boolean, default false. If true, will add a css class 'content-scrolled' while being scrolled.
  • freezePosition : boolean, default false. When true, will prevent scrolling.
  • minScrollHandleHeight : number, sets the mimimum height of the scroll handle. Default is 38, as in Chrome on OSX.
  • rtl : boolean, default false. Right to left document, will place the custom scrollbar on the left side of the content, and assume the native one is also there.
  • scrollTo: number, default undefined. Will scroll content to the given value.
  • keepAtBottom: boolean, default false. For dynamic content, will keep the scroll position at the bottom of the content, when the content changes, if the position was at the bottom before the change. See example here
Example for heightRelativeToParent
<CustomScroll heightRelativeToParent="calc(100% - 20px)">
  your content
</CustomScroll>
<someParent style="display: flex; height: 500px;">
  <fixedHeightElement style="height: 100px"><fixedHeightElement/>
  <ScopyScroll renderItem={(item, index) => {
      return <div key={item.id}>{item.name}</div>
  }}/>
</someParent>

Contributing

To build the project in watch mode, run 'npm run develop' or 'yarn develop'. For production build - run yarn build .

react-scopy-scroll's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.