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

nuke-list

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nuke-list - npm Package Compare versions

Comparing version 0.0.24 to 0.0.25

18

cell/index.js

@@ -18,17 +18,17 @@ /** @jsx createElement */

constructor(props) {
constructor(props) {
super(props);
}
render(){
render(){
if (isWeex) {
return <cell append="tree">{this.props.children}</cell>
if (isWeex) {
return <cell append="tree" {...this.props}>{this.props.children}</cell>
}else{
return <View>{this.props.children}</View>
}else{
return <View {...this.props}>{this.props.children}</View>
}
}
}
}

@@ -35,0 +35,0 @@ }

@@ -5,6 +5,3 @@ /** @jsx createElement */

import {Component, createElement, findDOMNode} from 'weex-rx';
import {Dimensions, env} from 'nuke-core';
import { View, Text} from 'nuke-components';
const isWeex = env.isWeex;
import Loading from './loading';

@@ -15,155 +12,4 @@ import Refresh from './refresh';

function throttle(func, wait) {
var ctx, args, rtn, timeoutID;
var last = 0;
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;
};
function call() {
timeoutID = 0;
last = +new Date();
rtn = func.apply(ctx, args);
ctx = null;
args = null;
}
}
class List extends Component {
export {Loading, Refresh, Header , Cell};
initScroll() {
let props = this.props;
let throttleNum = props.throttle || 100;
if (!isWeex && props.onLoadMore) {
this._EventHandler = window.addEventListener('scroll', throttle((event) => {
let st = document.body.scrollTop,
vh = window.innerHeight,
bodyHeight = document.body.scrollHeight;
let offset = props.loadMoreOffset || props.loadmoreoffset || 100;
if (bodyHeight - offset <= (st + vh)) {
props.onLoadMore();
}
}, throttleNum));
}
}
scrollTo = (place) => {
let self = this;
let x = place.x;
let y = place.y;
if (!x) {
x = 0;
}
let width;
if (typeof(x) == 'string' && x.split('rem').length) {
width = parseInt(x.split('rem')[0]) / 750 * Dimensions.get('window').width;
} else {
width = parseInt(x);
}
if (!y) {
y = 0;
}
let height;
if (typeof(y) == 'string' && y.split('rem').length) {
height = parseInt(y.split('rem')[0]) / 750 * Dimensions.get('window').height;
} else {
height = parseInt(y);
}
if (isWeex) {
let dom = require('@weex-module/dom');
let scroller = findDOMNode(self.refs.scroller);
if (!width) {
width = height;
}
dom.scrollToElement(scroller.ref, {
offset: width
});
} else {
findDOMNode(self.refs.scroller).scrollTop = height;
findDOMNode(self.refs.scroller).scrollLeft = width;
}
}
render() {
let props = this.props;
let self = this;
let styleProp = {
...styles.base,
...props.style
};
if (props.horizontal) {
self.scrollBoxWidthRem = 0;
if (props.children.length) {
props.children.map(function(item) {
let itemWidth = item.props.style.width;
if (itemWidth) {
self.scrollBoxWidthRem += parseInt(itemWidth.split('rem')[0]);
}
});
} else {
self.scrollBoxWidthRem += parseInt(props.children.props.style.width.split('rem')[0]);
}
styles.scrollBox.width = '' + self.scrollBoxWidthRem + 'rem';
if (isWeex) {
return <list {...props} style={styleProp} scrollDirection="horizontal">
{props.children}
</list>;
} else {
return <View ref="scroller" {...props} style={styleProp} >
<View style={styles.scrollBox}>
{props.children}
</View>
</View>;
}
} else {
self.initScroll();
styleProp.webkitOverflowScrolling = 'touch';
if (isWeex) {
styleProp.height = Dimensions.get('window').height;
return <list {...props} style={styleProp} >
{props.children}
</list>;
} else {
return <View ref="scroller" {...props} style={styleProp} />;
}
}
}
}
const styles = {
base: {
overflow: 'scroll',
flex: 1
},
scrollBox: {
display: 'block',
width: '2000rem',
justifyContent:'center',
flexDirection:'row'
}
};
// list.Loading = Loading;
// list.Refresh = Refresh;
// list.Header = Header;
export {Loading, Refresh, Header , Cell};
export default List;
{
"name": "nuke-list",
"version": "0.0.24",
"version": "0.0.25",
"description": "",

@@ -10,4 +10,4 @@ "main": "index.js",

"dependencies": {
"nuke-components": "^0.0.29",
"nuke-core": "^0.0.20"
"nuke-components": "^0.0.30",
"nuke-core": "^0.0.21"
},

@@ -14,0 +14,0 @@ "author": "heww@live.cn",

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