I want to create a music player app that has collapsed music player at the bottom of the screen, above the bottom tabs, similar to how Spotify and Apple Music have it. I just want to see how you would do a layout in that case. Any help is appreciated.
Asked
Active
Viewed 2,238 times
1 Answers
0
You can create custom tabs with additional view that displays the your player control. For example create CustomTabBar.js like following :
import React, { Component } from 'react';
import { View, Text } from 'react-native';
class CustomTabBar extends Component {
constructor(props) {
super(props);
this.state = {
};
}
render() {
return (
<View>
<View style={{height: 50}}>
{/* Player controller view */}
</View>
{/* Custom Tab view */}
</View>
);
}
}
export default CustomTabBar;
Above component will contains the player controller and custom tabs. Now you can use it with createMaterialTopTabNavigator
. For example :
const HomeTabNavigator = createMaterialTopTabNavigator({
Home: {
screen: HomeStackNavigator,
},
Search: {
screen: SearchStackNavigator
},
Library: {
screen: Library,
},
}, {
...,
...
tabBarComponent: (props) => <CustomTabBar {...props} />, // use your custom tab layout
...
...
},
});
Now, you player control will displays in all your page with tabs. However if you want to use animation effect like spotify or apple music then you have to use pan responder in your player controller view.

Kishan Bharda
- 5,446
- 3
- 30
- 57
-
1I want to use wix’s react native navigation, not react-navigation – sam patel Feb 01 '20 at 04:38
-
Ok, so there will also same approach. You have to create custom tab bar which displays the tabs along with your player control. – Kishan Bharda Feb 01 '20 at 04:39
-
I doubt that. I don’t think it is possible to create a custom bottom tabbar for this library. – sam patel Feb 01 '20 at 04:46
-
I have never used wix navigation so I don't know more about that. Sorry !!! – Kishan Bharda Feb 01 '20 at 04:47