Is this a bug report?
Yes
Have you read the Bugs section of the Contributing to React Native Guide?
Yes
Environment
-
react-native -v
: 0.4.5 -
node -v
: 7.4.0 -
npm -v
: 5.0.3 -
yarn --version
(if you use Yarn): 0.24.5
Then, specify:
- Target Platform (e.g. iOS, Android): iOS
- Development Operating System (e.g. macOS Sierra, Windows 10): macOs Sierra
- Build tools (Xcode or Android Studio version, iOS or Android SDK version, if relevant): XCode 8.3.3
Steps to Reproduce
- Implement React-Native FlatList in a module.
- Render a component in renderItems prop
- nest FlatList inside `` element
- Pull up on device to attempt to refresh
Expected Behavior
Call onRefresh function on pull up.
Actual Behavior
onRefresh function is not called.
Reproducible Demo
Snack Link: https://snack.expo.io/HJYx3Kx4W
... constructor(props) { super(props); this.state = { stories: [], isFetching: false, }; } componentDidMount() { this.fetchData() } onRefresh() { this.setState({ isFetching: true }, function() { this.fetchData() }); } fetchData() { var that = this; axios.get('http://192.168.0.13:3000/api/story/get/by/geo') .then((res) => { that.setState({ stories: res.data, isFetching: false }); that.props.dispatch(StoryActions.setStories(res.data)) }) } render() { return ( this.onRefresh()} refreshing={this.state.isFetching} data={this.state.stories} keyExtractor={(item, index) => item.id} renderItem={({item}) => ( )} /> ) }
Origin link: https://github.com/facebook/react-native/issues/14756
Top comments (0)