universal-scroller
v0.0.10
Published
universal scroll component for react-native & web platform
Downloads
8
Maintainers
Readme
universal-scroller
Universal scroll component for react-native & web platform.
Usage
In web platform, we need import 'universal-scroller/index.web.js'. Or you can config your module manage system to load 'index.web.js' intelligently.
If you are using webpack, you can config resolve.extensions.
{
resolve: {
extensions: ['.web.js', '.js'],
},
}
We are dependent on zscroller and scroller, so you can get almost all of options from here.
Web platform
import Scroller from 'universal-scroller';
const scroller = new Scroller(elmNode, {
...options,
onScroll: (left, top, zoom) => {
console.log(left, top, zoom);
},
});
React-native platform
import React, { Component } from 'react';
import {
Text,
} from 'react-native';
import Scroller from 'universal-scroller';
class List extends Component {
render() {
return (
<Scroller
{...options}
onScroll={(left, top, zoom) => {
console.log(left, top, zoom);
}}
>
<Text>hello<Text>
</Scroller>
);
}
}
TODO
- React native zoom
- React web version