/* @flow */
import React, { PureComponent } from 'react';
import type { ChildrenArray } from 'react';
import { View, Dimensions, StyleSheet } from 'react-native';

const styles = StyleSheet.create({
  popup: {
    marginRight: 20,
    marginLeft: 20,
    marginBottom: 2,
    bottom: 0,
    borderRadius: 5,
    shadowOpacity: 0.25,
    elevation: 3,
  },
});

type Props = {
  children: ChildrenArray<*>,
};

export default class Popup extends PureComponent<Props> {
  props: Props;

  static contextTypes = {
    styles: () => null,
  };

  render() {
    const { height } = Dimensions.get('window');

    return (
      <View style={[this.context.styles.backgroundColor, styles.popup]} maxHeight={height / 4}>
        {this.props.children}
      </View>
    );
  }
}

/* @flow */
import React, { PureComponent } from 'react';
import type { ChildrenArray } from 'react';
import { View, StyleSheet } from 'react-native';

const styles = StyleSheet.create({
  popup: {
    marginRight: 20,
    marginLeft: 20,
    marginBottom: 2,
    bottom: 0,
    borderRadius: 5,
    shadowOpacity: 0.25,
    elevation: 3,
  },
});

type Props = {
  children: ChildrenArray<*>,
};

export default class Popup extends PureComponent<Props> {
  props: Props;

  static contextTypes = {
    styles: () => null,
  };

  render() {
    return (
      <View style={[this.context.styles.backgroundColor, styles.popup]}>{this.props.children}</View>
    );
  }
}

Remove extraneous `maxHeight` prop on a `View`.
popup: Remove extraneous `maxHeight` prop on a `View`.

This is not a prop that the `View` component supports.  It has never
had any effect, and the Flow 0.75 we'll pull in with RN 0.56 will
register it as an error.

This prop was added in commit ce0395cff when changing the component
used here to a `ScrollView`, and 62ddf77a7 left it around when
changing back to a `View`.
