Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

增加滑动和分页的回调index,total,用于做自定义带数字的滑动 #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

iscarecrow
Copy link

renderPageIndicator 和 onChangePage 方法添加 回调参数 index, total

  • 目的 是用于做 带有数字的banner轮播
  • 使用方法,定义一个renderPageIndicator的回调函数,然后把数字填上。UI可以自己设置。例子如下

image

  • onChangePage 的话,我觉得total也属于一个基本属性可以回调出来。

@race604
Copy link
Owner

race604 commented Jan 26, 2016

您好,我感觉在 renderPageIndicator() 的回调中添加一个参数表示数据数量感觉并不是很合适,因为数量应该是 ViewPagerDataSource 的一个属性,如果要实现您的这个功能,可以直接获取数据的长度,或者使用 ViewPagerDataSource.getPageCount() 方法。您觉得如何?

@iscarecrow
Copy link
Author

其实是这样的,ViewPagerDataSource并不是 more configuration中的配置项。 作为配置项调用的话, 我觉得 renderPageIndicator 的回调函数是面对使用者的回调。使用ViewPagerDataSource.getPageCount()的话,是不是意味着我得把源码都看一遍。 谢谢回复

同时再反馈一个问题,首次滑动的时候,图片会先跳第一页,再第二页。是不是我这边的问题。 刚接触rn,踩坑中 >_<

@race604
Copy link
Owner

race604 commented Jun 17, 2016

因为 dataSource 是你自己提供的,所以一共有多少页,即使不通过 ViewPagerDataSource.getPageCount()来获取,自己肯定知道,所以我建议还是不要加这个参数,尽量保证接口正交。

你说的第二问题,我这里没有遇到呢,你可以再开一个 issue,把你的主要代码也贴一下,我看看。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants