我有一个视图(tribeProduct),它生成滚动视图中包含的曲面列表,我想要做的是创建一个事件,当视图被拖动时#34;下来,一个动画发挥作用。以下是我到目前为止由于某种原因无法正常工作。
for (var t = 0; t < tribesLength; t++) {
var tribe = new TribesView({tribes: tribes, tribe: t});
if(tribes[t]['notifications'] > 0) {
// Create view with list of surfaces contained in a scroll view
var tribeProduct = new ProductView({tribes: tribes, tribe: t});
var productModifier = new Modifier({
opacity: 0,
transform: Transform.translate(window.innerWidth * 1, 0, 100)
});
productContext.add(productModifier).add(tribeProduct);
tribe.on('click', function(e) {
var tribeProduct = this[0];
var productModifier = this[1];
productModifier.setOpacity(1, { duration: 500 });
productModifier.setTransform(Transform.translate(0, 0, 100), { duration: 500, curve: Easing.inOutBack });
var handleSwipe = new GenericSync(
['mouse', 'touch'],
{ direction: GenericSync.DIRECTION_Y }
);
tribeProduct.pipe(handleSwipe);
handleSwipe.on('end', (function(data) {
console.log('test');
var position = data.position;
var startPos = 100;
if(position > startPos) {
this
.setOpacity(
0, { duration: 500, curve: 'easeInOut' }
)
.setTransform(
Transform.translate(0, startPos + 200, 0), { duration: 500, curve: 'easeInOut' }
);
}
console.log(position);
}).bind(productModifier));
}.bind([tribeProduct, productModifier]));
}
tribe.pipe(scrollView);
surfaces.push(tribe);
}
答案 0 :(得分:1)
我有一个类似的问题,它的目标是拉动刷新,但它也回答了你的问题。或者至少我相信它。
Scrollview Pull to Refresh Famo.us
使用John Traver的响应我想出了refreshScrollView:
https://github.com/vizidrix/famous
如果您查看代码,我认为它会有所帮助。