React native React Native SectionList scrollToLocation在scrollview中不起作用

React native React Native SectionList scrollToLocation在scrollview中不起作用,react-native,React Native,我试图在scrollView中有一个普通的信息视图和一个分区列表。虽然视图会滚动,但当我尝试使用scrollToLocation滚动到所选的特定索引时,它不会滚动。此外,我还尝试在sectionList中使用其他道具onMomentumScrollEnd,但也不起作用。当我删除scrollView时,它工作得非常好 <ScrollView> <View style={{ height: 300, backgroundColor: 'rgb

我试图在scrollView中有一个普通的信息视图和一个分区列表。虽然视图会滚动,但当我尝试使用scrollToLocation滚动到所选的特定索引时,它不会滚动。此外,我还尝试在sectionList中使用其他道具onMomentumScrollEnd,但也不起作用。当我删除scrollView时,它工作得非常好

<ScrollView>
                    <View style={{ height: 300, backgroundColor: 'rgba(0,0,0,0.2)' }} />
                    <View>
                        <SectionList
                            ref={(ref) => (this.contentRef = ref)}
                            stickySectionHeadersEnabled={false}
                            showsVerticalScrollIndicator={false}
                            sections={sectionListData}
                            keyExtractor={(item) => item.id}
                            onMomentumScrollEnd={() => {
                                this.setState({ onScrollFinished: true });
                                this.setViewableItem();
                            }}
                            onScrollEndDrag={() => {
                                this.setViewableItem();
                            }}
                            onViewableItemsChanged={this.onViewableItemsChanged}
                            renderItem={this.renderSectionItem}
                            renderSectionHeader={!this.props.isMenuLoading && this.renderSectionHeader}
                            initialNumToRender={500}
                            onScrollToIndexFailed={(info) => console.log('info', info)}
                        />
                    </View>
                </ScrollView>
setActiveIndex(key) {
        this.setState({ activeIndex: key, updatedAt: Date.now() });
        if (isValidElement(this.headerRef)) {
            this.headerRef.scrollToIndex({ index: key, animated: true, viewPosition: 0.5 });
        }
        if (isValidElement(this.contentRef)) {
            this.contentRef.scrollToLocation({
                sectionIndex: key,
                itemIndex: 0,
                animated: false,
                viewPosition: 0
            });
        }
    }