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

react-native-snap-carousel组件将FlatList换为react-native-largelist #380

Closed
369663841 opened this issue Oct 12, 2019 · 5 comments
Closed

Comments

@369663841
Copy link

先对本组件作者们表达敬意!感谢分享如此优秀的作品!

react-native-snap-carousel组件的作者在 这里 提出想把FlatList替换掉,两个备选组件其中之一是react-native-largelist,该作者也提到了一些阻碍因素。

不知道 @bolan9999 @ATShiTou 大侠们有没有留意到这个讨论?也恳请两位百忙中给些可行性建议,感谢!

@ATShiTou
Copy link
Collaborator

其实绝大部分所谓的问题,与ScrollView或其衍生组件的兼容性问题都是因为样式。你如果注意文档的注意事项:

LargeList默认具有{flex:1}的样式,因此要使LargeList正常工作,它的父容器必须是确定高度的,你也可以通过手动指定样式,使之正常工作。

LargeList的宽高不能用子元素来撑起。

我刚看了一眼react-native-snap-carousel组件的源代码, 它没有任何的默认的指定。宽高都是不固定的,这违反了LargeList的使用原则。(其实你可以通过手动指定LargeList的宽高来调试这类问题,照理说没有问题)
react-native-snap-carousel支持自定义样式,对于大部分场景来说,为Carousel的containerCustomStyle和contentContainerCustomStyle都加一个{flex:1}的属性是可以解决你的问题的。 (当然Carousel的父容器必须也是具有确定高度的,或为它的每一层父容器都加一个{flex:1})

@369663841
Copy link
Author

@ATShiTou 感谢回复! 您所说的关于要有明确高度的要求我是知道的,而具体的替换工作,由于本人接触时间不长,水平不高,还要再学习钻研才行。

@369663841
Copy link
Author

@ATShiTou 现在只能做出各页是纵向排布的效果,做不到水平方向排布(就更谈不上水平翻页了),大侠给点指点吧,感谢感谢!

@bolan9999
Copy link
Owner

为每一个页指定固定的宽高都不行?

@369663841
Copy link
Author

@bolan9999 惭愧,我能想到的地方都加了,还是不行,估计还是没有找到关键点,力有不逮啊。

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

No branches or pull requests

3 participants