From f261d5fb49edf7c1ee2963327aa28b6692659e7e Mon Sep 17 00:00:00 2001 From: Inbal Tish Date: Sat, 25 Jan 2020 10:52:27 +0200 Subject: [PATCH] file cosmetics --- CHANGELOG.md | 3 +++ README.md | 2 +- example/.babelrc-IGNORE | 2 +- example/.watchmanconfig | 2 +- example/app.json | 2 +- example/babel.config.js | 4 ++-- example/metro.config.js | 8 ++++---- example/src/screens/agenda.js | 23 +++++++++++++---------- example/src/screens/calendars.js | 4 ++-- example/src/screens/calendarsList.js | 5 +---- example/src/screens/menu.js | 6 +++--- src/agenda/index.js | 5 ++--- src/calendar-list/item.js | 4 +++- src/calendar/day/basic/index.js | 12 +++++------- src/calendar/day/custom/index.js | 3 +-- src/calendar/day/multi-dot/index.js | 12 +++++------- src/calendar/index.js | 5 +++-- src/calendar/updater.js | 1 - 18 files changed, 51 insertions(+), 52 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ccbffc657..c51edb9789 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -273,3 +273,6 @@ ## [1.257.0] - 2020-1-23 ### Bug fix - Reservation - secure calls to prop functions to avoid crashes. + +## [1.258.0] - 2020-1-23 +- file cosmetics diff --git a/README.md b/README.md index c40780d53f..f6ccb69900 100644 --- a/README.md +++ b/README.md @@ -425,7 +425,7 @@ An advanced `Agenda` component that can display interactive listings for calenda ```javascript ({ transform: { experimentalImportSupport: false, - inlineRequires: false, - }, - }), - }, + inlineRequires: false + } + }) + } }; diff --git a/example/src/screens/agenda.js b/example/src/screens/agenda.js index 9a7aa1e0b1..949e8f0185 100644 --- a/example/src/screens/agenda.js +++ b/example/src/screens/agenda.js @@ -1,14 +1,12 @@ import React, {Component} from 'react'; -import { - Text, - View, - StyleSheet -} from 'react-native'; +import {Alert, StyleSheet, Text, View, TouchableOpacity} from 'react-native'; import {Agenda} from 'react-native-calendars'; + export default class AgendaScreen extends Component { constructor(props) { super(props); + this.state = { items: {} }; @@ -51,31 +49,36 @@ export default class AgendaScreen extends Component { const numItems = Math.floor(Math.random() * 5); for (let j = 0; j < numItems; j++) { this.state.items[strTime].push({ - name: 'Item for ' + strTime, + name: 'Item for ' + strTime + ' #' + j, height: Math.max(50, Math.floor(Math.random() * 150)) }); } } } - //console.log(this.state.items); const newItems = {}; Object.keys(this.state.items).forEach(key => {newItems[key] = this.state.items[key];}); this.setState({ items: newItems }); }, 1000); - // console.log(`Load Items for ${day.year}-${day.month}`); } renderItem(item) { return ( - {item.name} + Alert.alert(item.name)} + > + {item.name} + ); } renderEmptyDate() { return ( - This is empty date! + + This is empty date! + ); } diff --git a/example/src/screens/calendars.js b/example/src/screens/calendars.js index a51438d84a..65ad7cfae8 100644 --- a/example/src/screens/calendars.js +++ b/example/src/screens/calendars.js @@ -19,7 +19,7 @@ export default class CalendarsScreen extends Component { render() { return ( - Calendar with selectable date and arrows + Calendar with selectable date diff --git a/example/src/screens/menu.js b/example/src/screens/menu.js index 27245f7c23..3c2a75b78f 100644 --- a/example/src/screens/menu.js +++ b/example/src/screens/menu.js @@ -85,8 +85,8 @@ const styles = StyleSheet.create({ }, image: { margin: 30, - width: 80, - height: 80 + width: 90, + height: 90 }, menu: { width: 300, @@ -94,7 +94,7 @@ const styles = StyleSheet.create({ margin: 10, // backgroundColor: '#f2F4f5', alignItems: 'center', - borderRadius: 10, + borderRadius: 20, borderWidth: 1, borderColor: '#7a92a5' }, diff --git a/src/agenda/index.js b/src/agenda/index.js index 47af139311..c31db08c59 100644 --- a/src/agenda/index.js +++ b/src/agenda/index.js @@ -9,7 +9,6 @@ import CalendarList from '../calendar-list'; import ReservationsList from './reservation-list'; import styleConstructor from './style'; import {VelocityTracker} from '../input'; - import {AGENDA_CALENDAR_KNOB} from '../testIDs'; @@ -83,7 +82,7 @@ export default class AgendaView extends Component { onRefresh: PropTypes.func, /** Set this true while waiting for new data from a refresh. */ refreshing: PropTypes.bool, - /** Display loading indicador. Default = false */ + /** Display loading indicator. Default = false */ displayLoadingIndicator: PropTypes.bool }; @@ -378,7 +377,7 @@ export default class AgendaView extends Component { } const shouldAllowDragging = !this.props.hideKnob && !this.state.calendarScrollable; - const scrollPadPosition = (shouldAllowDragging ? HEADER_HEIGHT : 0) - KNOB_HEIGHT; + const scrollPadPosition = (shouldAllowDragging ? HEADER_HEIGHT : 0) - KNOB_HEIGHT; const scrollPadStyle = { position: 'absolute', diff --git a/src/calendar-list/item.js b/src/calendar-list/item.js index bfd719be50..20e332df2d 100644 --- a/src/calendar-list/item.js +++ b/src/calendar-list/item.js @@ -14,6 +14,7 @@ class CalendarListItem extends Component { constructor(props) { super(props); + this.style = styleConstructor(props.theme); } @@ -74,7 +75,8 @@ class CalendarListItem extends Component { onPressArrowLeft={this.props.horizontal ? this.onPressArrowLeft : this.props.onPressArrowLeft} onPressArrowRight={this.props.horizontal ? this.onPressArrowRight : this.props.onPressArrowRight} headerStyle={this.props.horizontal ? this.props.headerStyle : undefined} - />); + /> + ); } else { const text = row.toString(); diff --git a/src/calendar/day/basic/index.js b/src/calendar/day/basic/index.js index 57b1278eef..b9096b74d9 100644 --- a/src/calendar/day/basic/index.js +++ b/src/calendar/day/basic/index.js @@ -1,21 +1,17 @@ import React, {Component} from 'react'; -import { - TouchableOpacity, - Text, - View -} from 'react-native'; +import {View, TouchableOpacity, Text} from 'react-native'; import PropTypes from 'prop-types'; import {shouldUpdate} from '../../../component-updater'; import styleConstructor from './style'; + class Day extends Component { static displayName = 'IGNORE'; static propTypes = { // TODO: disabled props should be removed state: PropTypes.oneOf(['disabled', 'today', '']), - // Specify theme properties to override specific styles for calendar parts. Default = {} theme: PropTypes.object, marking: PropTypes.any, @@ -26,7 +22,9 @@ class Day extends Component { constructor(props) { super(props); + this.style = styleConstructor(props.theme); + this.onDayPress = this.onDayPress.bind(this); this.onDayLongPress = this.onDayLongPress.bind(this); } @@ -46,13 +44,13 @@ class Day extends Component { const containerStyle = [this.style.base]; const textStyle = [this.style.text]; const dotStyle = [this.style.dot]; - let marking = this.props.marking || {}; if (marking && marking.constructor === Array && marking.length) { marking = { marking: true }; } + const isDisabled = typeof marking.disabled !== 'undefined' ? marking.disabled : this.props.state === 'disabled'; let dot; if (marking.marked) { diff --git a/src/calendar/day/custom/index.js b/src/calendar/day/custom/index.js index 0bbde71787..24a0687746 100644 --- a/src/calendar/day/custom/index.js +++ b/src/calendar/day/custom/index.js @@ -43,15 +43,14 @@ class Day extends Component { render() { let containerStyle = [this.style.base]; let textStyle = [this.style.text]; - let marking = this.props.marking || {}; if (marking && marking.constructor === Array && marking.length) { marking = { marking: true }; } - const isDisabled = typeof marking.disabled !== 'undefined' ? marking.disabled : this.props.state === 'disabled'; + const isDisabled = typeof marking.disabled !== 'undefined' ? marking.disabled : this.props.state === 'disabled'; if (marking.selected) { containerStyle.push(this.style.selected); textStyle.push(this.style.selectedText); diff --git a/src/calendar/day/multi-dot/index.js b/src/calendar/day/multi-dot/index.js index 9cf2600968..f9bb1ddf44 100644 --- a/src/calendar/day/multi-dot/index.js +++ b/src/calendar/day/multi-dot/index.js @@ -1,15 +1,11 @@ import React, {Component} from 'react'; -import { - TouchableOpacity, - Text, - View -} from 'react-native'; +import {View, TouchableOpacity, Text} from 'react-native'; import PropTypes from 'prop-types'; import {shouldUpdate} from '../../../component-updater'; - import styleConstructor from './style'; + class Day extends Component { static displayName = 'IGNORE'; @@ -27,7 +23,9 @@ class Day extends Component { constructor(props) { super(props); + this.style = styleConstructor(props.theme); + this.onDayPress = this.onDayPress.bind(this); this.onDayLongPress = this.onDayLongPress.bind(this); } @@ -62,7 +60,6 @@ class Day extends Component { render() { const containerStyle = [this.style.base]; const textStyle = [this.style.text]; - const marking = this.props.marking || {}; const dot = this.renderDots(marking); @@ -78,6 +75,7 @@ class Day extends Component { containerStyle.push(this.style.today); textStyle.push(this.style.todayText); } + return (