diff options
Diffstat (limited to 'client/src/lib/views/information.js')
| -rw-r--r-- | client/src/lib/views/information.js | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/client/src/lib/views/information.js b/client/src/lib/views/information.js index aace0d9..759bae2 100644 --- a/client/src/lib/views/information.js +++ b/client/src/lib/views/information.js @@ -23,6 +23,7 @@ export default class Information extends Component { super() this.state = { essay: { title: '', byline: '', body: '' }, + essayBody: '', essayModalVisible: false, biosVisible: false, } @@ -40,7 +41,10 @@ export default class Information extends Component { else { essayBody += '\n\n\n\n\n' } - this.setState({ essay, essayBody, essayModalVisible: true }) + this.setState({ essay: { title: '', byline: '', body: '' }, essayBody: '', essayModalVisible: true }) + setTimeout( () => { + this.setState({ essay, essayBody }) + }, 100) } hideEssay() { this.setState({ essayModalVisible: false }) @@ -79,7 +83,7 @@ export default class Information extends Component { </ScrollableContainer> <Modal style={styles.modal} isVisible={this.state.biosVisible}> - <ScrollView contentContainerStyle={styles.modalContainer}> + <ScrollView ref={ (ref) => this.modalScroller = ref } contentContainerStyle={styles.modalContainer}> <View style={styles.modalBody}> <Image source={require('../../img/aiweiwei.png')} resizeMode='cover' style={styles.face} /> @@ -114,6 +118,12 @@ export default class Information extends Component { } } +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({ container: { flex: 1, @@ -136,7 +146,6 @@ const styles = StyleSheet.create({ marginBottom: 20, }, - bio: { textAlign: 'left', paddingRight: 10, @@ -152,10 +161,10 @@ const styles = StyleSheet.create({ }, essays: { - marginBottom: 20, + marginBottom: isMobile ? 10 : 20, }, essayContainer: { - padding: 10, + padding: isMobile ? 5 : 10, margin: 5, }, essayTitle: { @@ -170,7 +179,7 @@ const styles = StyleSheet.create({ marginBottom: 0, }, essayBylineHeader: { - fontSize: 16, + fontSize: isMobile ? 13 : 16, fontWeight: 'bold', marginBottom: 0, }, @@ -188,9 +197,9 @@ const styles = StyleSheet.create({ }, modalBody: { marginTop: 20, - width: '90%', + width: isMobile ? '95%' : '90%', backgroundColor: 'black', - padding: 40, + padding: isMobile ? 10 : 40, marginBottom: 200, }, |
