Code Monkey home page Code Monkey logo

Comments (3)

osdio avatar osdio commented on May 30, 2024

恩恩,这是个bug, 我待会看看,

from noder-react-native.

jShi-git avatar jShi-git commented on May 30, 2024

@soliury

这是react native本身的组件兼容bug,可以看下这个
http://www.codeismoney.com/ReactNative/262_React-Native-ListView-onEndReached.html

http://stackoverflow.com/questions/30262404/react-native-infinite-scroll

from noder-react-native.

jShi-git avatar jShi-git commented on May 30, 2024

@soliury

自己改了下,效果还可以,不用改页面结构,参考上面贴的stackoverflow的帖子
修改 layouts/TopicList.js

constructor(props) {
super(props);
var ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
this.state = {
isLoadingTail: false,
ds: ds.cloneWithRows(props.data)
};
this.shouldComponentUpdate = PureRenderMixin.shouldComponentUpdate.bind(this);
}
getSCData() {
const {tab, limit, page, actions, data} = this.props;
if (data.length) {
actions.getTopicsByTab(tab, {
page: page + 1,
limit
});
this.setState({
isLoadingTail: false
});
}
}
_onEndReached() {
if (this.state.isLoadingTail) {
return;
}
this.setState({
isLoadingTail: true,
dataSource: this.getSCData()
});
console.log('onEndReached', this.state.isLoadingTail);
}

from noder-react-native.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.