Css 将照片和文字相邻放置
我是个新来的本地人。我正在尝试使用react Native在android中创建此移动应用程序。我的页面上有一个顶级徽标。我试图让徽标覆盖手机的上边框,从左边框延伸到右边框,然后在徽标的正下方,我试图在照片旁边放置一张照片和一条文字。不知何故,顶部的徽标在徽标上方有很小的空间,我无法移除,并且徽标和下面的其他图像之间有很大的空间。我无法显示文本。我还想在文本中显示一些未显示的中断。我得到以下错误: 下面是我的代码Css 将照片和文字相邻放置,css,reactjs,react-native,Css,Reactjs,React Native,我是个新来的本地人。我正在尝试使用react Native在android中创建此移动应用程序。我的页面上有一个顶级徽标。我试图让徽标覆盖手机的上边框,从左边框延伸到右边框,然后在徽标的正下方,我试图在照片旁边放置一张照片和一条文字。不知何故,顶部的徽标在徽标上方有很小的空间,我无法移除,并且徽标和下面的其他图像之间有很大的空间。我无法显示文本。我还想在文本中显示一些未显示的中断。我得到以下错误: 下面是我的代码 type Props = {}; export defaul
type Props = {};
export default class App extends Component<Props> {
render() {
return (
<View style={styles.container}>
<Image
resizeMode="contain"
style={styles.logo}
source={require('./Resources/logo.jpg')} />
</View>
<View style={{flex: 1, flexDirection: 'row'}}>
<View style={styles.container}>
<Image
resizeMode="contain"
source={{uri: './Resources/photo.png'}}
style={styles.photo} />
</View>
<View style={styles.container}>
<Text>Welcome to our <br>website!. Our website has <br> been designed to <br> provide you with easy <br> access to information <BR> and a variety of online <br> services to assist you <br> with your needs.</Text>
</View>
</View>
非常感谢您的帮助。渲染函数要求您只返回一个DOM元素。因此,您必须执行以下操作(顺便说一句,我不知道您是否忘记了代码的某些部分,但是渲染函数末尾的括号不在那里):
render(){
返回(
欢迎访问我们的
网站。我们的网站旨在
为您提供方便的
信息访问
和各种在线
服务,以帮助您满足您的
需求。
);
}
我没有检查样式,但是错误来自错误使用JSX
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
position: 'relative'
},
logo: {
position: 'absolute',
top: 0,
left: 0,
bottom: 0,
right: 0,
width: 350
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
photo:
{
top:0,
width:180,
height: 300
}
container3: {
flexDirection: 'row',
justifyContent: 'flex-end',
borderBottomWidth: 1,
},
});
render() {
return (
<View style={styles.container}>
<View>
<Image
resizeMode="contain"
style={styles.logo}
source={require('./Resources/logo.jpg')} />
</View>
<View style={{flex: 1, flexDirection: 'row'}}>
<View style={styles.container}>
<Image
resizeMode="contain"
source={{uri: './Resources/photo.png'}}
style={styles.photo} />
</View>
<View style={styles.container}>
<Text>Welcome to our <br>website!. Our website has <br> been designed to <br> provide you with easy <br> access to information <BR> and a variety of online <br> services to assist you <br> with your needs.</Text>
</View>
</View>
</View>
);
}