Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions components/CellWrapper.js
Original file line number Diff line number Diff line change
@@ -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 {

Expand Down
7 changes: 4 additions & 3 deletions components/SectionHeader.js
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down
8 changes: 5 additions & 3 deletions components/SectionList.js
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -76,6 +77,7 @@ class SectionList extends Component {
onResponderGrant={this.detectAndScrollToSection}
onResponderMove={this.detectAndScrollToSection}
onResponderRelease={this.resetSection}
onResponderTerminationRequest={() => false}
>
{sections}
</View>
Expand Down
23 changes: 14 additions & 9 deletions components/SelectableSectionsListView.js
Original file line number Diff line number Diff line change
@@ -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');
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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});
});
}

Expand Down Expand Up @@ -225,15 +225,20 @@ 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,
renderFooter,
renderHeader,
renderRow: this.renderRow,
renderSectionHeader
});
};
for(var p in otherProps)
props[p] = otherProps[p];

props.style = void 0;

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}