React native:子视图不能超越Android上的父视图,但它可以在iOS上运行

时间:2016-09-14 18:23:56

标签: android react-native

我在将应用程序从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上呈现的方式不同

的iOS

https://github.com/magicmonty/bash-git-prompt

的Android

render ios

我希望它能在两台设备上的iOS上呈现。您可以检查此repo render android上的代码以轻松复制它。

谢谢!

1 个答案:

答案 0 :(得分:2)

在Android overflow中,属性默认为'hidden',无法更改。

From 0.23 known issues,显然尚未确定。