Code Monkey home page Code Monkey logo

react-native-scroll-view's Introduction

This package is DEPRECATED

react-native-scroll-view

A react-native component for android that mimics the react-native iOS ScrollView.

  • android: ZOOM and SCROLL content easily (isn't supported by the react-native ScrollView).
  • iOS: exports the react-native ScrollView (does nothing!)

Refer to the react-native ScrollView documentation.

Installation

npm install --save @shaman123/react-native-scroll-view

OR

yarn add @shaman123/react-native-scroll-view

TypeScript

edit your project's tsconfig.json:

{
    //...
    
    "paths": {
      //...
      "@shaman123/react-native-scroll-view": [ "node_modules/@shaman123/react-native-scroll-view/index.d.ts" ]
    }
}

Usage

import ScrollView from '@shaman123/react-native-scroll-view';

<ScrollView
  ref={ref => this.ref = ref}
  minimumZoomScale={0.75}
  maximumZoomScale={3}
  zoomScale={1.5}
>
  {...contentToRender}
</ScrollView>

zoomToRect() {
  this.ref.getScrollResponder().scrollResponderZoomTo({ x: 0, y: 0, width: 100, height: 100});
}

setOverScroll() {
  this.ref.getScrollResponder()
    .scrollResponderScrollNativeHandleToKeyboard(React.findNodeHandle(this.ref), 100);
}

Props

Prop Status Description
...ViewProps see docs.
alwaysBounceVertical
contentContainerStyle
keyboardDismissMode
keyboardShouldPersistTaps
onContentSizeChange
onMomentumScrollBegin property velocity is not available yet
onMomentumScrollEnd property velocity is not available yet
onScroll property velocity is not available yet
onScrollBeginDrag property velocity is not available yet
onScrollEndDrag property velocity is not available yet
onScrollAnimationEnd
pagingEnabled
refreshControl
removeClippedSubviews
scrollEnabled
showsHorizontalScrollIndicator
showsVerticalScrollIndicator
stickyHeaderIndices
endFillColor Android prop, use indicatorStyle
overScrollMode Android prop, use other props
scrollPerfTag Android prop
DEPRECATED_sendUpdatedChildFrames
alwaysBounceHorizontal
horizontal
automaticallyAdjustContentInsets
bounces
bouncesZoom
canCancelContentTouches
centerContent
contentInset
contentInsetAdjustmentBehavior
contentOffset
decelerationRate
directionalLockEnabled
indicatorStyle differs from the iOS prop, accepts a style object
maximumZoomScale
minimumZoomScale
pinchGestureEnabled
scrollEventThrottle
scrollIndicatorInsets pass insets through indicatorStyle
scrollsToTop
snapToAlignment
snapToInterval
zoomScale
nestedScrollEnabled Android prop

Methods

Method Description
scrollTo({ x, y, animated?, scale?, overScroll?, callback?}) see ScrollView's scrollTo. Added optional arguments: scale, overScroll: true | false | { x, y }, callback
scrollToEnd({ animated?, callback?}) see ScrollView's scrollTo. Added optional arguments: callback
scrollResponderZoomTo({ x, y, width, height, animated?, callback?}) see issue. Added optional arguments: callback
flashScrollIndicators() see ScrollView's flashScrollIndicators
scrollResponderScrollNativeHandleToKeyboard(reactNode?, extraHeight, preventNegativeScrollOffset?) see issue
getNode() the same as findNodeHandle(componentRef)
getScrollResponder() a dummy method pointing back to the component, used for chaining, enables cross platform compatibility
getScrollRef() a dummy method pointing back to the component, used for chaining, enables cross platform compatibility

Events

Use these events to track touches: onTouchStart, onTouchMove, onTouchEnd.

IMPORTANT: When using [ScrollEvent: onMomentumScrollBegin, onMomentumScrollEnd, onScroll, onScrollBeginDrag, onScrollEndDrag](e) => void the property e.nativeEvent.velocity is not yet available, defaulting to { x: 0, y: 0 }

Customizing the Gesture Responder

Use onStartShouldSetResponder, onStartShouldSetResponderCapture, onMoveShouldSetResponder, onMoveShouldSetResponderCapture to customize the ScrollView's behavior.

Gesture Responder System documentation

react-native-scroll-view's People

Contributors

shaman123 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.