{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react-native/issues/5560","repository_url":"https://api.github.com/repos/facebook/react-native","labels_url":"https://api.github.com/repos/facebook/react-native/issues/5560/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react-native/issues/5560/comments","events_url":"https://api.github.com/repos/facebook/react-native/issues/5560/events","html_url":"https://github.com/facebook/react-native/issues/5560","id":128910663,"number":5560,"title":"PullToRefreshViewAndroid when `refreshing` prop is initially true","user":{"login":"mikemonteith","id":227467,"avatar_url":"https://avatars.githubusercontent.com/u/227467?v=3","gravatar_id":"","url":"https://api.github.com/users/mikemonteith","html_url":"https://github.com/mikemonteith","followers_url":"https://api.github.com/users/mikemonteith/followers","following_url":"https://api.github.com/users/mikemonteith/following{/other_user}","gists_url":"https://api.github.com/users/mikemonteith/gists{/gist_id}","starred_url":"https://api.github.com/users/mikemonteith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikemonteith/subscriptions","organizations_url":"https://api.github.com/users/mikemonteith/orgs","repos_url":"https://api.github.com/users/mikemonteith/repos","events_url":"https://api.github.com/users/mikemonteith/events{/privacy}","received_events_url":"https://api.github.com/users/mikemonteith/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/facebook/react-native/labels/Android","name":"Android","color":"bfe5bf"},{"url":"https://api.github.com/repos/facebook/react-native/labels/Icebox","name":"Icebox","color":"bfd4f2"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-01-26T18:57:46Z","updated_at":"2016-07-29T23:17:50Z","closed_at":"2016-07-29T23:17:50Z","body":"The PullToRefreshViewAndroid component doesn't honour the `refreshing` prop if it is set to true on initial mount.\r\n\r\nThis seems to be because you must call `setRefresh()` _after_ the Android SwipeRefreshView has been measured with `onMeasure()` (http://stackoverflow.com/questions/26858692/swiperefreshlayout-setrefreshing-not-showing-indicator-initially).\r\n\r\nI have a javascript solution to this which involves using `setNativeProps` inside `onLayout()` to force the correct refreshing state. Note the refreshing prop is completely handled outside of `render()`.\r\nThis seems a bit hacky due to the use of onLayout.\r\n\r\n```js\r\n  _onLayout: function(e){\r\n    this.refs[NATIVE_REF].setNativeProps({refreshing: !!this.props.refreshing});\r\n    this.props.onLayout && this.props.onLayout(e);\r\n  },\r\n\r\n  componentDidUpdate: function(nextProps){\r\n    if(this.props.refreshing !== nextProps.refreshing){\r\n      this.refs[NATIVE_REF].setNativeProps({refreshing: !!this.props.refreshing});\r\n    }\r\n\r\n    return true;\r\n  },\r\n\r\n  render: function() {\r\n    return (\r\n      <NativePullToRefresh\r\n        colors={this.props.colors && this.props.colors.map(processColor)}\r\n        enabled={this.props.enabled}\r\n        onRefresh={this._onRefresh}\r\n        progressBackgroundColor={this.props.progressBackgroundColor}\r\n        ref={NATIVE_REF}\r\n        onLayout={this._onLayout}\r\n        size={this.props.size}\r\n        style={this.props.style}>\r\n        {onlyChild(this.props.children)}\r\n      </NativePullToRefresh>\r\n    );\r\n  },\r\n```\r\n\r\nIs there a better way of doing this?\r\nShould it be fixed on the Android side maybe?"},"comment":{"url":"https://api.github.com/repos/facebook/react-native/issues/comments/236316937","html_url":"https://github.com/facebook/react-native/issues/5560#issuecomment-236316937","issue_url":"https://api.github.com/repos/facebook/react-native/issues/5560","id":236316937,"user":{"login":"mkonicek","id":346214,"avatar_url":"https://avatars.githubusercontent.com/u/346214?v=3","gravatar_id":"","url":"https://api.github.com/users/mkonicek","html_url":"https://github.com/mkonicek","followers_url":"https://api.github.com/users/mkonicek/followers","following_url":"https://api.github.com/users/mkonicek/following{/other_user}","gists_url":"https://api.github.com/users/mkonicek/gists{/gist_id}","starred_url":"https://api.github.com/users/mkonicek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkonicek/subscriptions","organizations_url":"https://api.github.com/users/mkonicek/orgs","repos_url":"https://api.github.com/users/mkonicek/repos","events_url":"https://api.github.com/users/mkonicek/events{/privacy}","received_events_url":"https://api.github.com/users/mkonicek/received_events","type":"User","site_admin":false},"created_at":"2016-07-29T23:17:49Z","updated_at":"2016-07-29T23:17:49Z","body":"Hi there! This issue is being closed because it has been inactive for a while.\n\nBut don't worry, it will live on with ProductPains! Check out its new home: https://productpains.com/post/react-native/pulltorefreshviewandroid-when-refreshing-prop-is-initially-true\n\nProductPains helps the community prioritize the most important issues thanks to its voting feature.\nIt is easy to use - just login with GitHub. GitHub issues have voting too, nevertheless\nProduct Pains has been very useful in highlighting the top bugs and feature requests:\nhttps://productpains.com/product/react-native?tab=top\n\nAlso, if this issue is a bug, **please consider sending a pull request with a fix**.\nWe're a small team and rely on the community for bug fixes of issues that don't affect fb apps.\n"}}
{"actor":{"display_login":"mkonicek"}}