我在将应用程序从iOS移植到android时遇到了问题。我已经构建了一个可以复制它的最小bug案例。
我的应用非常简单,由一个组件组成:
const Main = () => (
<View>
<View style= {styles.green}>
<View style={styles.blue}/>
</View>
</View>
)
export default Main;
const styles = StyleSheet.create({
green: {
height:200,
marginTop: 200,
backgroundColor: 'green',
},
blue:{
position:'absolute',
height: 100,
width: 100,
top: -50,
backgroundColor: 'blue',
},
})
但奇怪的是,这个组件在iOS和Android上呈现的方式不同
https://github.com/magicmonty/bash-git-prompt
我希望它能在两台设备上的iOS上呈现。您可以检查此repo 上的代码以轻松复制它。
谢谢!