forked from vergnet/application-amicale
Fixed flow errors
This commit is contained in:
parent
61d413b074
commit
83dc2dce34
1 changed files with 20 additions and 17 deletions
|
@ -1,15 +1,14 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { BackHandler } from 'react-native';
|
import {BackHandler} from 'react-native';
|
||||||
import {Content, H1, H2, H3, Text, Button} from 'native-base';
|
import {Content, H1, H3, Text, Button} from 'native-base';
|
||||||
import i18n from "i18n-js";
|
import i18n from "i18n-js";
|
||||||
import {View, Image} from "react-native";
|
import {View, Image} from "react-native";
|
||||||
import ThemeManager from "../utils/ThemeManager";
|
import ThemeManager from "../utils/ThemeManager";
|
||||||
import {Linking} from "expo";
|
import {Linking} from "expo";
|
||||||
import BaseContainer from "../components/BaseContainer";
|
import BaseContainer from "../components/BaseContainer";
|
||||||
import {Agenda} from 'react-native-calendars';
|
import {Agenda, LocaleConfig} from 'react-native-calendars';
|
||||||
import {LocaleConfig} from 'react-native-calendars';
|
|
||||||
import HTML from 'react-native-render-html';
|
import HTML from 'react-native-render-html';
|
||||||
import Touchable from 'react-native-platform-touchable';
|
import Touchable from 'react-native-platform-touchable';
|
||||||
import Modalize from 'react-native-modalize';
|
import Modalize from 'react-native-modalize';
|
||||||
|
@ -17,10 +16,10 @@ import WebDataManager from "../utils/WebDataManager";
|
||||||
import CustomMaterialIcon from "../components/CustomMaterialIcon";
|
import CustomMaterialIcon from "../components/CustomMaterialIcon";
|
||||||
|
|
||||||
LocaleConfig.locales['fr'] = {
|
LocaleConfig.locales['fr'] = {
|
||||||
monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Août','Septembre','Octobre','Novembre','Décembre'],
|
monthNames: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'],
|
||||||
monthNamesShort: ['Janv.','Févr.','Mars','Avril','Mai','Juin','Juil.','Août','Sept.','Oct.','Nov.','Déc.'],
|
monthNamesShort: ['Janv.', 'Févr.', 'Mars', 'Avril', 'Mai', 'Juin', 'Juil.', 'Août', 'Sept.', 'Oct.', 'Nov.', 'Déc.'],
|
||||||
dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],
|
dayNames: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'],
|
||||||
dayNamesShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'],
|
dayNamesShort: ['Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam'],
|
||||||
today: 'Aujourd\'hui'
|
today: 'Aujourd\'hui'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -53,19 +52,21 @@ function openWebLink(link) {
|
||||||
*/
|
*/
|
||||||
export default class PlanningScreen extends React.Component<Props, State> {
|
export default class PlanningScreen extends React.Component<Props, State> {
|
||||||
|
|
||||||
modalRef: { current: null | Modalize };
|
modalRef: Modalize;
|
||||||
|
agendaRef: Agenda;
|
||||||
webDataManager: WebDataManager;
|
webDataManager: WebDataManager;
|
||||||
|
|
||||||
lastRefresh: Date;
|
lastRefresh: Date;
|
||||||
minTimeBetweenRefresh = 60;
|
minTimeBetweenRefresh = 60;
|
||||||
|
|
||||||
_agenda: Agenda;
|
didFocusSubscription: Function;
|
||||||
|
willBlurSubscription: Function;
|
||||||
|
|
||||||
constructor(props: any) {
|
constructor(props: any) {
|
||||||
super(props);
|
super(props);
|
||||||
this.modalRef = React.createRef();
|
this.modalRef = React.createRef();
|
||||||
this.webDataManager = new WebDataManager(FETCH_URL);
|
this.webDataManager = new WebDataManager(FETCH_URL);
|
||||||
this._didFocusSubscription = props.navigation.addListener(
|
this.didFocusSubscription = props.navigation.addListener(
|
||||||
'didFocus',
|
'didFocus',
|
||||||
payload =>
|
payload =>
|
||||||
BackHandler.addEventListener(
|
BackHandler.addEventListener(
|
||||||
|
@ -80,7 +81,7 @@ export default class PlanningScreen extends React.Component<Props, State> {
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this._onRefresh();
|
this._onRefresh();
|
||||||
this._willBlurSubscription = this.props.navigation.addListener(
|
this.willBlurSubscription = this.props.navigation.addListener(
|
||||||
'willBlur',
|
'willBlur',
|
||||||
payload =>
|
payload =>
|
||||||
BackHandler.removeEventListener(
|
BackHandler.removeEventListener(
|
||||||
|
@ -92,7 +93,7 @@ export default class PlanningScreen extends React.Component<Props, State> {
|
||||||
|
|
||||||
onBackButtonPressAndroid = () => {
|
onBackButtonPressAndroid = () => {
|
||||||
if (this.state.calendarShowing) {
|
if (this.state.calendarShowing) {
|
||||||
this._agenda.chooseDay(this._agenda.state.selectedDay);
|
this.agendaRef.chooseDay(this.agendaRef.state.selectedDay);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
@ -100,8 +101,8 @@ export default class PlanningScreen extends React.Component<Props, State> {
|
||||||
};
|
};
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
this._didFocusSubscription && this._didFocusSubscription.remove();
|
this.didFocusSubscription && this.didFocusSubscription.remove();
|
||||||
this._willBlurSubscription && this._willBlurSubscription.remove();
|
this.willBlurSubscription && this.willBlurSubscription.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
|
@ -395,7 +396,9 @@ export default class PlanningScreen extends React.Component<Props, State> {
|
||||||
// If provided, a standard RefreshControl will be added for "Pull to Refresh" functionality. Make sure to also set the refreshing prop correctly.
|
// If provided, a standard RefreshControl will be added for "Pull to Refresh" functionality. Make sure to also set the refreshing prop correctly.
|
||||||
onRefresh={() => this._onRefresh()}
|
onRefresh={() => this._onRefresh()}
|
||||||
// callback that fires when the calendar is opened or closed
|
// callback that fires when the calendar is opened or closed
|
||||||
onCalendarToggled={(calendarOpened) => {this.setState({calendarShowing: calendarOpened})}}
|
onCalendarToggled={(calendarOpened) => {
|
||||||
|
this.setState({calendarShowing: calendarOpened})
|
||||||
|
}}
|
||||||
// Set this true while waiting for new data from a refresh
|
// Set this true while waiting for new data from a refresh
|
||||||
refreshing={this.state.refreshing}
|
refreshing={this.state.refreshing}
|
||||||
renderItem={(item) => this.getRenderItem(item)}
|
renderItem={(item) => this.getRenderItem(item)}
|
||||||
|
@ -404,7 +407,7 @@ export default class PlanningScreen extends React.Component<Props, State> {
|
||||||
// If firstDay=1 week starts from Monday. Note that dayNames and dayNamesShort should still start from Sunday.
|
// If firstDay=1 week starts from Monday. Note that dayNames and dayNamesShort should still start from Sunday.
|
||||||
firstDay={1}
|
firstDay={1}
|
||||||
// ref to this agenda in order to handle back button event
|
// ref to this agenda in order to handle back button event
|
||||||
ref={(ref) => this._agenda = ref}
|
ref={(ref) => this.agendaRef = ref}
|
||||||
// agenda theme
|
// agenda theme
|
||||||
theme={{
|
theme={{
|
||||||
backgroundColor: ThemeManager.getCurrentThemeVariables().agendaBackgroundColor,
|
backgroundColor: ThemeManager.getCurrentThemeVariables().agendaBackgroundColor,
|
||||||
|
|
Loading…
Reference in a new issue