react native android 定位,react-native – 当Android上的位置绝对时,React Native – View会消失...

每当我为这个视图制作’绝对’的位置风格时,它就会消失.我不知道为什么会这样.

import React,{ Component } from 'react';

import { Text,View,Image,TouchableOpacity,StyleSheet } from 'react-native';

export default class App extends Component {

render() {

return (

style={styles.parentView}>

activeOpacity={0.9}

onPress={() => {}}>

style={ [{position: 'absolute'},styles.textView] }>

Just Another Cat

style={[{position: 'absolute'},styles.imageView]}

source={{ uri: 'https://images.pexels.com/photos/104827/cat-pet-animal-domestic-104827.jpeg' }}

/>

);

}

}

const styles = StyleSheet.create({

mainView: { flexDirection: 'row',flex: 1 },parentView: { alignSelf: 'center',flex: 0.5,left: 10,elevation: 3,alignItems: 'flex-start' },textView: { width: 250,height: 250,opacity: 1,borderRadius: 125,backgroundColor: '#aaa034' },textViewText: { textAlign: 'center',padding: 10,color: '#ffffff',fontSize: 18,top:0,right:0,bottom:0,left:0,textAlignVertical: 'center',position: 'absolute' },imageView: { width: 250,borderColor: '#000000',borderWidth: 0.2 }

});

当我删除与styles.textView和styles.imageView一起添加的内联样式:(位置:’绝对’)时,它们都将再次可见.但是我想出于某种原因使这个位置绝对,但随后它们就消失了.我不知道为什么.有谁能解释一下?

编辑:它适用于iOS.它在android上给出了这个bug.小吃网址:https://snack.expo.io/Hy_oRrvOM

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值