Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all articles
Browse latest Browse all 29798

react native moment updateLocal fr crush android

$
0
0

I want to translate date to french language using moment library.

I create an android build but it crashed when i open the component.

My code is :

import Moment from 'moment';

// i fixed the error 
// var moment = require('moment');
//require('moment/locale/fr');
//moment.locale('fr');



    render() {
....
{
this.state.notifications.map((notification, i) => (     
    Moment.updateLocale('fr', {
        // the config here
        // translate to french
    }),
    notification.type === 'Partage de contact' ?
        <ListItem
            key={i}
            ...
            subtitle={`Date : ${Moment(notification.date).format('dddd D MMMM,  YYYY')}`}
            bottomDivider
        />
        :
        <ListItem
            ...
            subtitle={`Date : ${Moment(notification.date).format('dddd D MMMM,  YYYY')}`}
            bottomDivider
        />
))
}
...

}

Viewing all articles
Browse latest Browse all 29798

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>