Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
thalia
ThaliApp
Commits
098d30d7
Commit
098d30d7
authored
Oct 22, 2017
by
Sébastiaan Versteeg
Committed by
Sébastiaan Versteeg
Feb 21, 2018
Browse files
Remove setting Moment locale in multiple components
parent
523c9065
Changes
5
Hide whitespace changes
Inline
Side-by-side
app/app.js
View file @
098d30d7
...
...
@@ -2,11 +2,12 @@ import React, { Component } from 'react';
import
{
AsyncStorage
,
Linking
,
Platform
}
from
'
react-native
'
;
import
{
applyMiddleware
,
combineReducers
,
createStore
}
from
'
redux
'
;
import
{
Provider
}
from
'
react-redux
'
;
import
{
I18nextProvider
}
from
'
react-i18next
'
;
import
createSagaMiddleware
from
'
redux-saga
'
;
import
FCM
,
{
FCMEvent
}
from
'
react-native-fcm
'
;
import
locale
from
'
react-native-locale-detector
'
;
import
Moment
from
'
moment
'
;
import
'
moment/locale/nl
'
;
import
{
I18nextProvider
}
from
'
react-i18next
'
;
import
*
as
reducers
from
'
./reducers
'
;
...
...
@@ -52,8 +53,16 @@ FCM.on(FCMEvent.RefreshToken, async () => {
});
class
Main
extends
Component
{
constructor
()
{
super
();
if
(
locale
.
startsWith
(
'
nl
'
))
{
Moment
.
locale
(
locale
);
}
else
{
Moment
.
locale
(
'
en
'
);
}
}
componentDidMount
()
{
Moment
.
locale
(
'
nl
'
);
AsyncStorage
.
multiGet
([
USERNAMEKEY
,
TOKENKEY
,
DISPLAYNAMEKEY
,
PHOTOKEY
])
.
then
(
(
result
)
=>
{
...
...
app/components/Calendar.js
View file @
098d30d7
...
...
@@ -3,7 +3,6 @@ import PropTypes from 'prop-types';
import
{
Text
,
View
,
SectionList
,
ScrollView
,
RefreshControl
}
from
'
react-native
'
;
import
{
connect
}
from
'
react-redux
'
;
import
Moment
from
'
moment
'
;
import
'
moment/locale/nl
'
;
import
*
as
calendarActions
from
'
../actions/calendar
'
;
import
EventCard
from
'
./EventCard
'
;
...
...
@@ -118,10 +117,6 @@ const renderItem = (item) => {
};
class
Calendar
extends
Component
{
componentDidMount
()
{
Moment
.
locale
(
'
nl
'
);
}
handleRefresh
=
()
=>
{
this
.
props
.
refresh
();
};
...
...
app/components/Event.js
View file @
098d30d7
...
...
@@ -3,7 +3,6 @@ import PropTypes from 'prop-types';
import
{
FlatList
,
Alert
,
Image
,
ScrollView
,
Text
,
View
,
RefreshControl
,
Button
,
TouchableHighlight
,
Platform
,
Linking
}
from
'
react-native
'
;
import
{
connect
}
from
'
react-redux
'
;
import
Moment
from
'
moment
'
;
import
'
moment/locale/nl
'
;
import
styles
,
{
memberSize
}
from
'
./style/event
'
;
import
MemberView
from
'
./MemberView
'
;
...
...
app/components/EventCard.js
View file @
098d30d7
...
...
@@ -10,7 +10,6 @@ import * as eventActions from '../actions/event';
import
styles
from
'
./style/eventCard
'
;
const
getEventInfo
=
(
event
)
=>
{
Moment
.
locale
(
'
nl
'
);
if
(
event
.
start
===
null
&&
event
.
end
===
null
)
{
return
event
.
location
;
}
else
if
(
event
.
start
===
null
)
{
...
...
app/components/EventDetailCard.js
View file @
098d30d7
...
...
@@ -3,7 +3,6 @@ import PropTypes from 'prop-types';
import
{
View
,
Text
,
TouchableOpacity
,
TouchableHighlight
}
from
'
react-native
'
;
import
{
connect
}
from
'
react-redux
'
;
import
Moment
from
'
moment
'
;
import
'
moment/locale/nl
'
;
import
*
as
actions
from
'
../actions/event
'
;
import
{
retrievePizzaInfo
}
from
'
../actions/pizza
'
;
...
...
@@ -12,7 +11,6 @@ import styles from './style/eventDetailCard';
import
{
colors
}
from
'
../style
'
;
const
getInfo
=
(
event
)
=>
{
Moment
.
locale
(
'
nl
'
);
const
start
=
Moment
(
event
.
start
);
const
end
=
Moment
(
event
.
end
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment