react-native-calendars icon indicating copy to clipboard operation
react-native-calendars copied to clipboard

undefined is not an object (evaluating 'getSetting('monthNames')[getField(MONTH)]')

Open minh-dai opened this issue 4 years ago • 10 comments

"react-native": "0.61.0", "react-native-calendars": "^1.265.0",

minh-dai avatar Apr 07 '20 13:04 minh-dai

Same Error, but with 'DAY'.

TypeError: TypeError: undefined is not an object (evaluating 'getSetting('dayNames')[getField(DAY)]')

roseniltonreis avatar Apr 14 '20 04:04 roseniltonreis

Solved add dayNames on array ->

LocaleConfig.locales['pt'] = { monthNames: ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'], monthNamesShort: ['Jan.', 'Fev.', 'Mar', 'Abril', 'Mai', 'Jun', 'Jul.', 'Ago', 'Set.', 'Out.', 'Nov.', 'Dez.'], dayNames: ['Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sábado', 'Domingo'], dayNamesShort: ['Dom.', 'Seg.', 'Ter.', 'Qua.', 'Qui.', 'Sex.', 'Sab.'] };

LocaleConfig.defaultLocale = 'pt';

try add 'LocaleConfig' as above.

roseniltonreis avatar Apr 14 '20 04:04 roseniltonreis

same error

Stas-Buzunko avatar Apr 16 '20 21:04 Stas-Buzunko

Solved add dayNames on array ->

LocaleConfig.locales['pt'] = { monthNames: ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'], monthNamesShort: ['Jan.', 'Fev.', 'Mar', 'Abril', 'Mai', 'Jun', 'Jul.', 'Ago', 'Set.', 'Out.', 'Nov.', 'Dez.'], dayNames: ['Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sábado', 'Domingo'], dayNamesShort: ['Dom.', 'Seg.', 'Ter.', 'Qua.', 'Qui.', 'Sex.', 'Sab.'] };

LocaleConfig.defaultLocale = 'pt';

try add 'LocaleConfig' as above.

doesn't always help, sometimes i need to change something and save -> it reloads js bundle and then error goes away, weird

Stas-Buzunko avatar Apr 17 '20 11:04 Stas-Buzunko

Same error

germanolira avatar Nov 20 '21 22:11 germanolira

Same error. Even though I removed the LocaleConfig lines, the error still appeared. Why @chenei you close while there haven't been any contribution or solution comments?

BeeTheJason avatar May 12 '22 06:05 BeeTheJason

Same error. Even though I removed the LocaleConfig lines, the error still appeared. Why @chenei you close while there haven't been any contribution or solution comments?

I closed because I wasn't able to reproduce. reopening.

chenei avatar May 15 '22 10:05 chenei

@BeeTheJason You can try, move the following configuration to App.js:

LocaleConfig.locales['pt'] = {
monthNames: ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'],
monthNamesShort: ['Jan.', 'Fev.', 'Mar', 'Abril', 'Mai', 'Jun', 'Jul.', 'Ago', 'Set.', 'Out.', 'Nov.', 'Dez.'],
dayNames: ['Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sábado', 'Domingo'],
dayNamesShort: ['Dom.', 'Seg.', 'Ter.', 'Qua.', 'Qui.', 'Sex.', 'Sab.']
};

LocaleConfig.defaultLocale = 'pt';

fadeli1 avatar Jun 02 '22 07:06 fadeli1

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 04 '22 17:09 stale[bot]

I have the same issue, with these dependencies:

    "dependencies": {
        "i18next": "^21.9.1",
        "react": "18.0.0",
        "react-dom": "18.0.0",
        "react-i18next": "^11.18.4",
        "react-is": "^18.2.0",
        "react-native": "0.69.5",
        "react-native-calendars": "^1.1275.0",
        "react-native-device-info": "^8.7.0",
        "react-native-encrypted-storage": "^4.0.2",
        "react-native-gesture-handler": "^2.3.0",
        "react-native-paper": "^4.12.4",
        "react-native-safe-area-context": "^4.1.2",
        "react-native-screens": "^3.13.1",
        "react-native-vector-icons": "^9.1.0",
        "styled-components": "^5.3.5"
    },

Worked, with previous react native (0.68.x). Now it seems no more happy. I have the months/days names in the i18n files and they were working properly (see TKCompanionApp version 3.1.2 on F-Droid. Now I'm preparing the new version, just updated to a newer React Native and that's it. 😢 photo_5866462136044206391_y Screenshot_1663924080

I'm trying to cleanup everything and rebuild to see if something changes...

marcoXbresciani avatar Sep 23 '22 08:09 marcoXbresciani

I might have got the point. Updating React from 0.68.0 to 0.69.5 seems that the locale changed from simple en to en-US and I don't have the en-US.json file in my i18n list, only en.json. It was working till now. 🤷 Well, anyway now I've changed things so that if I have a locale-country information and I don't have the country-specific i18n file, I'll cut to the language only part and see if available. Seems working fine in this way.

marcoXbresciani avatar Sep 23 '22 11:09 marcoXbresciani

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 23 '22 22:12 stale[bot]