小编roh*_*arg的帖子

使用react-navigation-tab创建自定义的可滚动顶部标签栏?

我需要使用 React 导航选项卡和 tabBarComponent 创建自定义的可滚动顶部选项卡栏,而不使用任何其他第三方库。

const TopTabBar = createMaterialTopTabNavigator({
    Home: HomePage,
    Entertainment: EntertainmentNews,
    Business: BusinessStack,
    Music: MusicStack,
    Politics: PoliticsStack,
    Sports: SportsStack,
    Technology: TechnologyStack,
    WorldNews: WorldNewsStack
}, {
    tabBarComponent: (props) => <TopTabBarComponent {...props}/>
})
Run Code Online (Sandbox Code Playgroud)

在此使用选项卡栏组件时,我可以创建顶部栏,但滑动屏幕时它不会滚动?

import React , { Component } from 'react'
import { Text, View, StyleSheet, FlatList, TouchableOpacity, Animated, Dimensions} from 'react-native'

interface Props {
    navigation?: any
}

interface State {
    //
}

export class TopTabBarComponent extends Component <Props, State>{
    flatListRef
    constructor(props: Props, state: State){
        super(props, state)
    }





    onPressItem …
Run Code Online (Sandbox Code Playgroud)

react-native react-navigation react-native-flatlist react-navigation-bottom-tab react-navigation-v5

1
推荐指数
1
解决办法
5639
查看次数