BugiDev / BugiDev/react-native-calendar-strip

how can I dynamically change locale via i18n

Open
#377 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
976
Forks
336
PR merge metrics
No merged PRs in 30d

Description

How can I dynamically change locale via i18n?
The locale only changes when i restart application

```
import moment from 'moment';
import 'moment/locale/cs';
import 'moment/locale/de';
import 'moment/locale/es';
import 'moment/locale/pt';
import 'moment/locale/uk';
import React, { useEffect } from 'react';
import { useTranslation } from 'react-i18next';
import CalendarStrip from 'react-native-calendar-strip';

import { COLORS } from '@app/theme/constants/COLORS';

import { styles } from './styles';

export function LinearCalendar(props) {
const {
markedDates,
onDateSelected,
selectedDate,
datesBlacklist,
showMarketDates,
hideArrows,
...rest
} = props;

const { t, i18n } = useTranslation();
moment.locale(i18n.language);

const markedDatesArray = showMarketDates ? getMarkedByOrderDates(markedDates) : null;

return (

);
}

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.