NativeLayer.js 518 Bytes
Newer Older
Gaëtan Renaudeau's avatar
Gaëtan Renaudeau committed
1 2
import React from "react";
import {View} from "react-native";
Gaëtan Renaudeau's avatar
Gaëtan Renaudeau committed
3 4 5 6

class NativeLayer extends React.Component {
  render () {
    const { width, height, children, ...rest } = this.props;
7
    return <View style={{ width, height, position: "relative", overflow: "hidden" }}>
Gaëtan Renaudeau's avatar
Gaëtan Renaudeau committed
8 9 10 11 12 13 14 15 16 17
      {React.Children.map(children, child =>
        <View style={{ width, height, position: "absolute", top: 0, left: 0, backgroundColor: "transparent" }}>
          {child}
        </View>
      )}
    </View>;
  }
}

module.exports = NativeLayer;