Fix crash in FabricUIManager.onMeasure
Summary: Changelog: [Internal] The cause of crash was `NullPointerException`, which happened because of `mReactContextForRootTag.get(rootTag)` returning `null`. This is solved by checking whether it returns `null` before passing it to `I18nUtil`. Reviewed By: mdvacca Differential Revision: D20890623 fbshipit-source-id: c884c6838b83b944a5438375a4c060c1f5b1dc6e
This commit is contained in:
Родитель
e5497ca8f6
Коммит
0f0c9866ca
|
@ -816,14 +816,29 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
|
|||
if (ENABLE_FABRIC_LOGS) {
|
||||
FLog.d(TAG, "Updating Root Layout Specs");
|
||||
}
|
||||
|
||||
ThemedReactContext reactContext = mReactContextForRootTag.get(rootTag);
|
||||
boolean isRTL = false;
|
||||
boolean doLeftAndRightSwapInRTL = false;
|
||||
if (reactContext != null) {
|
||||
isRTL = I18nUtil.getInstance().isRTL(reactContext);
|
||||
doLeftAndRightSwapInRTL = I18nUtil.getInstance().doLeftAndRightSwapInRTL(reactContext);
|
||||
} else {
|
||||
// TODO T65116569: analyze why this happens
|
||||
ReactSoftException.logSoftException(
|
||||
TAG,
|
||||
new IllegalStateException(
|
||||
"updateRootLayoutSpecs called before ReactContext set for tag: " + rootTag));
|
||||
}
|
||||
|
||||
mBinding.setConstraints(
|
||||
rootTag,
|
||||
getMinSize(widthMeasureSpec),
|
||||
getMaxSize(widthMeasureSpec),
|
||||
getMinSize(heightMeasureSpec),
|
||||
getMaxSize(heightMeasureSpec),
|
||||
I18nUtil.getInstance().isRTL(mReactContextForRootTag.get(rootTag)),
|
||||
I18nUtil.getInstance().doLeftAndRightSwapInRTL(mReactContextForRootTag.get(rootTag)));
|
||||
isRTL,
|
||||
doLeftAndRightSwapInRTL);
|
||||
}
|
||||
|
||||
public void receiveEvent(int reactTag, String eventName, @Nullable WritableMap params) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче