顶部标签导航器点击不生效

来源:2-4 ES6之简介及变量声明

慕仔3077336

2023-07-30

图片描述

老师,你好!

顶部标签导航器,点击不生效,为啥?

版本如下
"react": “18.2.0”,
“react-native”: “0.72.0”,
@react-navigation/material-top-tabs": “^6.6.3”,

相关代码如下

renderTabBar = (props: MaterialTopTabBarProps) => {
return <TopTabBarWrapper {…props} />;
};

// TopTabBarWrapper

{this.linearGradient}

<MaterialTopTabBar {…restProps} />
{/* todo 这里的 分类按钮点击不生效*/}
{/*
分类
*/}



分类


搜索按钮


历史记录


写回答

1回答

慕仔3077336

提问者

2023-07-30

<View style={styles.container}>
{this.linearGradient}
<View style={styles.topTabBarView}>
<MaterialTopTabBar {...restProps} />
{/* todo 这里的 分类按钮点击不生效*/}
{/* <Touchable style={styles.categoryBtn} onPress={this.goCategory}>
            <Text style={textStyle}>分类</Text>
          </Touchable> */}
</View>
<View style={styles.bottom}>
<Touchable style={styles.categoryBtn} onPress={this.goCategory}>
<Text style={textStyle}>分类</Text>
</Touchable>
<Touchable style={styles.searchBtn}>
<Text style={textStyle}>搜索按钮</Text>
</Touchable>
<Touchable style={styles.historyBtn}>
<Text style={textStyle}>历史记录</Text>
</Touchable>
</View>
</View>


0
0

跨平台应用ReactNative+TypeScript仿喜马拉雅开发App

从入门到实战,掌握用TypeScript开发ReactNative应用

832 学习 · 339 问题

查看课程