问题描述
我正在尝试在底部标签栏导航中添加声音效果。在按下每个选项卡时,它应该播放声音效果。 它适用于按钮,但适用于 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 (将#修改为@)