0
    const specialHandleLanguage = {
      en: 'en-au',
      pt: 'pt-br',
      tl: 'tl-ph',
      cn: 'zh-cn',
      hk: 'zh-hk',
      tw: 'zh-tw'
    };

    const lang = specialHandleLanguage['en'] || 'en';
    require(`moment/locale/${lang}`);
    moment.updateLocale(lang, {});

Due to momentJS has different file name, so I have to "require" the file base on specific language. I'm wondering how to achieve it as I'm hitting below exception

error: bundling failed: Error: src/screen.js:Invalid call at line 449: require("moment/locale/" + lang)

Isaac
  • 12,042
  • 16
  • 52
  • 116
  • Not sure I understand the question. In RN I import momentjs with `import moment from 'moment'` after installing it via npm/yarn. – stever Jan 24 '19 at 16:16
  • @stever: Yes in general. However now I need to display moment with specific locale. – Isaac Jan 24 '19 at 16:18

0 Answers0