react-native - 在 React Native 中将项目定位在屏幕底部
问题描述
我想把我svg
的放在屏幕的底部。我已经尝试过 flex 属性和绝对位置 ( bottom:0
) 但svg
没有转到屏幕底部,当我给出它的绝对位置时svg
它会消失,同时zIndex
也不起作用。这是我的代码。这里是小吃。小吃
import Otp from '../assets/otp2.svg';
import Waves from '../assets/waves.svg';
const windowHeight = Dimensions.get('window').height;
const SignUp = () => {
return (
<View style={styles.container}>
<View style={styles.section1}>
<View
style={{
// justifyContent: 'center',
alignItems: 'center',
flexDirection: 'row',
}}>
<Icon size={40} color="white" name="west" />
<Text style={styles.otpText}>OTP Verification</Text>
</View>
<Otp style={{marginBottom: 40}} />
</View>
<View style={styles.section2}>
{/* <View style={styles.section3}></View> */}
<View style={styles.wave}>
<Waves />
</View>
</View>
</View>
);
};
export default SignUp;
const styles = StyleSheet.create({
container: {
flex: 1,
},
section1: {
flex: 1,
backgroundColor: '#f07279',
justifyContent: 'space-evenly',
alignItems: 'center',
},
section2: {
flex: 1,
backgroundColor: '#fff',
// alignContent: 'flex-end',
// alignItems: 'flex-end',
},
section3: {
flex: 1,
backgroundColor: 'grey',
width: '80%',
height: '80%',
borderRadius: 25,
// position: 'absolute',
// zIndex: 1,
// top: -40,
},
otpText: {
fontSize: 25,
color: '#ffffff',
width: 200,
fontFamily: 'sans-serif-light',
},
wave: {
flex: 1,
// position: 'absolute',
// bottom: 0,
width: '100%',
// zIndex: 5,
// marginTop: '67%',
},
});
这是我想要做的参考。
解决方案
推荐阅读
- javascript - 当我调用 google-plus 的登录功能时出现错误
- java - 带有变量名的命令行参数
- c - 将 3D 数组的 memcpy 列转换为 1D 数组
- mysql - 从字符串中删除连续的重复字符
- c# - 水晶报表加载失败问题
- java - 自动将 JTextFilds 放在 GUI 上,repaint()
- php - PHP:从 PHP 生成 HTML 文件
- python - Python:如何从 shapefile 计算指标的空间自相关?
- android - Android VideoView:视频播放,但抛出 java.io.FileNotFoundException
- r - Windows10 中 R 的 Ubuntu 终端