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

实现RN轮播(走马灯/Swiper/Carousel/Snap/Tab )组件 #286

Open
yaofly2012 opened this issue Sep 18, 2023 · 1 comment
Open

实现RN轮播(走马灯/Swiper/Carousel/Snap/Tab )组件 #286

yaofly2012 opened this issue Sep 18, 2023 · 1 comment

Comments

@yaofly2012
Copy link
Owner

yaofly2012 commented Sep 18, 2023

RN轮播(走马灯/Swiper/Carousel/Snap )组件

ScrollView

实现

<ScrollView
  horizontal
  pagingEnabled
  nestedScrollEnabled
  showsHorizontalScrollIndicator={false}
  showsVerticalScrollIndicator={false}
  ref={scrollRef}
  >
  {childrens.map((child, index) => <View style={styles.childrenContainer} key={index}>{child}</View>)}
</ScrollView>

初始位置

如果初始展示非首帧,如何初始化ScrollView滚动位置呢?

contentOffset

Issues/Conern

  1. Android (三星Galaxy Z Flip4 / Android 13)不行啊!!!
  2. contentInset只有iOS才支持,为啥不直接用contentContainerStyle呢?

参考

  1. Paginated Horizontal Scroll List In React Native
  2. [Android] ScrollView is missing initial scroll position for Android #6849

改用FlatList

参考

  1. RN ScrollView
  2. Medium (React Native) Create a Horizontal Snap ScrollView
  3. 第三方库
@yaofly2012 yaofly2012 changed the title 实现RN轮播(走马灯/Swiper/Carousel/Snap )组件 实现RN轮播(走马灯/Swiper/Carousel/Snap/Tab )组件 Nov 13, 2023
@yaofly2012
Copy link
Owner Author

react-native-scrollable-tab-view

Navigation

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

No branches or pull requests

1 participant