Fixed flow errors
This commit is contained in:
джерело
61d413b074
коміт
83dc2dce34
1 змінених файлів з 20 додано та 17 видалено
|
@ -2,14 +2,13 @@
|
|||
|
||||
import * as React from 'react';
|
||||
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 {View, Image} from "react-native";
|
||||
import ThemeManager from "../utils/ThemeManager";
|
||||
import {Linking} from "expo";
|
||||
import BaseContainer from "../components/BaseContainer";
|
||||
import {Agenda} from 'react-native-calendars';
|
||||
import {LocaleConfig} from 'react-native-calendars';
|
||||
import {Agenda, LocaleConfig} from 'react-native-calendars';
|
||||
import HTML from 'react-native-render-html';
|
||||
import Touchable from 'react-native-platform-touchable';
|
||||
import Modalize from 'react-native-modalize';
|
||||
|
@ -53,19 +52,21 @@ function openWebLink(link) {
|
|||
*/
|
||||
export default class PlanningScreen extends React.Component<Props, State> {
|
||||
|
||||
modalRef: { current: null | Modalize };
|
||||
modalRef: Modalize;
|
||||
agendaRef: Agenda;
|
||||
webDataManager: WebDataManager;
|
||||
|
||||
lastRefresh: Date;
|
||||
minTimeBetweenRefresh = 60;
|
||||
|
||||
_agenda: Agenda;
|
||||
didFocusSubscription: Function;
|
||||
willBlurSubscription: Function;
|
||||
|
||||
constructor(props: any) {
|
||||
super(props);
|
||||
this.modalRef = React.createRef();
|
||||
this.webDataManager = new WebDataManager(FETCH_URL);
|
||||
this._didFocusSubscription = props.navigation.addListener(
|
||||
this.didFocusSubscription = props.navigation.addListener(
|
||||
'didFocus',
|
||||
payload =>
|
||||
BackHandler.addEventListener(
|
||||
|
@ -80,7 +81,7 @@ export default class PlanningScreen extends React.Component<Props, State> {
|
|||
|
||||
componentDidMount() {
|
||||
this._onRefresh();
|
||||
this._willBlurSubscription = this.props.navigation.addListener(
|
||||
this.willBlurSubscription = this.props.navigation.addListener(
|
||||
'willBlur',
|
||||
payload =>
|
||||
BackHandler.removeEventListener(
|
||||
|
@ -92,7 +93,7 @@ export default class PlanningScreen extends React.Component<Props, State> {
|
|||
|
||||
onBackButtonPressAndroid = () => {
|
||||
if (this.state.calendarShowing) {
|
||||
this._agenda.chooseDay(this._agenda.state.selectedDay);
|
||||
this.agendaRef.chooseDay(this.agendaRef.state.selectedDay);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
@ -100,8 +101,8 @@ export default class PlanningScreen extends React.Component<Props, State> {
|
|||
};
|
||||
|
||||
componentWillUnmount() {
|
||||
this._didFocusSubscription && this._didFocusSubscription.remove();
|
||||
this._willBlurSubscription && this._willBlurSubscription.remove();
|
||||
this.didFocusSubscription && this.didFocusSubscription.remove();
|
||||
this.willBlurSubscription && this.willBlurSubscription.remove();
|
||||
}
|
||||
|
||||
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.
|
||||
onRefresh={() => this._onRefresh()}
|
||||
// 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
|
||||
refreshing={this.state.refreshing}
|
||||
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.
|
||||
firstDay={1}
|
||||
// ref to this agenda in order to handle back button event
|
||||
ref={(ref) => this._agenda = ref}
|
||||
ref={(ref) => this.agendaRef = ref}
|
||||
// agenda theme
|
||||
theme={{
|
||||
backgroundColor: ThemeManager.getCurrentThemeVariables().agendaBackgroundColor,
|
||||
|
|
Завантаження…
Посилання в новій задачі