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 {ren
每当我为这个视图制作’绝对’的位置风格时,它就会消失.我不知道为什么会这样.
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)