Skip to content
This repository has been archived by the owner on Sep 24, 2020. It is now read-only.

Commit

Permalink
[Fix] utils/moment - RN 0.49 compatibily
Browse files Browse the repository at this point in the history
  • Loading branch information
ovr committed Oct 12, 2017
1 parent fc7e596 commit 37e72b8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions utils/moment.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// @flow

import DeviceInfo from 'react-native-device-info';
import moment from 'moment/min/moment-with-locales.min';
import { getDeviceLocale } from 'react-native-device-info';
import moment from 'moment';

moment.locale(DeviceInfo.getDeviceLocale().split('-')[0]);
import 'moment/min/locales';

moment.locale(getDeviceLocale().split('-')[0]);

export default moment;

6 comments on commit 37e72b8

@lex111
Copy link
Collaborator

@lex111 lex111 commented on 37e72b8 Oct 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import moment from 'moment/min/moment-with-locales.min';

Почему так лучше?

import moment from 'moment';
import 'moment/min/locales';

@ovr
Copy link
Owner Author

@ovr ovr commented on 37e72b8 Oct 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lex111 Ты предлогаешь пустую строку убрать?

@lex111
Copy link
Collaborator

@lex111 lex111 commented on 37e72b8 Oct 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Чем это?

import moment from 'moment';
import 'moment/min/locales';

Лучше этого?

import moment from 'moment/min/moment-with-locales.min';

Одно и то же вроде?

@ovr
Copy link
Owner Author

@ovr ovr commented on 37e72b8 Oct 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нет =)

import moment from 'moment/min/moment-with-locales.min';

Тут dynamic import будет, а в RN 0.49 не будет работать (

@lex111
Copy link
Collaborator

@lex111 lex111 commented on 37e72b8 Oct 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Аа, понятно, нужно будет прочитать про этот dynamic import..

@ovr
Copy link
Owner Author

@ovr ovr commented on 37e72b8 Oct 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lex111

facebook/metro#52

import() ES6 = require

Please sign in to comment.