const patchListView = require("./patchListView");
const ListView = patchListView(React.ListView);
Last active
December 16, 2015 18:57
-
-
Save gre/16f4235d23659c7d4374 to your computer and use it in GitHub Desktop.
NOT WORKING attempt to workaround https://github.com/facebook/react-native/issues/3452
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const React = require("react-native"); | |
module.exports = ListView => { | |
const Wrapper = React.createClass({ | |
getScrollResponder() { | |
return this.refs.lv.getScrollResponder(); | |
}, | |
setNativeProps (props) { | |
const {lv} = this.refs; | |
if (lv) lv.setNativeProps(props); | |
}, | |
render () { | |
return <ListView | |
{...this.props} | |
ref="lv" | |
onTouchStart={this._onTouchStart} | |
onTouchEnd={this._onTouchEnd} | |
/>; | |
}, | |
_onTouchStart (e) { | |
const { onTouchStart } = this.props; | |
this.setNativeProps({ pointerEvents: "none" }); | |
if (onTouchStart) onTouchStart(e); | |
}, | |
_onTouchEnd (e) { | |
const { onTouchEnd } = this.props; | |
this.setNativeProps({ pointerEvents: "auto" }); | |
if (onTouchEnd) onTouchEnd(e); | |
} | |
}); | |
Wrapper.DataSource = ListView.DataSource; | |
return Wrapper; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment