Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 28 additions & 33 deletions docusaurus/docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,10 @@ npm install react-native-paper-dates --save

### Supported

React-Native-Paper-Dates currently supports `en/nl/de/pl/pt/ar/ko/fr/tr/enGB` translations. Ideally you would do this somewhere before react-native-paper-dates is used. For example, you might add the follow to your `index.js` or `app.js`.
React-Native-Paper-Dates currently supports `en/nl/de/pl/pt/ar/ko/fr/he/tr/enGB` translations. Ideally you would do this somewhere before react-native-paper-dates is used. For example, you might add the follow to your `index.js` or `app.js`.

```javascript
import {
enGB,
registerTranslation,
} from 'react-native-paper-dates'
import { enGB, registerTranslation } from 'react-native-paper-dates'
registerTranslation('en-GB', enGB)
```

Expand All @@ -51,10 +48,8 @@ registerTranslation('en-GB', enGB)
React-Native-Paper-Dates also provides the ability to register your own translation. Ideally you would do this somewhere before react-native-paper-dates is used. For example, you might add the follow to your `index.js` or `app.js`.

```javascript
import {
registerTranslation,
} from 'react-native-paper-dates'
registerTranslation("pl", {
import { registerTranslation } from 'react-native-paper-dates'
registerTranslation('pl', {
save: 'Save',
selectSingle: 'Select date',
selectMultiple: 'Select dates',
Expand Down Expand Up @@ -119,41 +114,41 @@ Don't forget to import the languages you want to support, in the example only en

```javascript
// on top of your index.android.js file
const isAndroid = require('react-native').Platform.OS === 'android'; // this line is only needed if you don't use an .android.js file
const isHermesEnabled = !!global.HermesInternal; // this line is only needed if you don't use an .android.js file
const isAndroid = require('react-native').Platform.OS === 'android' // this line is only needed if you don't use an .android.js file
const isHermesEnabled = !!global.HermesInternal // this line is only needed if you don't use an .android.js file

// in your index.js file
if (isHermesEnabled || isAndroid) { // this line is only needed if you don't use an .android.js file
if (isHermesEnabled || isAndroid) {
// this line is only needed if you don't use an .android.js file

require('@formatjs/intl-getcanonicallocales/polyfill');
require('@formatjs/intl-locale/polyfill');
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-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-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-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-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-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/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');
require('@formatjs/intl-datetimeformat/add-golden-tz.js')

// https://formatjs.io/docs/polyfills/intl-datetimeformat/#default-timezone
if ('__setDefaultTimeZone' in Intl.DateTimeFormat) {

// If you are using react-native-cli
let RNLocalize = require('react-native-localize');
Intl.DateTimeFormat.__setDefaultTimeZone(RNLocalize.getTimeZone());
let RNLocalize = require('react-native-localize')
Intl.DateTimeFormat.__setDefaultTimeZone(RNLocalize.getTimeZone())

// Are you using Expo, use this instead of previous 2 lines
// Intl.DateTimeFormat.__setDefaultTimeZone(
Expand All @@ -169,9 +164,9 @@ if (isHermesEnabled || isAndroid) { // this line is only needed if you don't us
- Try to avoid putting the Picker Modals inside of a scrollView If that is not possible use the following props on the surrounding ScrollViews/Flatlists

```javascript
keyboardDismissMode="on-drag"
keyboardShouldPersistTaps="handled"
contentInsetAdjustmentBehavior="always"
keyboardDismissMode = 'on-drag'
keyboardShouldPersistTaps = 'handled'
contentInsetAdjustmentBehavior = 'always'
```

This is to prevent the need to press 2 times before save or close button in modal works (1 press for closing keyboard, 1 press for confirm/close) [React Native Issue: #10138](https://github.com/facebook/react-native/issues/10138)
2 changes: 1 addition & 1 deletion src/__tests__/Time/__snapshots__/TimeInput.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ exports[`renders TimeInput 1`] = `
style={
[
{
"fontSize": 57,
"textAlign": "center",
"textAlignVertical": "center",
"width": 96,
Expand All @@ -31,6 +30,7 @@ exports[`renders TimeInput 1`] = `
"borderRadius": 8,
"borderWidth": 2,
"color": "rgba(33, 0, 93, 1)",
"fontSize": 57,
"height": 80,
},
]
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/Time/__snapshots__/TimeInputs.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ exports[`renders TimeInputs 1`] = `
style={
[
{
"fontSize": 57,
"textAlign": "center",
"textAlignVertical": "center",
"width": 96,
Expand All @@ -54,6 +53,7 @@ exports[`renders TimeInputs 1`] = `
"borderRadius": 8,
"borderWidth": 0,
"color": "rgba(28, 27, 31, 1)",
"fontSize": 57,
"height": 72,
},
]
Expand Down Expand Up @@ -178,7 +178,6 @@ exports[`renders TimeInputs 1`] = `
style={
[
{
"fontSize": 57,
"textAlign": "center",
"textAlignVertical": "center",
"width": 96,
Expand All @@ -189,6 +188,7 @@ exports[`renders TimeInputs 1`] = `
"borderRadius": 8,
"borderWidth": 0,
"color": "rgba(28, 27, 31, 1)",
"fontSize": 57,
"height": 72,
},
]
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/Time/__snapshots__/TimePicker.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ exports[`renders TimePicker 1`] = `
style={
[
{
"fontSize": 57,
"textAlign": "center",
"textAlignVertical": "center",
"width": 96,
Expand All @@ -62,6 +61,7 @@ exports[`renders TimePicker 1`] = `
"borderRadius": 8,
"borderWidth": 0,
"color": "rgba(28, 27, 31, 1)",
"fontSize": 57,
"height": 72,
},
]
Expand Down Expand Up @@ -186,7 +186,6 @@ exports[`renders TimePicker 1`] = `
style={
[
{
"fontSize": 57,
"textAlign": "center",
"textAlignVertical": "center",
"width": 96,
Expand All @@ -197,6 +196,7 @@ exports[`renders TimePicker 1`] = `
"borderRadius": 8,
"borderWidth": 0,
"color": "rgba(28, 27, 31, 1)",
"fontSize": 57,
"height": 72,
},
]
Expand Down
1 change: 1 addition & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export { default as en } from './translations/en'
export { default as enGB } from './translations/enGB'
export { default as es } from './translations/es'
export { default as fr } from './translations/fr'
export { default as he } from './translations/he'
export { default as it } from './translations/it'
export { default as ko } from './translations/ko'
export { default as nl } from './translations/nl'
Expand Down
21 changes: 21 additions & 0 deletions src/translations/he.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { TranslationsType } from './utils'

const he: TranslationsType = {
save: 'שמור',
selectSingle: 'בחר תאריך',
selectMultiple: 'בחר תאריכים',
selectRange: 'בחר טווח',
notAccordingToDateFormat: (inputFormat) =>
`פורמט של תאריך צריך להיות ${inputFormat}`,
mustBeHigherThan: (date) => `חייב להיות אחרי ${date}`,
mustBeLowerThan: (date) => `חייב להיות לפני ${date}`,
mustBeBetween: (startDate, endDate) =>
`חייב להיות בין ${startDate} - ${endDate}`,
dateIsDisabled: 'יום לא מורשה',
previous: 'הקודם',
next: 'הבא',
typeInDate: 'הקש תאריך',
pickDateFromCalendar: 'בחר תאריך מהלוח שנה',
close: 'סגור',
}
export default he