summaryrefslogtreecommitdiff
path: root/client/src/lib/components/touchable.js
blob: fd72c608c74d2c73385764dc1748a9f534f87bc7 (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
import React, { Component } from 'react';
import {
  TouchableOpacity,
  TouchableWithoutFeedback,
} from 'react-native';

const isIphone = (navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))
const isIpad = (navigator.userAgent.match(/iPad/i))
const isAndroid = (navigator.userAgent.match(/Android/i))
const isMobile = isIphone || isIpad || isAndroid
const isDesktop = ! isMobile
const isFirefox = navigator.userAgent.match('Firefox')

export default class Touchable extends Component {
  render() {
    if (isFirefox) {
      return (
        <TouchableWithoutFeedback {...this.props} />
      )
    }
    else {
      return (
        <TouchableOpacity {...this.props} />
      )
    }
  }
}