reactjs - 如何在底部 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 上添加音效?非常感谢任何帮助...
解决方案
推荐阅读
- python - 只有 1 KB 的文件正在下载,而不是 Python 中的全部内容
- javascript - 如何删除表体
- vuejs2 - vue js如何在不刷新页面的情况下加载JS文件
- visualforce - 如何在自定义 visualforce 页面上自动显示查找图标以选择机会?
- dart - 在堆栈中拟合文本
- python - 无法在 python 列表中执行编码和解码
- recursion - 这个递归函数的深度是多少?
- google-chrome - 在弹出窗口中未启用 chrome 扩展
- algorithm - 为什么对 LRU 缓存使用双向链表和 HashMap 而不是 Deque?
- java - 从凌空 JSON 对象 POST 方法响应中捕获 cookie