From 658263c5beac838240a19627894ef0621f681442 Mon Sep 17 00:00:00 2001
From: Jules Laplace
Date: Mon, 5 Jun 2017 17:42:51 -0400
Subject: browser, touchable
---
client/src/lib/components/browser.js | 15 +++++++++++++++
client/src/lib/components/button.js | 14 +++++---------
client/src/lib/components/close.js | 17 +++++++++++------
client/src/lib/components/footer.js | 7 ++++---
client/src/lib/components/header.js | 2 +-
client/src/lib/components/touchable.js | 28 ++++++++++++++++++++++++++++
client/src/lib/drone/index.js | 22 +++++++++++-----------
client/src/lib/timeline/index.js | 6 +++---
client/src/lib/timeline/timelineEvent.js | 8 ++++----
client/src/lib/timeline/timelineFilter.js | 2 +-
client/src/lib/timeline/timelineFull.js | 10 +++++-----
client/src/lib/timeline/timelineHeader.js | 1 -
client/src/lib/views/contact.js | 11 ++++-------
client/src/lib/views/home.js | 2 +-
client/src/lib/views/information.js | 10 +++++-----
client/src/lib/views/nav.js | 2 +-
16 files changed, 99 insertions(+), 58 deletions(-)
create mode 100644 client/src/lib/components/browser.js
create mode 100644 client/src/lib/components/touchable.js
(limited to 'client/src/lib')
diff --git a/client/src/lib/components/browser.js b/client/src/lib/components/browser.js
new file mode 100644
index 0000000..2ef33c5
--- /dev/null
+++ b/client/src/lib/components/browser.js
@@ -0,0 +1,15 @@
+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 {
+ isIphone,
+ isIpad,
+ isAndroid,
+ isMobile,
+ isDesktop,
+ isFirefox,
+}
\ No newline at end of file
diff --git a/client/src/lib/components/button.js b/client/src/lib/components/button.js
index edd75de..6860f49 100644
--- a/client/src/lib/components/button.js
+++ b/client/src/lib/components/button.js
@@ -2,11 +2,13 @@ import React, { Component } from 'react';
import {
StyleSheet,
Text,
- TouchableOpacity,
View
} from 'react-native';
import DeviceInfo from 'react-native-device-info'
+import Touchable from './touchable'
+import { isMobile } from './browser'
+
export default class Button extends Component {
render() {
let { buttonStyle, textStyle, ...others } = this.props
@@ -19,23 +21,17 @@ export default class Button extends Component {
activeOpacity = 1.0
}
return (
- { if (! this.props.disabled) { this.props.onPress() }}}>
+ { if (! this.props.disabled) { this.props.onPress() }}}>
{this.props.label}
-
+
)
}
}
-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 styles = StyleSheet.create({
text: {
color: '#000',
diff --git a/client/src/lib/components/close.js b/client/src/lib/components/close.js
index 12b4a0a..c5fa0f0 100644
--- a/client/src/lib/components/close.js
+++ b/client/src/lib/components/close.js
@@ -1,24 +1,29 @@
import React, { Component } from 'react';
import {
StyleSheet,
- TouchableOpacity,
- Image
+ Image,
+ View,
} from 'react-native';
import DeviceInfo from 'react-native-device-info'
+import Touchable from './touchable'
+import { isFirefox } from './browser'
+
export default class Close extends Component {
render() {
return (
-
-
-
+
+
+
+
+
)
}
}
const styles = StyleSheet.create({
close: {
- position: 'absolute',
+ position: isFirefox ? 'fixed' : 'absolute',
top: 10,
right: 10,
width: 40,
diff --git a/client/src/lib/components/footer.js b/client/src/lib/components/footer.js
index f630ed8..15f6f0b 100644
--- a/client/src/lib/components/footer.js
+++ b/client/src/lib/components/footer.js
@@ -2,12 +2,13 @@ import React, { Component } from 'react'
import {
Image,
StyleSheet,
- TouchableOpacity,
Text,
View,
} from 'react-native'
import { Link } from 'react-router-dom'
+import Touchable from './touchable'
+
export default class ClearText extends Component {
render() {
return (
@@ -18,9 +19,9 @@ export default class ClearText extends Component {
- this.props.onLinkPress('http://armoryonpark.org/')}>
+ this.props.onLinkPress('http://armoryonpark.org/')}>
-
+
diff --git a/client/src/lib/components/header.js b/client/src/lib/components/header.js
index 3d41c4f..38a708a 100644
--- a/client/src/lib/components/header.js
+++ b/client/src/lib/components/header.js
@@ -2,12 +2,12 @@ import React, { Component } from 'react'
import {
Image,
StyleSheet,
- TouchableOpacity,
Text,
View,
} from 'react-native'
import { Link } from 'react-router-dom'
+import Touchable from './touchable'
import Nav from '../views/nav'
export default class ClearText extends Component {
diff --git a/client/src/lib/components/touchable.js b/client/src/lib/components/touchable.js
new file mode 100644
index 0000000..fd72c60
--- /dev/null
+++ b/client/src/lib/components/touchable.js
@@ -0,0 +1,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 (
+
+ )
+ }
+ else {
+ return (
+
+ )
+ }
+ }
+}
+
diff --git a/client/src/lib/drone/index.js b/client/src/lib/drone/index.js
index 19e7843..d7143e9 100644
--- a/client/src/lib/drone/index.js
+++ b/client/src/lib/drone/index.js
@@ -3,12 +3,12 @@ import {
StyleSheet,
Image,
View,
- TouchableOpacity,
} from 'react-native';
import ScrollableContainer from '../components/scrollableContainer'
import ClearText from '../components/text'
import Heading from '../components/heading'
+import Touchable from '../components/touchable'
const countryLinks = {
pakistan: 'https://www.thebureauinvestigates.com/projects/drone-war/charts?show_casualties=1&show_injuries=1&show_strikes=1&location=pakistan&from=2004-1-1&to=now',
@@ -27,9 +27,9 @@ export default class Drone extends Component {
const url = link.uri
const name = link.text
return (
- this.props.onLinkPress(url)}>
+ this.props.onLinkPress(url)}>
{name}
-
+
)
})
return (
@@ -71,33 +71,33 @@ export default class Drone extends Component {
- this.props.onLinkPress(countryLinks.afghanistan)}>
+ this.props.onLinkPress(countryLinks.afghanistan)}>
AFGHANISTAN
-
+
- this.props.onLinkPress(countryLinks.pakistan)}>
+ this.props.onLinkPress(countryLinks.pakistan)}>
PAKISTAN
-
+
- this.props.onLinkPress(countryLinks.yemen)}>
+ this.props.onLinkPress(countryLinks.yemen)}>
YEMEN
-
+
- this.props.onLinkPress(countryLinks.somalia)}>
+ this.props.onLinkPress(countryLinks.somalia)}>
SOMALIA
-
+
diff --git a/client/src/lib/timeline/index.js b/client/src/lib/timeline/index.js
index 09d2d1b..381f881 100644
--- a/client/src/lib/timeline/index.js
+++ b/client/src/lib/timeline/index.js
@@ -3,7 +3,6 @@ import {
FlatList,
StyleSheet,
Text,
- TouchableOpacity,
View,
ScrollView,
} from 'react-native';
@@ -17,6 +16,7 @@ import TimelineFull from './timelineFull'
import TimelineHeader from './timelineHeader'
import TimelineFilter from './timelineFilter'
import TickMarks from './tickMarks'
+import Touchable from '../components/touchable'
export default class Timeline extends Component {
constructor(props) {
@@ -100,11 +100,11 @@ export default class Timeline extends Component {
//
//
-// this.setState({ filterVisible: true })}>
+// this.setState({ filterVisible: true })}>
//
// { !! this.state.tag ? 'FILTER' : '' }
//
-//
+//
//
//
diff --git a/client/src/lib/timeline/timelineEvent.js b/client/src/lib/timeline/timelineEvent.js
index 84e9437..7231b8a 100644
--- a/client/src/lib/timeline/timelineEvent.js
+++ b/client/src/lib/timeline/timelineEvent.js
@@ -1,12 +1,12 @@
import React, { Component } from 'react';
import {
- TouchableOpacity,
StyleSheet,
Image,
View
} from 'react-native';
import ClearText from '../components/text'
+import Touchable from '../components/touchable'
const isIphone = (navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))
const isIpad = (navigator.userAgent.match(/iPad/i))
@@ -55,9 +55,9 @@ export default class TimelineEvent extends Component {
imageContainer = ( {image} )
}
return (
- this.props.onPress(this.props.item) }>
- this.ref = ref}>
+ this.props.onPress(this.props.item) }>
+ this.ref = ref}>
{item.date}
@@ -66,7 +66,7 @@ export default class TimelineEvent extends Component {
{item.title}
-
+
)
}
}
diff --git a/client/src/lib/timeline/timelineFilter.js b/client/src/lib/timeline/timelineFilter.js
index c6da98a..8259c0a 100644
--- a/client/src/lib/timeline/timelineFilter.js
+++ b/client/src/lib/timeline/timelineFilter.js
@@ -2,7 +2,7 @@ import React, { Component } from 'react';
import {
ScrollView,
StyleSheet,
- TouchableOpacity,
+ Touchable,
Image,
View,
Text,
diff --git a/client/src/lib/timeline/timelineFull.js b/client/src/lib/timeline/timelineFull.js
index 1b60575..8019710 100644
--- a/client/src/lib/timeline/timelineFull.js
+++ b/client/src/lib/timeline/timelineFull.js
@@ -2,7 +2,6 @@ import React, { Component } from 'react';
import {
ScrollView,
StyleSheet,
- TouchableOpacity,
Image,
View,
RefreshControl,
@@ -15,6 +14,7 @@ import ClearText from '../components/text'
import Heading from '../components/heading'
import Definition from '../components/definition'
import Close from '../components/close'
+import Touchable from '../components/touchable'
const isIphone = (navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))
const isIpad = (navigator.userAgent.match(/iPad/i))
@@ -83,9 +83,9 @@ export default class TimelineFull extends Component {
name = linkTextFromUrl(url)
}
return (
- this.props.onLinkPress(url)}>
+ this.props.onLinkPress(url)}>
{name}
-
+
)
})
links = (
@@ -117,9 +117,9 @@ export default class TimelineFull extends Component {
{item.date}
{item.medium}
- this.onPickTag(item.category)}>
+ this.onPickTag(item.category)}>
{item.category}
-
+
' + tags + '
'} stylesheet={tagHTMLStyles} onLinkPress={this.onPickTag} />
diff --git a/client/src/lib/timeline/timelineHeader.js b/client/src/lib/timeline/timelineHeader.js
index 26cac31..3d922e1 100644
--- a/client/src/lib/timeline/timelineHeader.js
+++ b/client/src/lib/timeline/timelineHeader.js
@@ -1,7 +1,6 @@
import React, { Component } from 'react';
import {
StyleSheet,
- TouchableOpacity,
Text,
View,
ScrollView,
diff --git a/client/src/lib/views/contact.js b/client/src/lib/views/contact.js
index 57d3e9d..6c45b2f 100644
--- a/client/src/lib/views/contact.js
+++ b/client/src/lib/views/contact.js
@@ -2,8 +2,7 @@ import React, { Component } from 'react';
import {
ActivityIndicator,
KeyboardAvoidingView,
- TouchableHighlight,
- TouchableWithoutFeedback,
+ Touchable,
StyleSheet,
TextInput,
Keyboard,
@@ -200,11 +199,9 @@ export default class Contact extends Component {
)
})
return (
-
-
- {comments}
-
-
+
+ {comments}
+
)
}
}
diff --git a/client/src/lib/views/home.js b/client/src/lib/views/home.js
index 8d5f275..2e7979e 100644
--- a/client/src/lib/views/home.js
+++ b/client/src/lib/views/home.js
@@ -2,7 +2,7 @@ import React, { Component } from 'react';
import {
Image,
StyleSheet,
- TouchableOpacity,
+ Touchable,
View,
Platform
} from 'react-native';
diff --git a/client/src/lib/views/information.js b/client/src/lib/views/information.js
index 759bae2..9e69a83 100644
--- a/client/src/lib/views/information.js
+++ b/client/src/lib/views/information.js
@@ -3,7 +3,6 @@ import {
StyleSheet,
View,
Image,
- TouchableOpacity,
ScrollView,
} from 'react-native';
@@ -17,6 +16,7 @@ import ClearText from '../components/text'
import Button from '../components/button'
import Close from '../components/close'
import Heading from '../components/heading'
+import Touchable from '../components/touchable'
export default class Information extends Component {
constructor(props) {
@@ -59,12 +59,12 @@ export default class Information extends Component {
const content = this.props.content
const essays = this.props.essays.map( (essay, i) => {
return (
- this.showEssay(essay)}>
+ this.showEssay(essay)}>
{essay.title}
{essay.byline}
-
+
)
})
return (
@@ -73,12 +73,12 @@ export default class Information extends Component {
{essays}
- this.showBios()}>
+ this.showBios()}>
Artist Biographies
Ai Weiwei, Jacques Herzog, Phillipe de Meuron
-
+
diff --git a/client/src/lib/views/nav.js b/client/src/lib/views/nav.js
index ef04f2d..3e852cf 100644
--- a/client/src/lib/views/nav.js
+++ b/client/src/lib/views/nav.js
@@ -3,7 +3,7 @@ import {
Image,
StyleSheet,
Text,
- TouchableOpacity,
+ Touchable,
Platform,
View
} from 'react-native';
--
cgit v1.2.3-70-g09d2