为什么我的本地化方法在react native总是去else块?



我通过了"但是函数总是转到else部分

const _retrieveData = async () => {
  console.log('_retrieveData')
  try {
    const value = await AsyncStorage.getItem('LocalizationKey');
    const result = JSON.stringify(value);
    console.log("result==>type", typeof (result))
    if (value !== null) {
      console.log('value--------> in getItem', value)
      if (result === "ar") {
        console.log('i18local__ar')
        I18n.locale = "ar";
      }
      else {
        console.log('i18local__en')
        I18n.locale = "en";
      }
    }
  } catch (error) {
    console.log('error', error)
  }
}

console show当我调用函数时使用pass "ar"作为参数

= =在结果;字符串类型

i18.js:16 value -------->

请帮我解决这个问题谢谢你! !

我正在关闭我的问题,因为它现在已经解决了。我比较的是"这个问题都是字符串类型的这就是为什么题目给我显示了字符串类型

最新更新