react-navigation中的渲染自定义标签栏

问题描述 投票:0回答:1

使用react-navigation v5进行唤醒。根据文档示例制作了自定义标签栏。我在底部标签栏内放置了广告横幅。现在,我想在购买活动后删除广告横幅。但是我不确定该怎么做。购买活动结束后如何立即删除我的横幅?

这是我的自定义标签条形码:

enter image description here

react-native react-navigation react-navigation-v5
1个回答
0
投票

我真的没有完全阅读您的代码,所以我不知道哪一部分是广告部分。但是您可以使用conditional rendering决定何时渲染广告组件。像这样的东西:

render(){
  return(
    <View>
    {this.state.ads && 
     <Text style={{ color: 'red' }}>ads here</Text>
    }
    </View>
  );
}
© www.soinside.com 2019 - 2024. All rights reserved.