# All files Utility.js

64.71% Statements 11/17
100% Branches 0/0
66.67% Functions 4/6
68.75% Lines 11/16

    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
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55

    1x

    140x
    140x

    21x
    21x

    13x
    13x
    13x
    13x

    1x

    1x

     import { Platform, Animated } from 'react-native'

    export const PLACEMENT_OPTIONS = {
        TOP: 'top',
        RIGHT: 'right',
        BOTTOM: 'bottom',
        LEFT: 'left',
        AUTO: 'auto'
    };

    export function Point(x, y) {
        this.x = x;
        this.y = y;
    }

    export function Size(width, height) {
        this.width = width;
        this.height = height;
    }

    export function Rect(x, y, width, height) {
        this.x = x;
        this.y = y;
        this.width = width;
        this.height = height;
    }

    export function isIOS() {
      return Platform.OS === 'ios';
    }

    // Transition config needed on tablets for popover to work
    export let popoverTransitionConfig = () => ({
      transitionSpec: {
        duration: 1,
        timing: Animated.timing,
      },
      screenInterpolator: sceneProps => {
        const { position, scene } = sceneProps
        const { index } = scene

        const translateY = position.interpolate({
          inputRange: [index - 1, index, index + 1],
          outputRange: [0, 0, 0],
        })

        const opacity = position.interpolate({
          inputRange: [index - 1, index, index + 1],
          outputRange: [0, 1, 1],
        })

        return { opacity, transform: [{ translateY }] }
      },
    })