1 回答

TA貢獻1798條經驗 獲得超7個贊
實際上,一旦您已經聲明justifyContent在centerparent 中View,這就會影響 child 的其余部分Views擁有此樣式道具。justifyContent您可以做的是在第二個View外殼中替換您的Text和Icon組件alignItems。這應該在您的父母提供的空間中垂直對齊它們View。
height此外,您可以在父級View和textAlignVertical中設置約束Text以更好地對齊。
? ? ? ? <View style={{justifyContent: 'center', height: 60}}>
? ? ? ? ? <View style={{display: 'flex', flexDirection: 'row', alignItems: 'center'}}>
? ? ? ? ? ? <Text style={{fontSize: 18, textAlignVertical: 'center', fontWeight: 'bold'}}>12 Mouses</Text>
? ? ? ? ? ? <View style={{flexGrow: 1}} />
? ? ? ? ? ? <Button
? ? ? ? ? ? ? buttonStyle={styles.localize}
? ? ? ? ? ? ? icon={<Icon name="md-locate" color={'white'} size={28} style={{alignSelf: 'center'}}/>}
? ? ? ? ? ? ? onPress={() => {}}
? ? ? ? ? ? />
? ? ? ? ? </View>
? ? ? ? ? <View
? ? ? ? ? ? ? ? style ={{
? ? ? ? ? ? ? ? ? borderWidth: 0.5,
? ? ? ? ? ? ? ? ? borderColor:'grey',
? ? ? ? ? ? ? ? ? margin:2,
? ? ? ? ? ? }}
? ? ? ? ? />
? ? ? ? </View>
添加回答
舉報