0.1.0 • Published 8 years ago

react-native-scrollable-view v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

react-native-scrollable-view

Inspired by https://github.com/brentvatne/react-native-scrollable-tab-view

I want to use scrollable view without tab. I cannot find react-native plugin so I forked react-native-scrollable-tab-view and strip of tab component.

Thanks @brentvatne!

Tested with react-native 0.20

Add it to your project

  1. Run npm install react-native-scrollable-view --save
  2. var ScrollableTabView = require('react-native-scrollable-tab-view');

Demo

Basic usage

var ScrollableView = require('react-native-scrollable-view');

var App = React.createClass({
  render() {
    return (
      <ScrollableView>
        <Text> View 1</Text>
        <Text> View 2</Text>
        <Text> View 3</Text>
      </ScrollableView>
    );
  }
});

Example

See examples/FacebookTabsExample.

Props

  • onChangePage (Function) - function to call when Page changes, should accept 1 argument which is an Object containing two keys: i: the index of the tab that is selected, ref: the ref of the tab that is selected
  • onScroll (Function) - function to call when the pages are sliding, should accept 1 argument which is an Float number representing the page position in the slide frame.
  • locked (Bool) - disables horizontal dragging to scroll between tabs, default is false.
  • initialPage (Integer) - the index of the initially selected tab, defaults to 0 === first tab.
  • page (Integer) - set selected page(can be buggy see #126
  • style (View.propTypes.style)
  • contentProps (Object) - props that are applied to root ScrollView/ViewPagerAndroid. Note that overriding defaults set by the library may break functionality; see the source for details.

MIT Licensed