Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-scrollable-mixin

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-scrollable-mixin - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

2

package.json
{
"name": "react-native-scrollable-mixin",
"version": "0.0.3",
"version": "0.0.4",
"description": "A standard interface for your scrollable React Native components, making it easier to compose components.",

@@ -5,0 +5,0 @@ "main": "ScrollableMixin.js",

@@ -5,2 +5,4 @@ # ScrollableMixin

See [react-native-scrollable-decorator](https://github.com/exponentjs/react-native-scrollable-decorator) for the decorator version of this mixin.
[![npm package](https://nodei.co/npm/react-native-scrollable-mixin.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/react-native-scrollable-mixin/)

@@ -17,6 +19,43 @@

## With JavaScript classes
Use `Object.assign` to copy ScrollableMixin's functions to your class as static methods.
```js
var ScrollableMixin = require('react-native-scrollable-mixin');
class InfiniteScrollView extends React.Component {
static propTypes = {
...ScrollView.propTypes,
renderScrollComponent: PropTypes.func.isRequired
};
var InfiniteScrollView = React.createClass({
/**
* IMPORTANT: You must return the scroll responder of the underlying
* scrollable component from getScrollResponder() when using ScrollableMixin.
*/
getScrollResponder() {
return this._scrollView.getScrollResponder();
}
setNativeProps(props) {
this._scrollView.setNativeProps(props);
}
render() {
let { renderScrollComponent, ...props } = this.props;
return React.cloneElement(renderScrollComponent(props), {
ref: component => { this._scrollView = component; },
});
}
}
// Mix in ScrollableMixin's methods as static methods
Object.assign(InfiniteScrollView, ScrollableMixin);
```
### With `React.createClass`
```js
let ScrollableMixin = require('react-native-scrollable-mixin');
let InfiniteScrollView = React.createClass({
mixins: [ScrollableMixin],

@@ -26,3 +65,3 @@

...ScrollView.propTypes,
renderScrollComponent: React.PropTypes.func.isRequired,
renderScrollComponent: PropTypes.func.isRequired,
},

@@ -48,5 +87,3 @@

return React.cloneElement(renderScrollComponent(props), {
ref: component => {
this._scrollView = component;
},
ref: component => { this._scrollView = component; },
});

@@ -53,0 +90,0 @@ },

@@ -5,3 +5,3 @@ /**

var ScrollableMixin = {
let ScrollableMixin = {
getInnerViewNode(): any {

@@ -8,0 +8,0 @@ return this.getScrollResponder().getInnerViewNode();

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc