如何在底部 tabBar onpress 上添加音效?

问题描述

我正在尝试在底部标签栏导航中添加声音效果。在按下每个选项卡时,它应该播放声音效果。 它适用于按钮,但适用于 tabBar 导航。

这是tabBar代码:

const Management = props => (
<Screen>
    <ManagementActivity {...props} />
 </Screen>
)
 const Settings = props => (
 <Screen>
    <SettingsActivity {...props} />
</Screen>
)


   <Tabs.Navigator initialRouteName="Dashboard" floating='true' tabBarOptions={{
            activeTintColor: '#34E5C1',inactiveTintColor: "#ffffff00",floating: true,tabStyle: {
                borderRadius: 20,bottom: 20,margin: 10,backgroundColor: '#000',},}}

            appearance={{
                dotSize: 'small',whenActiveShow: 'icon-only',whenInactiveShow: 'icon-only',tabStyle: {
                    width: 40,height: 40,tabButtonLayout: 'horizontal',activeTabBackgrounds: '#272727',bottomPadding: -25,topPadding: 5,}}

        >
            <Tabs.Screen
                name="Dashboard"
                component={Dashboard}
                tabBarOptions={{
                    alignSelf: 'center',justifyContent: 'center',alignItems: 'center'
                }}
                options={{
                    tabBarIcon: ({ focused,color }) => (
                        <HomeSvg fill={color} />
                    ),}}
            />
  </Tabs.Navigator >

这是我的音效代码:

     soundEffect = () => {
    playButtonPress();
   }

如何在tabBar按下时添加音效?非常感谢任何帮助...

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...