In my present code, I have created a custom navigation bar and I use this as my navigation bar when I installed this app on a phone of smaller screen size a button which appears at the right-end of the screen is not shown and I guess this is because of the specific width and height of the buttons that I use in this code
actually, the whole layout of buttons and the images change when I use them in other devices of different screen size
Is there any way remove these hard-coded dimensions and make it work on all the devices with any size
My app is also running slow on devices it takes time to load images is it because of this?
my NavBar.js file:
import {
View, Image, StatusBar, TouchableWithoutFeedback, Dimensions
} from 'react-native';
import React, { Component } from 'react';
import { Actions } from 'react-native-router-flux';
const w = Dimensions.get('window').width;
class NavBar extends Component {
render() {
return (
<View>
<StatusBar />
<View
style={{
width: w,
position: 'absolute',
flexDirection: 'row',
backgroundColor: 'transparent',
}} >
<TouchableWithoutFeedback onPress={() => Actions.pop()}>
<Image
source={require('./Images/back-arrow.png')}
style={styles.backarrowStyle} />
</TouchableWithoutFeedback>
<Image
source={require('./Images/help.png')}
style={styles.helpStyle} />
<Image
source={require('./Images/setting.png')}
style={styles.settingStyle} />
</View>
</View>
);
}
}
const styles = {
backarrowStyle: {
resizeMode: 'contain',
flexDirection: 'row',
width: 55,
height: 55,
left: 0,
justifyContent: 'flex-start'
},
helpStyle: {
resizeMode: 'contain',
width: 50,
height: 50,
left: 200,
justifyContent: 'flex-end',
position: 'relative'
},
settingStyle: {
resizeMode: 'contain',
width: 50,
height: 50,
left: 210,
justifyContent: 'flex-end',
position: 'relative',
}
};
export default NavBar;