{"action":"created","comment":{"url":"https://api.github.com/repos/ant-design/ant-design-mobile/pulls/comments/87749109","pull_request_review_id":8347658,"id":87749109,"diff_hunk":"@@ -38,74 +34,62 @@ const ViewPager = React.createClass<ViewPagerProps, any>({\n       autoplay: false,\n       autoplayTimeout: 2.5,\n       selectedIndex: 0,\n+      // vertical 目前只实现 pagination，内容 vertical 由于自动高度拿不到，暂时无法实现\n+      vertical: false,\n     };\n   },\n \n-  componentWillMount() {\n-    this.state = this.initState(this.props);\n-  },\n-\n-  componentDidMount() {\n-    this.autoplay();\n-  },\n-\n-  initState(props) {\n-    // set the current state\n-    // const state = this.state || {};\n+  getInitialState() {\n+    const props = this.props;\n     const count = props.children ? props.children.length || 1 : 0;\n-    width = props.width || width;\n-    height = props.height || height;\n     const selectedIndex = count > 1 ? Math.min(props.selectedIndex, count - 1) : 0;\n-\n-    let initState = {\n-      width,\n-      height,\n+    this.count = count;\n+    return {\n+      width: 0,\n       isScrolling: false,\n       autoplayEnd: false,\n       loopJump: false,\n-      count,\n       selectedIndex,\n-      offset: {\n-        x: width * (selectedIndex + (props.infinite ? 1 : 0)),\n-        y: 0,\n-      },\n+      offset: { x: 0, y: 0 },\n     };\n+  },\n \n-    return initState;\n+  componentDidMount() {\n+    this.autoplay();\n   },\n \n   loopJump() {\n-    if (this.state.loopJump) {\n+    if (this.state.loopJump && Platform.OS === 'android') {\n       const index = this.state.selectedIndex + (this.props.infinite ? 1 : 0);\n-      setTimeout(() => (this.refs as any).scrollview.setPageWithoutAnimation\n-      && (this.refs as any).scrollview.setPageWithoutAnimation(index), 50);\n+      setTimeout(() => {","path":"components/carousel/index.tsx","position":83,"original_position":83,"commit_id":"a7bd7a25cf308763cfb7986902316e23ad6a6645","original_commit_id":"399ffa16f914ae03bb7b5c49282269f95020392f","user":{"login":"afc163","id":507615,"avatar_url":"https://avatars.githubusercontent.com/u/507615?v=3","gravatar_id":"","url":"https://api.github.com/users/afc163","html_url":"https://github.com/afc163","followers_url":"https://api.github.com/users/afc163/followers","following_url":"https://api.github.com/users/afc163/following{/other_user}","gists_url":"https://api.github.com/users/afc163/gists{/gist_id}","starred_url":"https://api.github.com/users/afc163/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afc163/subscriptions","organizations_url":"https://api.github.com/users/afc163/orgs","repos_url":"https://api.github.com/users/afc163/repos","events_url":"https://api.github.com/users/afc163/events{/privacy}","received_events_url":"https://api.github.com/users/afc163/received_events","type":"User","site_admin":false},"body":"setTimeout 在销毁的时候要清除。","created_at":"2016-11-14T07:30:28Z","updated_at":"2016-11-14T07:32:09Z","html_url":"https://github.com/ant-design/ant-design-mobile/pull/524#discussion_r87749109","pull_request_url":"https://api.github.com/repos/ant-design/ant-design-mobile/pulls/524","_links":{"self":{"href":"https://api.github.com/repos/ant-design/ant-design-mobile/pulls/comments/87749109"},"html":{"href":"https://github.com/ant-design/ant-design-mobile/pull/524#discussion_r87749109"},"pull_request":{"href":"https://api.github.com/repos/ant-design/ant-design-mobile/pulls/524"}}},"pull_request":{"url":"https://api.github.com/repos/ant-design/ant-design-mobile/pulls/524","id":93517538,"html_url":"https://github.com/ant-design/ant-design-mobile/pull/524","diff_url":"https://github.com/ant-design/ant-design-mobile/pull/524.diff","patch_url":"https://github.com/ant-design/ant-design-mobile/pull/524.patch","issue_url":"https://api.github.com/repos/ant-design/ant-design-mobile/issues/524","number":524,"state":"open","locked":false,"title":"Fix rn carousel","user":{"login":"silentcloud","id":1698185,"avatar_url":"https://avatars.githubusercontent.com/u/1698185?v=3","gravatar_id":"","url":"https://api.github.com/users/silentcloud","html_url":"https://github.com/silentcloud","followers_url":"https://api.github.com/users/silentcloud/followers","following_url":"https://api.github.com/users/silentcloud/following{/other_user}","gists_url":"https://api.github.com/users/silentcloud/gists{/gist_id}","starred_url":"https://api.github.com/users/silentcloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/silentcloud/subscriptions","organizations_url":"https://api.github.com/users/silentcloud/orgs","repos_url":"https://api.github.com/users/silentcloud/repos","events_url":"https://api.github.com/users/silentcloud/events{/privacy}","received_events_url":"https://api.github.com/users/silentcloud/received_events","type":"User","site_admin":false},"body":"- rn carousel 支持根据子视图高度自适应高度；\r\n- 添加 vertical prop，目前只能实现 pagination vertical，原因 scrollView vertical 的时候获取叠加后的单个视图高度比较困难","created_at":"2016-11-14T07:10:07Z","updated_at":"2016-11-14T07:32:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e531dac81b98d1aa336c37a73c574cd6aa195a7f","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ant-design/ant-design-mobile/pulls/524/commits","review_comments_url":"https://api.github.com/repos/ant-design/ant-design-mobile/pulls/524/comments","review_comment_url":"https://api.github.com/repos/ant-design/ant-design-mobile/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ant-design/ant-design-mobile/issues/524/comments","statuses_url":"https://api.github.com/repos/ant-design/ant-design-mobile/statuses/a7bd7a25cf308763cfb7986902316e23ad6a6645","head":{"label":"ant-design:fix-rn-carousel","ref":"fix-rn-carousel","sha":"a7bd7a25cf308763cfb7986902316e23ad6a6645","user":{"login":"ant-design","id":12101536,"avatar_url":"https://avatars.githubusercontent.com/u/12101536?v=3","gravatar_id":"","url":"https://api.github.com/users/ant-design","html_url":"https://github.com/ant-design","followers_url":"https://api.github.com/users/ant-design/followers","following_url":"https://api.github.com/users/ant-design/following{/other_user}","gists_url":"https://api.github.com/users/ant-design/gists{/gist_id}","starred_url":"https://api.github.com/users/ant-design/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ant-design/subscriptions","organizations_url":"https://api.github.com/users/ant-design/orgs","repos_url":"https://api.github.com/users/ant-design/repos","events_url":"https://api.github.com/users/ant-design/events{/privacy}","received_events_url":"https://api.github.com/users/ant-design/received_events","type":"Organization","site_admin":false},"repo":{"id":47093357,"name":"ant-design-mobile","full_name":"ant-design/ant-design-mobile","owner":{"login":"ant-design","id":12101536,"avatar_url":"https://avatars.githubusercontent.com/u/12101536?v=3","gravatar_id":"","url":"https://api.github.com/users/ant-design","html_url":"https://github.com/ant-design","followers_url":"https://api.github.com/users/ant-design/followers","following_url":"https://api.github.com/users/ant-design/following{/other_user}","gists_url":"https://api.github.com/users/ant-design/gists{/gist_id}","starred_url":"https://api.github.com/users/ant-design/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ant-design/subscriptions","organizations_url":"https://api.github.com/users/ant-design/orgs","repos_url":"https://api.github.com/users/ant-design/repos","events_url":"https://api.github.com/users/ant-design/events{/privacy}","received_events_url":"https://api.github.com/users/ant-design/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ant-design/ant-design-mobile","description":"A configurable Mobile UI","fork":false,"url":"https://api.github.com/repos/ant-design/ant-design-mobile","forks_url":"https://api.github.com/repos/ant-design/ant-design-mobile/forks","keys_url":"https://api.github.com/repos/ant-design/ant-design-mobile/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ant-design/ant-design-mobile/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ant-design/ant-design-mobile/teams","hooks_url":"https://api.github.com/repos/ant-design/ant-design-mobile/hooks","issue_events_url":"https://api.github.com/repos/ant-design/ant-design-mobile/issues/events{/number}","events_url":"https://api.github.com/repos/ant-design/ant-design-mobile/events","assignees_url":"https://api.github.com/repos/ant-design/ant-design-mobile/assignees{/user}","branches_url":"https://api.github.com/repos/ant-design/ant-design-mobile/branches{/branch}","tags_url":"https://api.github.com/repos/ant-design/ant-design-mobile/tags","blobs_url":"https://api.github.com/repos/ant-design/ant-design-mobile/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ant-design/ant-design-mobile/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ant-design/ant-design-mobile/git/refs{/sha}","trees_url":"https://api.github.com/repos/ant-design/ant-design-mobile/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ant-design/ant-design-mobile/statuses/{sha}","languages_url":"https://api.github.com/repos/ant-design/ant-design-mobile/languages","stargazers_url":"https://api.github.com/repos/ant-design/ant-design-mobile/stargazers","contributors_url":"https://api.github.com/repos/ant-design/ant-design-mobile/contributors","subscribers_url":"https://api.github.com/repos/ant-design/ant-design-mobile/subscribers","subscription_url":"https://api.github.com/repos/ant-design/ant-design-mobile/subscription","commits_url":"https://api.github.com/repos/ant-design/ant-design-mobile/commits{/sha}","git_commits_url":"https://api.github.com/repos/ant-design/ant-design-mobile/git/commits{/sha}","comments_url":"https://api.github.com/repos/ant-design/ant-design-mobile/comments{/number}","issue_comment_url":"https://api.github.com/repos/ant-design/ant-design-mobile/issues/comments{/number}","contents_url":"https://api.github.com/repos/ant-design/ant-design-mobile/contents/{+path}","compare_url":"https://api.github.com/repos/ant-design/ant-design-mobile/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ant-design/ant-design-mobile/merges","archive_url":"https://api.github.com/repos/ant-design/ant-design-mobile/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ant-design/ant-design-mobile/downloads","issues_url":"https://api.github.com/repos/ant-design/ant-design-mobile/issues{/number}","pulls_url":"https://api.github.com/repos/ant-design/ant-design-mobile/pulls{/number}","milestones_url":"https://api.github.com/repos/ant-design/ant-design-mobile/milestones{/number}","notifications_url":"https://api.github.com/repos/ant-design/ant-design-mobile/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ant-design/ant-design-mobile/labels{/name}","releases_url":"https://api.github.com/repos/ant-design/ant-design-mobile/releases{/id}","deployments_url":"https://api.github.com/repos/ant-design/ant-design-mobile/deployments","created_at":"2015-11-30T03:33:06Z","updated_at":"2016-11-14T01:48:23Z","pushed_at":"2016-11-14T07:31:37Z","git_url":"git://github.com/ant-design/ant-design-mobile.git","ssh_url":"git@github.com:ant-design/ant-design-mobile.git","clone_url":"https://github.com/ant-design/ant-design-mobile.git","svn_url":"https://github.com/ant-design/ant-design-mobile","homepage":"http://mobile.ant.design/","size":39033,"stargazers_count":741,"watchers_count":741,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":101,"mirror_url":null,"open_issues_count":33,"forks":101,"open_issues":33,"watchers":741,"default_branch":"master"}},"base":{"label":"ant-design:master","ref":"master","sha":"76eefd27dc79b8d0cfefc8e28cfe365c00399b6e","user":{"login":"ant-design","id":12101536,"avatar_url":"https://avatars.githubusercontent.com/u/12101536?v=3","gravatar_id":"","url":"https://api.github.com/users/ant-design","html_url":"https://github.com/ant-design","followers_url":"https://api.github.com/users/ant-design/followers","following_url":"https://api.github.com/users/ant-design/following{/other_user}","gists_url":"https://api.github.com/users/ant-design/gists{/gist_id}","starred_url":"https://api.github.com/users/ant-design/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ant-design/subscriptions","organizations_url":"https://api.github.com/users/ant-design/orgs","repos_url":"https://api.github.com/users/ant-design/repos","events_url":"https://api.github.com/users/ant-design/events{/privacy}","received_events_url":"https://api.github.com/users/ant-design/received_events","type":"Organization","site_admin":false},"repo":{"id":47093357,"name":"ant-design-mobile","full_name":"ant-design/ant-design-mobile","owner":{"login":"ant-design","id":12101536,"avatar_url":"https://avatars.githubusercontent.com/u/12101536?v=3","gravatar_id":"","url":"https://api.github.com/users/ant-design","html_url":"https://github.com/ant-design","followers_url":"https://api.github.com/users/ant-design/followers","following_url":"https://api.github.com/users/ant-design/following{/other_user}","gists_url":"https://api.github.com/users/ant-design/gists{/gist_id}","starred_url":"https://api.github.com/users/ant-design/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ant-design/subscriptions","organizations_url":"https://api.github.com/users/ant-design/orgs","repos_url":"https://api.github.com/users/ant-design/repos","events_url":"https://api.github.com/users/ant-design/events{/privacy}","received_events_url":"https://api.github.com/users/ant-design/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ant-design/ant-design-mobile","description":"A configurable Mobile UI","fork":false,"url":"https://api.github.com/repos/ant-design/ant-design-mobile","forks_url":"https://api.github.com/repos/ant-design/ant-design-mobile/forks","keys_url":"https://api.github.com/repos/ant-design/ant-design-mobile/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ant-design/ant-design-mobile/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ant-design/ant-design-mobile/teams","hooks_url":"https://api.github.com/repos/ant-design/ant-design-mobile/hooks","issue_events_url":"https://api.github.com/repos/ant-design/ant-design-mobile/issues/events{/number}","events_url":"https://api.github.com/repos/ant-design/ant-design-mobile/events","assignees_url":"https://api.github.com/repos/ant-design/ant-design-mobile/assignees{/user}","branches_url":"https://api.github.com/repos/ant-design/ant-design-mobile/branches{/branch}","tags_url":"https://api.github.com/repos/ant-design/ant-design-mobile/tags","blobs_url":"https://api.github.com/repos/ant-design/ant-design-mobile/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ant-design/ant-design-mobile/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ant-design/ant-design-mobile/git/refs{/sha}","trees_url":"https://api.github.com/repos/ant-design/ant-design-mobile/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ant-design/ant-design-mobile/statuses/{sha}","languages_url":"https://api.github.com/repos/ant-design/ant-design-mobile/languages","stargazers_url":"https://api.github.com/repos/ant-design/ant-design-mobile/stargazers","contributors_url":"https://api.github.com/repos/ant-design/ant-design-mobile/contributors","subscribers_url":"https://api.github.com/repos/ant-design/ant-design-mobile/subscribers","subscription_url":"https://api.github.com/repos/ant-design/ant-design-mobile/subscription","commits_url":"https://api.github.com/repos/ant-design/ant-design-mobile/commits{/sha}","git_commits_url":"https://api.github.com/repos/ant-design/ant-design-mobile/git/commits{/sha}","comments_url":"https://api.github.com/repos/ant-design/ant-design-mobile/comments{/number}","issue_comment_url":"https://api.github.com/repos/ant-design/ant-design-mobile/issues/comments{/number}","contents_url":"https://api.github.com/repos/ant-design/ant-design-mobile/contents/{+path}","compare_url":"https://api.github.com/repos/ant-design/ant-design-mobile/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ant-design/ant-design-mobile/merges","archive_url":"https://api.github.com/repos/ant-design/ant-design-mobile/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ant-design/ant-design-mobile/downloads","issues_url":"https://api.github.com/repos/ant-design/ant-design-mobile/issues{/number}","pulls_url":"https://api.github.com/repos/ant-design/ant-design-mobile/pulls{/number}","milestones_url":"https://api.github.com/repos/ant-design/ant-design-mobile/milestones{/number}","notifications_url":"https://api.github.com/repos/ant-design/ant-design-mobile/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ant-design/ant-design-mobile/labels{/name}","releases_url":"https://api.github.com/repos/ant-design/ant-design-mobile/releases{/id}","deployments_url":"https://api.github.com/repos/ant-design/ant-design-mobile/deployments","created_at":"2015-11-30T03:33:06Z","updated_at":"2016-11-14T01:48:23Z","pushed_at":"2016-11-14T07:31:37Z","git_url":"git://github.com/ant-design/ant-design-mobile.git","ssh_url":"git@github.com:ant-design/ant-design-mobile.git","clone_url":"https://github.com/ant-design/ant-design-mobile.git","svn_url":"https://github.com/ant-design/ant-design-mobile","homepage":"http://mobile.ant.design/","size":39033,"stargazers_count":741,"watchers_count":741,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":101,"mirror_url":null,"open_issues_count":33,"forks":101,"open_issues":33,"watchers":741,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ant-design/ant-design-mobile/pulls/524"},"html":{"href":"https://github.com/ant-design/ant-design-mobile/pull/524"},"issue":{"href":"https://api.github.com/repos/ant-design/ant-design-mobile/issues/524"},"comments":{"href":"https://api.github.com/repos/ant-design/ant-design-mobile/issues/524/comments"},"review_comments":{"href":"https://api.github.com/repos/ant-design/ant-design-mobile/pulls/524/comments"},"review_comment":{"href":"https://api.github.com/repos/ant-design/ant-design-mobile/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ant-design/ant-design-mobile/pulls/524/commits"},"statuses":{"href":"https://api.github.com/repos/ant-design/ant-design-mobile/statuses/a7bd7a25cf308763cfb7986902316e23ad6a6645"}}}}
{"actor":{"display_login":"afc163"}}