Skip to content

Latest commit

 

History

History
37 lines (34 loc) · 669 Bytes

12.refesh.md

File metadata and controls

37 lines (34 loc) · 669 Bytes

RefreshControl

  • 使用於 ScrollView、ListView 下拉刷新
  • FlatList 以內建支援

使用教學

onRefresh = () => {
  this.setState({isRefreshing: true});
  setTimeout(() => {
    this.setState({
      isRefreshing: false
    })
  }, 1000);
}

render() {
  return (
    <ScrollView
     refreshControl={
       <RefreshControl
          refreshing={this.state.isRefreshing}
          onRefresh={this.onRefresh}
       />
     }
    >
      <ListItem key={1} />
      <ListItem key={2} />
      <ListItem key={3} />
      <ListItem key={4} />
      <ListItem key={5} />
      <ListItem key={6} />
      <ListItem key={7} />
    </ScrollView>
  );
}