0
使用React-Native
我需要中心我Image
和組件LYDSceneQuestion
:對齊圖像垂直和水平使用Flexbox的
const SplashScreen =() => {
return (
<View style={styles.container}>
<LYDSceneQuestion text="Welcome to" />
<Image source={theme.images.logo} style={styles.logo} />
<NextButton onPress={onNext} />
</View>
);
};
export default SplashScreen;
const styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center'
},
logo: {
flex: 1,
width: 300,
height: 100,
resizeMode: 'contain'
}
});
目前我的圖像對齊到了谷底,我怎麼能我垂直居中呢?
我想看看這個問題的第二個答案:https://stackoverflow.com/questions/19026884/flexbox-center-horizontally-and-vertically – flyer
[Flexbox:水平和垂直中心]可能重複(https: //sackoverflow.com/questions/19026884/flexbox-center-horizontally-and-vertically) – sol
設置顯示:flex;在容器中 –