summaryrefslogtreecommitdiff
path: root/client/src/lib/components/modal.js
blob: e6766e11743be658836b37e8e91bb7689a1857c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import React, { Component } from 'react';
import {
  StyleSheet,
  View,
} from 'react-native';

import browser from './browser'

export default class Modal extends Component {
  render() {
    let style = [ styles.modal ]
    let className = 'modal'
    if (this.props.isVisible) {
      style.push(styles.visible)
      className += ' visible'
    }
    style.push( this.props.style )
    return (
      <View style={style} className={className}>
        {this.props.children}
      </View>
    )
  }
}

const styles = StyleSheet.create({
  modal: {
    position: 'fixed',
    top: 0,
    left: 0,
    width: '100vw',
    height: '100vh',
    overflow: 'hidden',
    zIndex: 2,
    backgroundColor: 'black',
    flex: 1,
    flexDirection: 'column',
    alignItems: 'center',
    justifyContent: 'center',
    opacity: 0,
  },
  visible: {
    opacity: 1,
  },
})