blob: bfdfec3d116e3a19a656909424c4752f2e52efd6 (
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
|
import React, { Component } from 'react';
import {
TouchableOpacity,
TouchableWithoutFeedback,
View,
} 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) {
let { children, ...props } = this.props
if (children.length > 1) {
children = (
<View>
{children}
</View>
)
}
return (
<TouchableWithoutFeedback children={children} {...props} />
)
}
else {
return (
<TouchableOpacity {...this.props} />
)
}
}
}
|