Skip to content

Commit

Permalink
remove usage of ViewPropTypes
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip Nagler-Frank committed Apr 20, 2021
1 parent 11a8c3d commit bfb7bbd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
9 changes: 2 additions & 7 deletions src/agenda/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import _ from 'lodash';
import PropTypes from 'prop-types';
import XDate from 'xdate';
import React, {Component} from 'react';
import * as ReactNative from 'react-native';
import {Text, View, Dimensions, Animated} from 'react-native';
import {extractComponentProps} from '../component-updater';
import {parseDate, xdateToData} from '../interface';
import dateutils from '../dateutils';
Expand All @@ -15,11 +15,6 @@ import ReservationList from './reservation-list';
const HEADER_HEIGHT = 104;
const KNOB_HEIGHT = 24;

//Fallback for react-native-web or when RN version is < 0.44
const {Text, View, Dimensions, Animated, ViewPropTypes} = ReactNative;
const viewPropTypes =
typeof document !== 'undefined' ? PropTypes.shape({style: PropTypes.object}) : ViewPropTypes || View.propTypes;

/**
* @description: Agenda component
* @extends: CalendarList
Expand All @@ -34,7 +29,7 @@ export default class AgendaView extends Component {
...CalendarList.propTypes,
...ReservationList.propTypes,
/** agenda container style */
style: viewPropTypes.style,
style: PropTypes.oneOfType([PropTypes.object, PropTypes.array, PropTypes.number]),
/** the list of items that have to be displayed in agenda. If you want to render item as empty date
the value of date key has to be an empty array []. If there exists no value for date key it is
considered that the date in question is not yet loaded */
Expand Down
8 changes: 2 additions & 6 deletions src/calendar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import _ from 'lodash';
import PropTypes from 'prop-types';
import XDate from 'xdate';
import React, {Component} from 'react';
import * as ReactNative from 'react-native';
import {View} from 'react-native';
import GestureRecognizer, {swipeDirections} from 'react-native-swipe-gestures';
import dateutils from '../dateutils';
import {xdateToData, parseDate} from '../interface';
Expand All @@ -14,10 +14,6 @@ import CalendarHeader from './header';
import BasicDay from './day/basic';
import Day from './day/index';

//Fallback for react-native-web or when RN version is < 0.44
const {View, ViewPropTypes} = ReactNative;
const viewPropTypes =
typeof document !== 'undefined' ? PropTypes.shape({style: PropTypes.object}) : ViewPropTypes || View.propTypes;
const EmptyArray = [];

/**
Expand All @@ -34,7 +30,7 @@ class Calendar extends Component {
/** Specify theme properties to override specific styles for calendar parts. Default = {} */
theme: PropTypes.object,
/** Specify style for calendar container element. Default = {} */
style: viewPropTypes.style,
style: PropTypes.oneOfType([PropTypes.object, PropTypes.array, PropTypes.number]),
/** Initially visible month. Default = Date() */
current: PropTypes.any,
/** Minimum date that can be selected, dates before minDate will be grayed out. Default = undefined */
Expand Down

0 comments on commit bfb7bbd

Please sign in to comment.