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

nuke-scroll-view

Package Overview
Dependencies
Maintainers
2
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nuke-scroll-view - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

lib/web-refresh-control.js

174

docs/basic.md
# ScrollView demo
- order: 0
* order: 0

@@ -9,6 +9,5 @@ 包含下拉刷新特性

````js
```js
/** @jsx createElement */
import {createElement, Component,render} from 'rax';
import { createElement, Component, render } from 'rax';
import View from 'nuke-view';

@@ -20,80 +19,93 @@ import Text from 'nuke-text';

let App = class NukeDemoIndex extends Component {
constructor() {
super();
this.state={
isRefreshing: false,
refreshText: '↓ 下拉刷新',
data:[
{key:'A',bg:'#1170bc',color:'#ffffff'},
{key:'B',bg:'#3089dc',color:'#ffffff'},
{key:'C',bg:'#f1f1f1',color:'#3d4145'},
{key:'F',bg:'yellow',color:'#ffffff'},
{key:'G',bg:'red',color:'#ffffff'}
]
}
}
getViews(){
let doms=[];
this.state.data.map((item,index)=> {
doms.push(<View style={[styles.item,{backgroundColor:item.bg}]}>
<Text style={{color:item.color}}>{item.key}</Text>
</View>
);
});
return doms;
}
constructor() {
super();
this.state = {
isRefreshing: false,
refreshText: '↓ 下拉刷新',
data: [
{ key: 'A', bg: '#1170bc', color: '#ffffff' },
{ key: 'B', bg: '#3089dc', color: '#ffffff' },
{ key: 'C', bg: '#f1f1f1', color: '#3d4145' },
{ key: 'F', bg: 'yellow', color: '#ffffff' },
{ key: 'G', bg: 'red', color: '#ffffff' }
]
};
}
getViews() {
let doms = [];
this.state.data.map((item, index) => {
doms.push(
<View style={[styles.item, { backgroundColor: item.bg }]}>
<Text style={{ color: item.color }}>{item.key}</Text>
</View>
);
});
handleRefresh=()=>{
this.setState({
isRefreshing: true,
refreshText: '加载中',
});
//mock ajax
setTimeout(() => {
this.setState({
isRefreshing: false,
data: [{key:'D',bg:'#ff6600',color:'#ffffff'}].concat(this.state.data),
refreshText: '↓ 下拉刷新',
});
return doms;
}
}, 1000);
}
loadmore = ()=>{
// 底部加载更多
this.setState({
data: this.state.data.concat([{key:'E',bg:'#B91630',color:'#ffffff'}]),
});
}
render() {
return (
<ScrollView ref="vscroller" style={styles.vscroller} onEndReachedThreshold={20} onEndReached={this.loadmore}>
<RefreshControl JDYHeaderStyle="endAnamtionStyle" refreshing={this.state.isRefreshing} style={[styles.itemRefresh]} onRefresh={this.handleRefresh}>
</RefreshControl>
{this.getViews()}
</ScrollView>
)
}
}
const styles={
vscroller:{
flex:1,
},
itemRefresh:{
width:750,
height:200,
alignItems:'center',
justifyContent:'center',
},
item:{
height:'300rem',
alignItems:'center',
justifyContent:'center',
}
}
render(<App/>);
````
handleRefresh = () => {
console.log('trigger refresh');
this.setState({
isRefreshing: true,
refreshText: '加载中'
});
//mock ajax
setTimeout(() => {
this.setState({
isRefreshing: false,
data: [{ key: 'D', bg: '#ff6600', color: '#ffffff' }].concat(
this.state.data
),
refreshText: '↓ 下拉刷新'
});
}, 1000);
};
loadmore = () => {
// 底部加载更多
this.setState({
data: this.state.data.concat([
{ key: 'E', bg: '#B91630', color: '#ffffff' }
])
});
};
render() {
return (
<ScrollView
ref="vscroller"
style={styles.vscroller}
onEndReachedThreshold={20}
onEndReached={this.loadmore}
>
<RefreshControl
JDYHeaderStyle="endAnamtionStyle"
refreshing={this.state.isRefreshing}
style={[styles.itemRefresh]}
onRefresh={this.handleRefresh}
>
<Text>{this.state.refreshText}</Text>
</RefreshControl>
{this.getViews()}
</ScrollView>
);
}
};
const styles = {
vscroller: {
flex: 1
},
itemRefresh: {
width: 750,
height: 200,
backgroundColor: '#ADDADD',
alignItems: 'center',
justifyContent: 'center'
},
item: {
height: '300rem',
alignItems: 'center',
justifyContent: 'center'
}
};
render(<App />);
```

@@ -44,3 +44,3 @@ # ScrollView demo 事件

reset = ()=>{
this.refs.scroller1.resetLoadmore();

@@ -47,0 +47,0 @@ Modal.toast('reset loadmore success');

# Changelog
## 1.0.1 / 2017-11-23
* [[54e1a9e](http://gitlab.alibaba-inc.com/nuke/scroll-view/commit/54e1a9e1deac0f76120fc830d557a6e59797b7a3)] - `fix` if there's no refreshControl
* [[868dda9](http://gitlab.alibaba-inc.com/nuke/scroll-view/commit/868dda91d8e8140025a956402784b9adc815f81d)] - `feat` replace hammerjs
* [[8806919](http://gitlab.alibaba-inc.com/nuke/scroll-view/commit/8806919e61bb2bcf26470632cf3310360526f123)] - `fix` use type.displayName to replace type compare
* [[b662bee](http://gitlab.alibaba-inc.com/nuke/scroll-view/commit/b662beecf6272a8e3f6b4c017f361097dc7cb752)] - `fix` basic logic done
## 1.0.0 / 2017-11-04

@@ -5,0 +12,0 @@

'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
value: true
});

@@ -21,2 +21,6 @@

var _nukeText = require('nuke-text');
var _nukeText2 = _interopRequireDefault(_nukeText);
var _nukeRefreshControl = require('nuke-refresh-control');

@@ -26,6 +30,8 @@

var _webRefreshControl = require('./web-refresh-control');
var _webRefreshControl2 = _interopRequireDefault(_webRefreshControl);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -35,5 +41,5 @@

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /** @jsx createElement */
var WebPullToRefresh = void 0;
var isWeex = _nukeEnv2.default.isWeex,

@@ -43,5 +49,2 @@ isWeb = _nukeEnv2.default.isWeb;

if (isWeb) {
WebPullToRefresh = require('./mods/wptr.js');
}
var DEFAULT_END_REACHED_THRESHOLD = 500;

@@ -51,286 +54,279 @@ var DEFAULT_SCROLL_CALLBACK_THROTTLE = 50;

function formatRemToPx(value) {
if (window.devicePixelRatio) {
if (typeof value === 'number') {
return value * window.screen.width / FULL_WIDTH;
} else {
return value.replace('rem', '') * window.screen.width / FULL_WIDTH;
}
}
}
var ScrollViewTest = function (_Component) {
_inherits(ScrollViewTest, _Component);
_inherits(ScrollViewTest, _Component);
function ScrollViewTest(props) {
_classCallCheck(this, ScrollViewTest);
function ScrollViewTest(props) {
_classCallCheck(this, ScrollViewTest);
var _this = _possibleConstructorReturn(this, (ScrollViewTest.__proto__ || Object.getPrototypeOf(ScrollViewTest)).call(this, props));
var _this = _possibleConstructorReturn(this, (ScrollViewTest.__proto__ || Object.getPrototypeOf(ScrollViewTest)).call(this, props));
_this.lastScrollDistance = 0;
_this.lastScrollContentSize = 0;
_this.loadmoreretry = 1;
_this.lastScrollDistance = 0;
_this.lastScrollContentSize = 0;
_this.loadmoreretry = 1;
_this.handleScroll = function (e) {
if (isWeb) {
if (_this.props.onScroll) {
e.nativeEvent = {
get contentOffset() {
return {
x: e.target.scrollLeft,
y: e.target.scrollTop
};
}
};
_this.props.onScroll(e);
}
_this.handleScroll = function (e) {
if (isWeb) {
if (_this.props.onScroll) {
e.nativeEvent = {
get contentOffset() {
return {
x: e.target.scrollLeft,
y: e.target.scrollTop
};
}
};
_this.props.onScroll(e);
}
if (_this.props.onEndReached) {
if (!_this.scrollerNode) {
_this.scrollerNode = (0, _rax.findDOMNode)(_this.refs.scroller);
_this.scrollerContentNode = (0, _rax.findDOMNode)(_this.refs.contentContainer);
if (_this.props.onEndReached) {
if (!_this.scrollerNode) {
_this.scrollerNode = (0, _rax.findDOMNode)(_this.refs.scroller);
_this.scrollerContentNode = (0, _rax.findDOMNode)(_this.refs.contentContainer);
_this.scrollerNodeSize = _this.props.horizontal ? _this.scrollerNode.offsetWidth : _this.scrollerNode.offsetHeight;
}
_this.scrollerNodeSize = _this.props.horizontal ? _this.scrollerNode.offsetWidth : _this.scrollerNode.offsetHeight;
}
// NOTE:in iOS7/8 offsetHeight/Width is is inaccurate ( use scrollHeight/Width )
var scrollContentSize = _this.props.horizontal ? _this.scrollerNode.scrollWidth : _this.scrollerNode.scrollHeight;
var scrollDistance = _this.props.horizontal ? _this.scrollerNode.scrollLeft : _this.scrollerNode.scrollTop;
var isEndReached = scrollContentSize - scrollDistance - _this.scrollerNodeSize < _this.props.onEndReachedThreshold;
// NOTE:in iOS7/8 offsetHeight/Width is is inaccurate ( use scrollHeight/Width )
var scrollContentSize = _this.props.horizontal ? _this.scrollerNode.scrollWidth : _this.scrollerNode.scrollHeight;
var scrollDistance = _this.props.horizontal ? _this.scrollerNode.scrollLeft : _this.scrollerNode.scrollTop;
var isEndReached = scrollContentSize - scrollDistance - _this.scrollerNodeSize < _this.props.onEndReachedThreshold;
var isScrollToEnd = scrollDistance > _this.lastScrollDistance;
var isLoadedMoreContent = scrollContentSize != _this.lastScrollContentSize;
var isScrollToEnd = scrollDistance > _this.lastScrollDistance;
var isLoadedMoreContent = scrollContentSize != _this.lastScrollContentSize;
if (isEndReached && isScrollToEnd && isLoadedMoreContent) {
_this.lastScrollContentSize = scrollContentSize;
_this.props.onEndReached(e);
}
if (isEndReached && isScrollToEnd && isLoadedMoreContent) {
_this.lastScrollContentSize = scrollContentSize;
_this.props.onEndReached(e);
}
_this.lastScrollDistance = scrollDistance;
}
}
if (isWeex) {
e.nativeEvent = {
contentOffset: {
// HACK: weex scroll event value is opposite of web
x: -e.contentOffset.x,
y: -e.contentOffset.y
}
};
_this.props.onScroll(e);
}
_this.lastScrollDistance = scrollDistance;
}
}
if (isWeex) {
e.nativeEvent = {
contentOffset: {
// HACK: weex scroll event value is opposite of web
x: -e.contentOffset.x,
y: -e.contentOffset.y
}
};
_this.props.onScroll(e);
}
};
_this.resetScroll = function () {
if (isWeb) {
_this.lastScrollContentSize = 0;
_this.lastScrollDistance = 0;
} else {
_this.setState({
loadmoreretry: _this.loadmoreretry++
});
}
};
_this.resetScroll = function () {
if (isWeb) {
_this.lastScrollContentSize = 0;
_this.lastScrollDistance = 0;
} else {
_this.setState({
loadmoreretry: _this.loadmoreretry++
});
}
};
_this.scrollTo = function (options) {
var x = parseInt(options.x);
var y = parseInt(options.y);
_this.scrollTo = function (options) {
var x = parseInt(options.x);
var y = parseInt(options.y);
if (isWeex) {
var dom = require('@weex-module/dom');
var contentContainer = (0, _rax.findDOMNode)(_this.refs.contentContainer);
dom.scrollToElement(contentContainer.ref, {
offset: x || y || 0
});
} else {
var pixelRatio = document.documentElement.clientWidth / FULL_WIDTH;
if (isWeex) {
var dom = require('@weex-module/dom');
var contentContainer = (0, _rax.findDOMNode)(_this.refs.contentContainer);
dom.scrollToElement(contentContainer.ref, {
offset: x || y || 0
});
} else {
var pixelRatio = document.documentElement.clientWidth / FULL_WIDTH;
if (x >= 0) {
(0, _rax.findDOMNode)(_this.refs.scroller).scrollLeft = pixelRatio * x;
}
if (x >= 0) {
(0, _rax.findDOMNode)(_this.refs.scroller).scrollLeft = pixelRatio * x;
}
if (y >= 0) {
(0, _rax.findDOMNode)(_this.refs.scroller).scrollTop = pixelRatio * y;
}
}
};
if (y >= 0) {
(0, _rax.findDOMNode)(_this.refs.scroller).scrollTop = pixelRatio * y;
}
}
};
_this.handleRefresh = function () {
return new Promise(function (resolve, reject) {
_this.onRefresh && _this.onRefresh(resolve, reject);
});
};
_this.handleRefresh = function () {
return new Promise(function (resolve, reject) {
_this.onRefresh && _this.onRefresh(resolve, reject);
});
};
_this.resetLoadmore = function () {
if (isWeex) {
_this.refs.scroller.resetLoadmore();
}
};
_this.resetLoadmore = function () {
if (isWeex) {
_this.refs.scroller.resetLoadmore();
}
};
_this.state = {
loadmoreretry: 0,
initializedWptr: false
};
_this.onRefresh = null;
return _this;
}
_this.state = {
loadmoreretry: 0
};
_this.onRefresh = null;
// unit is px;
_this.refreshHeight = 150;
return _this;
}
_createClass(ScrollViewTest, [{
key: 'initWeb',
value: function initWeb() {
if (isWeb && !this.state.initializedWptr) {
WebPullToRefresh().init({
bodyEl: this.refs.scroller,
ptrEl: this.refs.refreshX,
contentEl: this.refs.contentContainer,
distanceToRefresh: this.props.distanceToRefresh || undefined,
loadingFunction: this.handleRefresh,
resistance: this.props.resistance || undefined,
hammerOptions: this.props.hammerOptions || { touchAction: 'auto' }
});
this.setState({
initializedWptr: true
});
}
}
}, {
key: 'componentDidMount',
value: function componentDidMount() {
if (!this.props.disabledPtr) {
this.initWeb();
}
}
}, {
key: 'componentDidUpdate',
value: function componentDidUpdate() {
if (!this.props.disabledPtr) {
this.initWeb();
}
}
}, {
key: 'render',
value: function render() {
var _this2 = this;
_createClass(ScrollViewTest, [{
key: 'render',
value: function render() {
var _this2 = this;
var _props = this.props,
id = _props.id,
style = _props.style,
scrollEventThrottle = _props.scrollEventThrottle,
showsHorizontalScrollIndicator = _props.showsHorizontalScrollIndicator,
showsVerticalScrollIndicator = _props.showsVerticalScrollIndicator,
onEndReached = _props.onEndReached,
onEndReachedThreshold = _props.onEndReachedThreshold,
onScroll = _props.onScroll,
children = _props.children;
var _props = this.props,
id = _props.id,
style = _props.style,
scrollEventThrottle = _props.scrollEventThrottle,
showsHorizontalScrollIndicator = _props.showsHorizontalScrollIndicator,
showsVerticalScrollIndicator = _props.showsVerticalScrollIndicator,
onEndReached = _props.onEndReached,
onEndReachedThreshold = _props.onEndReachedThreshold,
onScroll = _props.onScroll,
children = _props.children;
// In weex must be int value
// In weex must be int value
onEndReachedThreshold = parseInt(onEndReachedThreshold, 10);
onEndReachedThreshold = parseInt(onEndReachedThreshold, 10);
var contentContainerStyle = [this.props.horizontal && styles.contentContainerHorizontal, this.props.contentContainerStyle];
var contentContainerStyle = [this.props.horizontal && styles.contentContainerHorizontal, this.props.contentContainerStyle];
// bugfix: fix scrollview flex in ios 78
if (!isWeex && !this.props.horizontal) {
contentContainerStyle.push(styles.containerWebStyle);
}
// bugfix: fix scrollview flex in ios 78
if (!isWeex && !this.props.horizontal) {
contentContainerStyle.push(styles.containerWebStyle);
}
if (this.props.style) {
var childLayoutProps = ['alignItems', 'justifyContent'].filter(function (prop) {
return _this2.props.style[prop] !== undefined;
});
if (this.props.style) {
var childLayoutProps = ['alignItems', 'justifyContent'].filter(function (prop) {
return _this2.props.style[prop] !== undefined;
});
if (childLayoutProps.length !== 0) {
console.warn('ScrollView child layout (' + JSON.stringify(childLayoutProps) + ') must be applied through the contentContainerStyle prop.');
}
}
if (childLayoutProps.length !== 0) {
console.warn('ScrollView child layout (' + JSON.stringify(childLayoutProps) + ') must be applied through the contentContainerStyle prop.');
}
}
var refreshContainer = (0, _rax.createElement)(_nukeView2.default, null),
contentChild = void 0;
if (Array.isArray(children)) {
contentChild = children.map(function (child, index) {
if (child && child.type == _nukeRefreshControl2.default) {
refreshContainer = child;
_this2.onRefresh = child.props.onRefresh;
} else {
return child;
}
});
} else {
contentChild = children;
}
var refreshContainer = null;
var contentChild = void 0;
if (Array.isArray(children)) {
contentChild = children.map(function (child, index) {
if (child && child.type && child.type.displayName == _nukeRefreshControl2.default.displayName) {
refreshContainer = child;
// format to px
_this2.refreshHeight = child.props.style && formatRemToPx(child.props.style.height);
_this2.onRefresh = child.props.onRefresh;
} else {
return child;
}
});
} else {
contentChild = children;
}
var contentContainer = (0, _rax.createElement)(
_nukeView2.default,
{
ref: 'contentContainer',
style: contentContainerStyle },
contentChild
);
var contentContainer = (0, _rax.createElement)(
_nukeView2.default,
{ ref: 'contentContainer', style: contentContainerStyle },
contentChild
);
var baseStyle = this.props.horizontal ? styles.baseHorizontal : styles.baseVertical;
var baseStyle = this.props.horizontal ? styles.baseHorizontal : styles.baseVertical;
var scrollerStyle = _extends({}, baseStyle, this.props.style);
var scrollerStyle = _extends({}, baseStyle, this.props.style);
var showsScrollIndicator = this.props.horizontal ? showsHorizontalScrollIndicator : showsVerticalScrollIndicator;
var showsScrollIndicator = this.props.horizontal ? showsHorizontalScrollIndicator : showsVerticalScrollIndicator;
if (isWeex) {
return (0, _rax.createElement)(
'scroller',
_extends({}, this.props, {
ref: 'scroller',
style: scrollerStyle,
showScrollbar: showsScrollIndicator,
onLoadmore: onEndReached,
onScroll: onScroll ? this.handleScroll : null,
loadmoreoffset: onEndReachedThreshold,
loadmoreretry: this.state.loadmoreretry,
scrollDirection: this.props.horizontal ? 'horizontal' : 'vertical'
}),
refreshContainer,
contentContainer
);
} else {
var _Object$assign;
if (isWeex) {
return (0, _rax.createElement)(
'scroller',
_extends({}, this.props, {
ref: 'scroller',
style: scrollerStyle,
showScrollbar: showsScrollIndicator,
onLoadmore: onEndReached,
onScroll: onScroll ? this.handleScroll : null,
loadmoreoffset: onEndReachedThreshold,
loadmoreretry: this.state.loadmoreretry,
scrollDirection: this.props.horizontal ? 'horizontal' : 'vertical'
}),
refreshContainer,
contentContainer
);
} else {
var handleScroll = this.handleScroll;
if (scrollEventThrottle) {
handleScroll = throttle(handleScroll, scrollEventThrottle);
}
var handleScroll = this.handleScroll;
if (scrollEventThrottle) {
handleScroll = throttle(handleScroll, scrollEventThrottle);
}
if (!showsScrollIndicator && !document.getElementById('rax-scrollview-style')) {
var styleNode = document.createElement('style');
styleNode.id = 'rax-scrollview-style';
document.head.appendChild(styleNode);
styleNode.innerHTML = '.' + this.props.className + '::-webkit-scrollbar{display: none;}';
}
if (!showsScrollIndicator && !document.getElementById('rax-scrollview-style')) {
var styleNode = document.createElement('style');
styleNode.id = 'rax-scrollview-style';
document.head.appendChild(styleNode);
styleNode.innerHTML = '.' + this.props.className + '::-webkit-scrollbar{display: none;}';
}
scrollerStyle.webkitOverflowScrolling = 'touch';
scrollerStyle.overflow = 'scroll';
scrollerStyle.webkitOverflowScrolling = 'touch';
scrollerStyle.overflow = 'scroll';
var webProps = _extends({}, this.props, {
ref: 'scroller',
style: scrollerStyle,
onScroll: handleScroll
});
delete webProps.onEndReachedThreshold;
if (this.props.disabledPtr) {
return (0, _rax.createElement)(
_nukeView2.default,
webProps,
contentContainer
);
}
return (0, _rax.createElement)(
_nukeView2.default,
webProps,
(0, _rax.cloneElement)(refreshContainer, {
ref: "refreshX",
className: "ptr-element",
style: Object.assign((_Object$assign = { position: 'absolute', top: 0, left: 0, width: 750, color: '#aaaaaa' }, _defineProperty(_Object$assign, 'z-index', 10), _defineProperty(_Object$assign, 'textAlign', 'center'), _Object$assign), refreshContainer.props.style)
}),
contentContainer
);
}
var webProps = _extends({}, this.props, {
ref: 'scroller',
style: scrollerStyle,
onScroll: handleScroll
});
delete webProps.onEndReachedThreshold;
if (this.props.disabledPtr) {
return (0, _rax.createElement)(
_nukeView2.default,
webProps,
contentContainer
);
}
}]);
if (refreshContainer) {
var childEle = (0, _rax.cloneElement)(refreshContainer);
var childProps = childEle.props;
return (0, _rax.createElement)(
_nukeView2.default,
_extends({}, webProps, { id: 'scroller_rv' }),
(0, _rax.createElement)(
_webRefreshControl2.default,
{
listId: 'scroller_rv',
refreshingTime: 100,
height: this.refreshHeight,
refreshing: childProps.refreshing,
onRefresh: this.onRefresh
},
childEle
),
contentContainer
);
} else {
return (0, _rax.createElement)(
_nukeView2.default,
_extends({}, webProps, { id: 'scroller_rv' }),
contentContainer
);
}
}
}
}]);
return ScrollViewTest;
return ScrollViewTest;
}(_rax.Component);
ScrollViewTest.defaultProps = {
scrollEventThrottle: DEFAULT_SCROLL_CALLBACK_THROTTLE,
onEndReachedThreshold: DEFAULT_END_REACHED_THRESHOLD,
showsHorizontalScrollIndicator: true,
showsVerticalScrollIndicator: true,
className: 'rax-scrollview'
scrollEventThrottle: DEFAULT_SCROLL_CALLBACK_THROTTLE,
onEndReachedThreshold: DEFAULT_END_REACHED_THRESHOLD,
showsHorizontalScrollIndicator: true,
showsVerticalScrollIndicator: true,
className: 'rax-scrollview'
};

@@ -340,37 +336,37 @@

function throttle(func, wait) {
var ctx, args, rtn, timeoutID;
var last = 0;
var ctx, args, rtn, timeoutID;
var last = 0;
function call() {
timeoutID = 0;
last = +new Date();
rtn = func.apply(ctx, args);
ctx = null;
args = null;
}
function call() {
timeoutID = 0;
last = +new Date();
rtn = func.apply(ctx, args);
ctx = null;
args = null;
}
return function throttled() {
ctx = this;
args = arguments;
var delta = new Date() - last;
if (!timeoutID) if (delta >= wait) call();else timeoutID = setTimeout(call, wait - delta);
return rtn;
};
return function throttled() {
ctx = this;
args = arguments;
var delta = new Date() - last;
if (!timeoutID) if (delta >= wait) call();else timeoutID = setTimeout(call, wait - delta);
return rtn;
};
}
var styles = {
baseVertical: {
flex: 1,
flexDirection: 'column'
},
baseHorizontal: {
flex: 1,
flexDirection: 'row'
},
contentContainerHorizontal: {
flexDirection: 'row'
},
containerWebStyle: {
display: 'block'
}
baseVertical: {
flex: 1,
flexDirection: 'column'
},
baseHorizontal: {
flex: 1,
flexDirection: 'row'
},
contentContainerHorizontal: {
flexDirection: 'row'
},
containerWebStyle: {
display: 'block'
}
};

@@ -377,0 +373,0 @@

{
"name": "nuke-scroll-view",
"version": "1.0.0",
"version": "1.0.1",
"description": "滚动组件",
"main": "lib/index",
"files": [
"lib",
"docs",
"theme",
"README.md",
"HISTORY.md"
],
"keywords": [
"nuke",
"nuke-scroll-view"
],
"files": ["lib", "docs", "theme", "README.md", "HISTORY.md"],
"keywords": ["nuke", "nuke-scroll-view"],
"author": {

@@ -47,3 +38,2 @@ "name": "leanhunter",

"dependencies": {
"hammerjs": "^2.0.8",
"nuke-env": "^1.x.x",

@@ -56,3 +46,3 @@ "nuke-refresh-control": "^1.x.x",

"nuke-button": "^1.x.x",
"nuke-modal": "^0.x.x",
"nuke-modal": "^1.x.x",
"nuke-text": "^0.x.x"

@@ -59,0 +49,0 @@ },

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