我想让我的反应原生应用程序RTL。
Setup.hs
如何获得我在下面使用的上下文:
I18nUtil sharedI18nUtilInstance = I18nUtil.getInstance();
sharedI18nUtilInstance.setAllowRTL(context, true);
但是我得到sharedI18nUtilInstance.allowRTL(getApplicationContext(),true);
NullPointerException
答案 0 :(得分:4)
您可以在MainActivety.java
文件中使用此代码强制您的应用为RTL或LTR。我用它,它对我有用。
import com.facebook.react.modules.i18nmanager.I18nUtil;
@Override
public void onCreate() {
super.onCreate();
// FORCE LTR
I18nUtil sharedI18nUtilInstance = I18nUtil.getInstance();
sharedI18nUtilInstance.allowRTL(getApplicationContext(), false);
....
}