bindingx
bindingx copied to clipboard
react-native bind scroller 横向滚动失败
react-native 下面使用 bindingx, 当 ScrollView 设置 横向滚动,horizontal={true} 时,不会生效。 JSX:
<View
ref={c => { this.instance = c }}
style={{
// position: 'absolute',
// top: 270,
height: 300,
width: '100%',
backgroundColor: 'red'
}}/>
<ScrollView horizontal={true} ref={c => { this.carouselRef = c }}>
{images}
</ScrollView>
JS:
let anchor = findNodeHandle(this.carouselRef)
let target = findNodeHandle(this.instance);
let token = bindingx.bind({
eventType: 'scroll',
anchor: anchor,
props: [
{
element: target,
property: 'transform.translateY',
expression: 'x+0'
}
]
}, this.onStateChange);
this._token = token.token;