Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
closePop = () => {
const icon = findDOMNode(this.refs.icon);
Animated.rotate(icon, 360);
const dropMultiRow = findDOMNode(this.refs.dropMultiRow);
Animated.height(dropMultiRow, 0);
if (!this.closePopIndex) {
this.closePopIndex = 1;
}
this.closePopIndex++;
this.state.weexGridTop = -1000 - this.closePopIndex; // fix for android
this.state.weexGridLeft = -1000 - this.closePopIndex;
this.state.weexGridPosition = 'relative';
this.state.weexGridHeight = 0;
this.setState(this.state);
}
} else {
this.index = index;
}
this.offsetX = this.index * this.width;
const realIndex = this.loopedIndex();
// translate3d for performance optimization
let swipeView = findDOMNode(this.refs.swipeView);
const styleText = `translate3d(${-1 * this.offsetX}px, 0px, 0px)`;
swipeView.style.transform = styleText;
swipeView.style.webkitTransform = styleText;
this.loopIdx = this.index < 0 && realIndex !== 0 ? this.total - realIndex : realIndex;
let childNum = 'child' + this.loopIdx;
let childView = findDOMNode(this.refs[childNum]);
childView.style.left = this.offsetX + 'px';
this.props.onChange({index: this.loopIdx});
this.setState({
offsetX: this.offsetX
});
}
function getEl(el) {
return isWeex ? findDOMNode(el).ref : findDOMNode(el);
}
click = (event) => {
const {onTop, onPress} = this.props;
onPress && onPress();
if (isWeex) {
let dom = __weex_require__('@weex-module/dom');
let top = findDOMNode('rx-top');
dom.scrollToElement(top.ref, {
offset: 0
});
} else {
event.preventDefault();
scroll.scrollToTop({
duration: 300
});
}
onTop && onTop();
}
function getEl(el) {
return isWeex ? findDOMNode(el).ref : findDOMNode(el);
}
scrollTo = (options) => {
let x = parseInt(options.x);
let y = parseInt(options.y);
let animated = options && typeof options.animated !== 'undefined' ? options.animated : true;
if (isWeex) {
let dom = __weex_require__('@weex-module/dom');
let contentContainer = findDOMNode(this.refs.contentContainer);
dom.scrollToElement(contentContainer.ref, {
offset: x || y || 0,
animated
});
} else {
let pixelRatio = document.documentElement.clientWidth / FULL_WIDTH;
let scrollView = findDOMNode(this.refs.scroller);
let scrollLeft = scrollView.scrollLeft;
let scrollTop = scrollView.scrollTop;
if (animated) {
let timer = new Timer({
duration: 400,
easing: 'easeOutSine',
onRun: (e) => {
if (x >= 0) {
function getEl(el) {
return isWeex ? findDOMNode(el).ref : findDOMNode(el);
}
scrollTo = (options) => {
if (this.props.animType != 'noanim') {
const animbuoy = findDOMNode(this.refs.animbuoy);
Animated.scrollTo(animbuoy, options);
}
}
render() {
let {bindingScroller} = this.props;
if (!bindingScroller) return null;
let scroller = isWeex ? findDOMNode(bindingScroller).ref : findDOMNode(bindingScroller);
if (isSupportBinding || !isWeex) {
return ;
}
return isWeex ? :
if (isWeex) {
try {
let dom = __weex_require__('@weex-module/dom');
let k = parseInt(750 / tabItemWidth / 2);
let selected = this.refs[`tab_${this.state.selectedIndex - k}`];
if (selected) {
dom.scrollToElement(findDOMNode(selected), {
offset: 0
});
}
} catch (e) {
//
}
} else {
if (findDOMNode(this.refs.ScrollBar)) {
this.refs.ScrollBar.scrollTo({x: scrollLen});
}
}
}