我正在尝试让我的React Snap Carousel加载到所需的索引上。当前,当轮播加载时,它会加载第一个索引,而不是我通过FirstItem告诉它的索引。当我刷新屏幕或将其保存在代码编辑器中时,轮播会捕捉到我要引用的firstItem(index)。下面是我的代码。我也看到了很多卡片,它们指向https://github.com/archriss/react-native-snap-carousel/blob/master/doc/KNOWN_ISSUES.md#unreliable-first-item。对于我的一生,尽管我无法弄清楚如何使其正常工作。感谢您的帮助。谢谢。
<Carousel
layout={'default'}
ref={c => {
this._carousel = c;
}}
useScrollView={true}
data={this.getDaysArray() ? this.getDaysArray() : []}
renderItem={this.renderItem.bind(this)}
sliderWidth={Platform.OS === 'ios' ? 375 : 392}
itemWidth={Platform.OS === 'ios' ? 310 : 332}
firstItem={22}
initialScrollIndex={23}
onLayout={() => {
this._carousel.snapToItem(22);
}}
/>