admin管理员组文章数量:1335127
I just have started developing a new app and immediately ran into a problem.
Here, ios on the right, the background successfully covers the entire screen, including the top bar and the bottom navigation. However, on android, this does not happen.
Here is my code:
import React from 'react';
import { ImageBackground, Text, View, SafeAreaView, StyleSheet } from 'react-native';
import Button from "./src/components/Button";
const Explore = ({}) => {
return (
<ImageBackground
style={s.background}
source={require('./src/assets/images/explore.png')}
>
<SafeAreaView style={s.safeArea}>
<View style={s.wrapper}>
<View style={s.header}>
<Text style={s.title}>Explore</Text>
<Text style={s.subTitle}>new amazing countries</Text>
</View>
<View style={s.spacer} />
<View style={s.controls}>
<Button
style={s.button}
label="Log in"
/>
</View>
</View>
</SafeAreaView>
</ImageBackground>
);
};
const s = StyleSheet.create({
background: {
width: '100%',
height: '100%',
},
safeArea: {
flex: 1,
},
wrapper: {
flex: 1,
padding: 25,
},
header: {
paddingTop: 20,
},
title: {
fontSize: 24,
fontFamily: 'RobotoSlab-Bold',
color: '#323B45',
},
subTitle: {
fontSize: 20,
fontFamily: 'RobotoSlab-Light',
color: '#323B45',
},
spacer: {
flex: 1,
},
controls: {
flexDirection: 'row'
},
button: {
flex: 1
},
gap: {
width: 25
}
});
export default Explore;
Does anyone know how I can make the background on android cover the entire screen, jus like on ios?
UPDATE:
We have managed to cover the status bar with the following code:
<StatusBar translucent backgroundColor='transparent' />
I just have started developing a new app and immediately ran into a problem.
Here, ios on the right, the background successfully covers the entire screen, including the top bar and the bottom navigation. However, on android, this does not happen.
Here is my code:
import React from 'react';
import { ImageBackground, Text, View, SafeAreaView, StyleSheet } from 'react-native';
import Button from "./src/components/Button";
const Explore = ({}) => {
return (
<ImageBackground
style={s.background}
source={require('./src/assets/images/explore.png')}
>
<SafeAreaView style={s.safeArea}>
<View style={s.wrapper}>
<View style={s.header}>
<Text style={s.title}>Explore</Text>
<Text style={s.subTitle}>new amazing countries</Text>
</View>
<View style={s.spacer} />
<View style={s.controls}>
<Button
style={s.button}
label="Log in"
/>
</View>
</View>
</SafeAreaView>
</ImageBackground>
);
};
const s = StyleSheet.create({
background: {
width: '100%',
height: '100%',
},
safeArea: {
flex: 1,
},
wrapper: {
flex: 1,
padding: 25,
},
header: {
paddingTop: 20,
},
title: {
fontSize: 24,
fontFamily: 'RobotoSlab-Bold',
color: '#323B45',
},
subTitle: {
fontSize: 20,
fontFamily: 'RobotoSlab-Light',
color: '#323B45',
},
spacer: {
flex: 1,
},
controls: {
flexDirection: 'row'
},
button: {
flex: 1
},
gap: {
width: 25
}
});
export default Explore;
Does anyone know how I can make the background on android cover the entire screen, jus like on ios?
UPDATE:
We have managed to cover the status bar with the following code:
<StatusBar translucent backgroundColor='transparent' />
Share
Improve this question
edited Nov 2, 2019 at 18:43
sheriff_paul
asked Nov 2, 2019 at 18:23
sheriff_paulsheriff_paul
1,0653 gold badges15 silver badges31 bronze badges
9
|
Show 4 more comments
2 Answers
Reset to default 14react-native-navigation-bar-color
has solved my issue with the bottom navigation bar, and <StatusBar translucent backgroundColor='transparent' />
- with the status bar.
import{View,Text,ImageBackground,Dimensions} from 'react-native'
//This is Image full screen on your android or ios
<ImageBackground source={require('../image/TempleSlider.png')} style={{height:Dimensions.get("window").height,alignItems:'center',justifyContent:'space-between'}} > //Do somthing...
本文标签: javascriptreactnativeuse fullscreen image on androidStack Overflow
版权声明:本文标题:javascript - React-native, use fullscreen image on android - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1739278623a2156133.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
<StatusBar translucent backgroundColor='transparent' />
. Now, only the bottom navigation left. – sheriff_paul Commented Nov 2, 2019 at 18:41paddinBottom : 0
? – hong developer Commented Nov 2, 2019 at 18:51paddinBottom : -30
– hong developer Commented Nov 2, 2019 at 19:10