使用区域设置进行React-native日期选择器语言更改不起作用?

h43kikqp  于 2022-12-14  发布在  React
关注(0)|答案(1)|浏览(154)

我正在进行react-native datepicker语言更改,代码:

import React from 'react'
import DatePicker from 'react-native-datepicker'
import 'moment/locale/zh-cn'
import 'moment/locale/fr'

export default class ScheduleDatePicker extends React.Component {
  state = {
    date: ''
  }

  render() {

    return ( <
      DatePicker mode = 'datetime'
      format = 'lll'
      locale = 'fr'

      style = {
        {
          width: 300,
          marginHorizontal: 5
        }
      }
      date = {
        this.state.date
      }
      customStyles = {
        {
          dateInput: {
            flex: 1,
            borderWidth: 0,
            alignItems: 'flex-end'
          },
          btnTextConfirm: {
            color: '#D05B35'
          },
          dateText: {
            fontFamily: 'System',
            fontSize: 15,
            fontWeight: '500',
            color: 'rgba(74, 74, 74, 1)'
          }
        }
      }
      onDateChange = {
        (date) => {
          this.setState({
            date: date
          })
        }
      }
      />
    )
  }
}

输出:24 juil. 2019 16:38
但无法在日期选择器中更改。日期和月份名称无法更改,该怎么办?

u4vypkhs

u4vypkhs1#

我认为您使用了错误的法语本地语言https://www.science.co.il/language/Locale-codes.php法语-加拿大= fr-ca法语-比利时= fr-be
检查本地代码的链接
区域设置='fr-ca'

相关问题