Releases: web-ridge/react-native-paper-dates
Releases · web-ridge/react-native-paper-dates
Release 0.4.4
Release 0.4.2
Release 0.4.1
Release 0.4.0
0.4.0 (2021-03-10)
Bugfixes
- DatePicker crashes when entering invalid date in edit. Thanks @chakrihacker!
Features
- min/max date in range picker by @nandorojo (Twitter
- When using multiselect and selecting multiple days after each other show the range layout in background #50
- also check valid range in input mode + show errors (92c7c94)
- optional range util (7408a8c)
- valid range support (1b5da06)
Breaking changes
- removed undocumented excludeInRange mode
Release 0.3.2
Release 0.3.1
Release 0.3.0
0.3.0 (2021-02-20)
New features
- Multiple dates mode is added! Amazing PR by @nandorojo
He also made a video of the feature:
Checkout it his Twitter he does some amazing things with Dripsy
You can use it like this
import * as React from 'react';
import { Button } from 'react-native-paper';
import { DatePickerModal } from 'react-native-paper-dates';
export default function ReadMeExampleMultiple() {
const [dates, setDates] = React.useState<Date[] | undefined>();
const [open, setOpen] = React.useState(false);
const onDismiss = React.useCallback(() => {
setOpen(false);
}, [setOpen]);
const onConfirm = React.useCallback((params) => {
setOpen(false);
setDates(params.dates);
console.log('[on-change-multi]', params);
}, []);
return (
<>
<Button onPress={() => setOpen(true)} uppercase={false} mode="outlined">
Pick multiple dates
</Button>
<DatePickerModal
// locale={'en'} optional, default: automatic
mode="multiple"
visible={open}
onDismiss={onDismiss}
dates={dates}
onConfirm={onConfirm}
// locale={'nl'} // optional
// saveLabel="Save" // optional
// label="Select period" // optional
// startLabel="From" // optional
// endLabel="To" // optional
// animationType="slide" // optional, default is slide on ios/android and none on web
/>
</>
);
}
Release 0.2.15
0.2.15 (2021-01-20)
Bug Fixes
You should re-read the instructions for Android since we didn't follow the flow diagram provided by FormatJS it will result in errors on Android if not using Hermes (but it will potentially also result in bugs in the future when using Hermes)
The import order of the formatjs imports was wrong and should change to the code below.
// on top of your index.js file
const isAndroid = require('react-native').Platform.OS === 'android';
const isHermesEnabled = !!global.HermesInternal;
// in your index.js file
if (isHermesEnabled || isAndroid) {
require('@formatjs/intl-getcanonicallocales/polyfill');
require('@formatjs/intl-locale/polyfill');
require('@formatjs/intl-pluralrules/polyfill');
require('@formatjs/intl-pluralrules/locale-data/en.js'); // USE YOUR OWN LANGUAGE OR MULTIPLE IMPORTS YOU WANT TO SUPPORT
require('@formatjs/intl-displaynames/polyfill');
require('@formatjs/intl-displaynames/locale-data/en.js'); // USE YOUR OWN LANGUAGE OR MULTIPLE IMPORTS YOU WANT TO SUPPORT
require('@formatjs/intl-listformat/polyfill');
require('@formatjs/intl-listformat/locale-data/en.js'); // USE YOUR OWN LANGUAGE OR MULTIPLE IMPORTS YOU WANT TO SUPPORT
require('@formatjs/intl-numberformat/polyfill');
require('@formatjs/intl-numberformat/locale-data/en.js'); // USE YOUR OWN LANGUAGE OR MULTIPLE IMPORTS YOU WANT TO SUPPORT
require('@formatjs/intl-relativetimeformat/polyfill');
require('@formatjs/intl-relativetimeformat/locale-data/en.js'); // USE YOUR OWN LANGUAGE OR MULTIPLE IMPORTS YOU WANT TO SUPPORT
require('@formatjs/intl-datetimeformat/polyfill');
require('@formatjs/intl-datetimeformat/locale-data/en.js'); // USE YOUR OWN LANGUAGE OR MULTIPLE IMPORTS YOU WANT TO SUPPORT
require('@formatjs/intl-datetimeformat/add-golden-tz.js');
// https://formatjs.io/docs/polyfills/intl-datetimeformat/#default-timezone
let RNLocalize = require('react-native-localize');
if ('__setDefaultTimeZone' in Intl.DateTimeFormat) {
Intl.DateTimeFormat.__setDefaultTimeZone(RNLocalize.getTimeZone());
}
}
Source: formatjs.io/docs/polyfills
note
Update README.md