Commit 85da87be authored by Afid's avatar Afid

set status bar height

parent 09ec6de5
...@@ -4,7 +4,7 @@ import { Image } from 'react-native-elements'; ...@@ -4,7 +4,7 @@ import { Image } from 'react-native-elements';
import Axios from 'axios'; import Axios from 'axios';
import { TouchableOpacity, ScrollView } from 'react-native-gesture-handler'; import { TouchableOpacity, ScrollView } from 'react-native-gesture-handler';
import HTML from 'react-native-render-html'; import HTML from 'react-native-render-html';
import { getStatusBarHeight } from 'react-native-status-bar-height';
export default class NewsDetail extends React.Component { export default class NewsDetail extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
...@@ -13,14 +13,17 @@ export default class NewsDetail extends React.Component { ...@@ -13,14 +13,17 @@ export default class NewsDetail extends React.Component {
subtitle: '', subtitle: '',
image: '', image: '',
content: '', content: '',
image_height: 400 image_height: 400,
statusbar_height: 50
} }
} }
componentDidMount() { componentDidMount() {
const screenWidth = Math.round(Dimensions.get('window').width); const screenWidth = Math.round(Dimensions.get('window').width);
const statusBarHeight = getStatusBarHeight();
this.setState({ this.setState({
image_height: screenWidth image_height: screenWidth,
statusbar_height: statusBarHeight
}) })
this.get_news_detail(this.props.route.params.slug) this.get_news_detail(this.props.route.params.slug)
} }
...@@ -42,7 +45,7 @@ export default class NewsDetail extends React.Component { ...@@ -42,7 +45,7 @@ export default class NewsDetail extends React.Component {
render() { render() {
console.log('Image : ' + this.state.image) console.log('Image : ' + this.state.image)
return ( return (
<View style={styles.container}> <View style={styles.container(this.state.statusbar_height)}>
<View style={styles.header}> <View style={styles.header}>
<TouchableOpacity onPress={() => this.props.navigation.goBack()}> <TouchableOpacity onPress={() => this.props.navigation.goBack()}>
<Image source={require('../assets/icon/back.png')} style={{width: 35, height: 35}} /> <Image source={require('../assets/icon/back.png')} style={{width: 35, height: 35}} />
...@@ -66,11 +69,11 @@ export default class NewsDetail extends React.Component { ...@@ -66,11 +69,11 @@ export default class NewsDetail extends React.Component {
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: (marginTop) => ({
flex: 1, flex: 1,
marginTop: 29, marginTop: marginTop,
backgroundColor: 'white', backgroundColor: 'white',
}, }),
header: { header: {
height: 60, height: 60,
paddingHorizontal: 10, paddingHorizontal: 10,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment