javascript - 如何在本机反应中在屏幕中间显示图标
问题描述
在这里,我"icon="check-decagram" type="MaterialCommunityIcons"
在中间显示,但它只是在中间,从顶部开始有 20 个填充。我必须将它显示在手机屏幕的中间。我试过可能是我做错了。请纠正我。
return(
<ImageBackground source={BG} style={styles.imgBG}>
<ScrollView>
<View>
<Header title={title} icon={icon} navigation={navigation} />
</View>
<View style={{ flexDirection: 'column', backgroundColor: '#ffff',}}>
<View style={{
flexDirection:'column', backgroundColor:'#fff',alignItems:'center',paddingTop:20,justifyContent: 'center'}}>
<IconXL icon="check-decagram" type="MaterialCommunityIcons" style={{ color: 'green' }}/>
</View>
<View style={{
flexDirection:'row', backgroundColor:'#ffff',padding:20,flexWrap:'wrap'}}>
<SmallText textColor="grey" text={`v${updateResponse.updateStatusList.currentAppVersion} `}/>
<SmallText textColor="grey" text={`${updateResponse.updateStatusList.desc}`}/>
</View>
</View>
</ScrollView>
</ImageBackground>
)}
// 谢谢
解决方案
尝试再添加两个属性height: '100%'
并width: '100%'
在图标的超级视图中,
喜欢,
<View style={{flexDirection:'column',height: '100%',width: '100%',backgroundColor:'#fff',alignItems:'center',paddingTop:2,justifyContent: 'center'}}>
<IconXL icon="check-decagram" type="MaterialCommunityIcons" style={{ color:'green' }}/>
</View>
希望这对你有用,
祝你好运。
推荐阅读
- scala - 以编程方式灵活访问数据源
- terraform - Terraform 提供者:在更新时从提供者内部设置污点状态
- c# - 在列表中返回对象的正确方法
- google-chrome - wss 连接失败:连接建立错误:net::ERR_CERT_COMMON_NAME_INVALID
- sql - 如何计算子查询中的条目数
- time-complexity - 负系数的大欧米茄
- hive - 具有多个连接的大型查询引发 Stackoverflow 异常
- python - 如何将单击哪个按钮的信息传递给另一个类?
- excel - 数据透视表以提取不同的值
- multithreading - 这是在 rust 线程之间共享闭包回调的惯用方式吗?