Skip to content

Positioning View above a parent #7229

Closed
@pedro

Description

@pedro

Hey folks,

We're trying to position a View above its parent using a negative top. iOS renders it the way I'd expect:

screen shot 2016-04-26 at 12 14 14 am

But Android is trimming the view to match the parent:

screen shot 2016-04-26 at 12 14 16 am

Code:

class RNPositionBug extends Component {
  render() {
    return (
      <View style={styles.container}>
        <View style={styles.box}>
          <View style={styles.inner}/>
        </View>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  box: {
    width: 200,
    height: 200,
    backgroundColor: 'red',
  },
  inner: {
    position: 'relative',
    top: -50,
    width: 100,
    height: 100,
    backgroundColor: 'blue',
  }
});

Tested in React-Native 0.24.1, OSX. Tried to use both absolute and relative positioning on the inner view.

Any ideas/pointers are appreciated, thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Ran CommandsOne of our bots successfully processed a command.Resolution: LockedThis issue was locked by the bot.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions