diff --git a/components/CellWrapper.js b/components/CellWrapper.js index 6b17c6c..40cc244 100644 --- a/components/CellWrapper.js +++ b/components/CellWrapper.js @@ -1,7 +1,9 @@ 'use strict'; -var React = require('react-native'); -var {Component, PropTypes, View} = React; +var ReactNative = require('react-native'); +var {View} = ReactNative; +var React = require('react'); +var {Component, PropTypes} = React; class CellWrapper extends Component { diff --git a/components/SectionHeader.js b/components/SectionHeader.js index b9b6363..b1fc30d 100644 --- a/components/SectionHeader.js +++ b/components/SectionHeader.js @@ -1,8 +1,9 @@ 'use strict'; -var React = require('react-native'); -var {Component, PropTypes, StyleSheet, View, Text} = React; -var UIManager = require('NativeModules').UIManager; +var ReactNative = require('react-native'); +var {StyleSheet, View, Text, UIManager} = ReactNative; +var React = require('react'); +var {Component, PropTypes} = React; class SectionHeader extends Component { componentDidMount() { diff --git a/components/SectionList.js b/components/SectionList.js index 8880812..16215f2 100644 --- a/components/SectionList.js +++ b/components/SectionList.js @@ -1,8 +1,9 @@ 'use strict'; -var React = require('react-native'); -var {Component, PropTypes, StyleSheet, View, Text} = React; -var UIManager = require('NativeModules').UIManager; +var ReactNative = require('react-native'); +var {StyleSheet, View, Text, UIManager} = ReactNative; +var React = require('react'); +var {Component, PropTypes} = React; var noop = () => {}; var returnTrue = () => true; @@ -76,6 +77,7 @@ class SectionList extends Component { onResponderGrant={this.detectAndScrollToSection} onResponderMove={this.detectAndScrollToSection} onResponderRelease={this.resetSection} + onResponderTerminationRequest={() => false} > {sections} diff --git a/components/SelectableSectionsListView.js b/components/SelectableSectionsListView.js index 099ad3b..1b2418c 100644 --- a/components/SelectableSectionsListView.js +++ b/components/SelectableSectionsListView.js @@ -1,10 +1,10 @@ 'use strict'; /* jshint esnext: true */ -var React = require('react-native'); -var {Component, ListView, StyleSheet, View, PropTypes} = React; -var UIManager = require('NativeModules').UIManager; -var merge = require('merge'); +var ReactNative = require('react-native'); +var {StyleSheet, View, PropTypes, UIManager, ListView} = ReactNative; +var React = require('react'); +var {Component, PropTypes} = React; var SectionHeader = require('./SectionHeader'); var SectionList = require('./SectionList'); @@ -47,7 +47,7 @@ class SelectableSectionsListView extends Component { componentDidMount() { // push measuring into the next tick setTimeout(() => { - UIManager.measure(this.refs.view.getNodeHandle(), (x,y,w,h) => { + UIManager.measure(ReactNative.findNodeHandle(this.refs.view), (x,y,w,h) => { this.containerHeight = h; }); }, 0); @@ -108,12 +108,12 @@ class SelectableSectionsListView extends Component { var maxY = this.totalHeight - this.containerHeight + headerHeight; y = y > maxY ? maxY : y; - this.refs.listview.refs.listviewscroll.scrollTo(y, 0); + this.refs.listview.getScrollResponder().scrollTo({y:y, x:0, animated:true}); } else { // this breaks, if not all of the listview is pre-rendered! UIManager.measure(this.cellTagMap[section], (x, y, w, h) => { y = y - this.props.sectionHeaderHeight; - this.refs.listview.refs.listviewscroll.scrollTo(y, 0); + this.refs.listview.getScrollResponder().scrollTo({y:y, x:0, animated:true}); }); } @@ -225,7 +225,10 @@ class SelectableSectionsListView extends Component { this.renderHeader : this.props.renderHeader; - var props = merge(this.props, { + var props = {}; + for(var p in this.props) + props[p] = this.props[p]; + var otherProps = { onScroll: this.onScroll, onScrollAnimationEnd: this.onScrollAnimationEnd, dataSource, @@ -233,7 +236,9 @@ class SelectableSectionsListView extends Component { renderHeader, renderRow: this.renderRow, renderSectionHeader - }); + }; + for(var p in otherProps) + props[p] = otherProps[p]; props.style = void 0; diff --git a/package.json b/package.json index d77f477..6659e93 100644 --- a/package.json +++ b/package.json @@ -18,9 +18,9 @@ "ios" ], "devDependencies": { - "react-native": ">=0.3.4 <0.5.0" + "react-native": ">=0.3.4" }, "peerDependencies": { - "react-native": ">=0.3.4 <0.5.0" + "react-native": ">=0.3.4" } }