|
@@ -5,12 +5,13 @@ import {View} from 'react-native';
|
5
|
5
|
import i18n from "i18n-js";
|
6
|
6
|
import DashboardItem from "../components/Home/EventDashboardItem";
|
7
|
7
|
import WebSectionList from "../components/Lists/WebSectionList";
|
8
|
|
-import {Text, withTheme} from 'react-native-paper';
|
|
8
|
+import {Portal, Text, withTheme} from 'react-native-paper';
|
9
|
9
|
import FeedItem from "../components/Home/FeedItem";
|
10
|
10
|
import SquareDashboardItem from "../components/Home/SquareDashboardItem";
|
11
|
11
|
import PreviewEventDashboardItem from "../components/Home/PreviewEventDashboardItem";
|
12
|
12
|
import {stringToDate} from "../utils/Planning";
|
13
|
13
|
import {openBrowser} from "../utils/WebBrowser";
|
|
14
|
+import ImageView from "react-native-image-viewing";
|
14
|
15
|
// import DATA from "../dashboard_data.json";
|
15
|
16
|
|
16
|
17
|
|
|
@@ -29,10 +30,15 @@ type Props = {
|
29
|
30
|
theme: Object,
|
30
|
31
|
}
|
31
|
32
|
|
|
33
|
+type State = {
|
|
34
|
+ imageModalVisible: boolean,
|
|
35
|
+ imageList: Array<Object>,
|
|
36
|
+}
|
|
37
|
+
|
32
|
38
|
/**
|
33
|
39
|
* Class defining the app's home screen
|
34
|
40
|
*/
|
35
|
|
-class HomeScreen extends React.Component<Props> {
|
|
41
|
+class HomeScreen extends React.Component<Props, State> {
|
36
|
42
|
|
37
|
43
|
onProxiwashClick: Function;
|
38
|
44
|
onTutorInsaClick: Function;
|
|
@@ -43,6 +49,11 @@ class HomeScreen extends React.Component<Props> {
|
43
|
49
|
|
44
|
50
|
colors: Object;
|
45
|
51
|
|
|
52
|
+ state = {
|
|
53
|
+ imageModalVisible: false,
|
|
54
|
+ imageList: [],
|
|
55
|
+ };
|
|
56
|
+
|
46
|
57
|
constructor(props) {
|
47
|
58
|
super(props);
|
48
|
59
|
this.onProxiwashClick = this.onProxiwashClick.bind(this);
|
|
@@ -405,6 +416,18 @@ class HomeScreen extends React.Component<Props> {
|
405
|
416
|
openBrowser(link, this.colors.primary);
|
406
|
417
|
}
|
407
|
418
|
|
|
419
|
+ showImageModal(imageList) {
|
|
420
|
+ this.setState({
|
|
421
|
+ imageModalVisible: true,
|
|
422
|
+ imageList: imageList,
|
|
423
|
+ });
|
|
424
|
+ };
|
|
425
|
+
|
|
426
|
+ hideImageModal = () => {
|
|
427
|
+ this.setState({imageModalVisible: false});
|
|
428
|
+ };
|
|
429
|
+
|
|
430
|
+
|
408
|
431
|
/**
|
409
|
432
|
* Gets a render item for the given feed object
|
410
|
433
|
*
|
|
@@ -412,16 +435,21 @@ class HomeScreen extends React.Component<Props> {
|
412
|
435
|
* @return {*}
|
413
|
436
|
*/
|
414
|
437
|
getFeedItem(item: Object) {
|
415
|
|
- const onImagePress = this.openLink.bind(this, item.full_picture);
|
416
|
438
|
const onOutLinkPress = this.openLink.bind(this, item.permalink_url);
|
|
439
|
+ const imageList = [
|
|
440
|
+ {
|
|
441
|
+ uri: item.full_picture,
|
|
442
|
+ }
|
|
443
|
+ ];
|
|
444
|
+ const onPress = this.showImageModal.bind(this, imageList);
|
417
|
445
|
return (
|
418
|
446
|
<FeedItem
|
419
|
447
|
title={NAME_AMICALE}
|
420
|
448
|
subtitle={HomeScreen.getFormattedDate(item.created_time)}
|
421
|
449
|
full_picture={item.full_picture}
|
422
|
450
|
message={item.message}
|
423
|
|
- onImagePress={onImagePress}
|
424
|
451
|
onOutLinkPress={onOutLinkPress}
|
|
452
|
+ onImagePress={onPress}
|
425
|
453
|
/>
|
426
|
454
|
);
|
427
|
455
|
}
|
|
@@ -441,13 +469,25 @@ class HomeScreen extends React.Component<Props> {
|
441
|
469
|
render() {
|
442
|
470
|
const nav = this.props.navigation;
|
443
|
471
|
return (
|
444
|
|
- <WebSectionList
|
445
|
|
- createDataset={this.createDataset}
|
446
|
|
- navigation={nav}
|
447
|
|
- autoRefreshTime={REFRESH_TIME}
|
448
|
|
- refreshOnFocus={true}
|
449
|
|
- fetchUrl={DATA_URL}
|
450
|
|
- renderItem={this.getRenderItem}/>
|
|
472
|
+ <View>
|
|
473
|
+ <WebSectionList
|
|
474
|
+ createDataset={this.createDataset}
|
|
475
|
+ navigation={nav}
|
|
476
|
+ autoRefreshTime={REFRESH_TIME}
|
|
477
|
+ refreshOnFocus={true}
|
|
478
|
+ fetchUrl={DATA_URL}
|
|
479
|
+ renderItem={this.getRenderItem}/>
|
|
480
|
+ <Portal>
|
|
481
|
+ <ImageView
|
|
482
|
+ images={this.state.imageList}
|
|
483
|
+ imageIndex={0}
|
|
484
|
+ presentationStyle={"fullScreen"}
|
|
485
|
+ visible={this.state.imageModalVisible}
|
|
486
|
+ onRequestClose={this.hideImageModal}
|
|
487
|
+ />
|
|
488
|
+ </Portal>
|
|
489
|
+ </View>
|
|
490
|
+
|
451
|
491
|
);
|
452
|
492
|
}
|
453
|
493
|
}
|