小编B. *_*mad的帖子

如何持久保留语言更改react-i18next React-native

我使用react-i18nexti18next来本地化一个应用程序。我希望能够在设置中手动更改语言并保留该更改。问题是我不知道如何在i18n配置文件中使用 redux,因为 redux 是异步的,我也检查了文档中的一些内置存储选项,react-i18next但没有成功。

这是i18n配置文件:

'use strict';

import i18n from 'i18next';
import {reactI18nextModule, initReactI18next} from 'react-i18next';
import DeviceInfo from 'react-native-device-info';

import translationFR from '../translation/fr/translation.json';
import translationEN from '../translation/en/translation.json';
import translationAR from '../translation/ar/translation.json';

async function getAppLang() {
  const unsubscribe = store.subscribe(() => true);
  const appLang = await store.getState().appLang;
  await unsubscribe();
  return appLang;
}

let locale = DeviceInfo.getDeviceLocale().substring(0, 2);
if (locale != 'fr' && locale != 'ar') {
  locale = 'en';
} …
Run Code Online (Sandbox Code Playgroud)

i18next react-native react-i18next

8
推荐指数
0
解决办法
2360
查看次数

RN 升级后找不到“FBLazyVector”的 podspec

编辑:我的解决方案是在升级之前使用我以前的 PodFile,ios 应用程序现在正在运行。

我使用 将 RN 应用程序升级到 0.59.1(它是 0.57.8)react-native upgrade,android 版本正在运行,但对于 ios 版本,我坚持使用 pod install,这会引发此错误:

[!] No podspec found for `FBLazyVector` in `../node_modules/react-native/Libraries/FBLazyVector 几乎所有 react-native 依赖项都给出了类似的错误,我知道通过一一注释 pod 并运行 pod install

这是我的 Podfile:


# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
 require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
target 'MdcIos' do
  pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
  pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
  pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
  pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
  pod 'React', :path => …
Run Code Online (Sandbox Code Playgroud)

react-native podfile

6
推荐指数
1
解决办法
7095
查看次数

更改导航标题中后退箭头的颜色

我修改了导航栏中后退按钮的标准行为

使用此代码:

export class QuranSouratesPage extends React.Component{
  static navigationOptions =({ navigation }) => ({
    title: 'Le noble Coran',
    headerLeft: <HeaderBackButton onPress={() => {navigation.navigate('SearchPage')}}/>,
});
Run Code Online (Sandbox Code Playgroud)

现在我有正确的行为,除了箭头的颜色现在变成黑色,我找不到一种方法来改变箭头的颜色,我尝试使用tintColor设置样式但没有结果。

react-native react-navigation

5
推荐指数
2
解决办法
6438
查看次数

部署密钥为空 appcenter 代码推送 cli

我尝试使用以下命令检索代码推送部署密钥:

appcenter codepush deployment list -a <name/appName> --displayKeys

它返回一个空表:

在此输入图像描述

iOS/Android 应用程序已添加到应用程序中心控制台

react-native react-native-code-push visual-studio-app-center

3
推荐指数
1
解决办法
795
查看次数