mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Early ViewCommand dispatch: retry exactly once, log soft errors in one place
Summary: As a followup to T63997094, I think it is better to attempt to execute early once, and then to execute the ViewCommand after the current batch of mount instructions if that fails. If both fail, then log a soft exception. This is to support the use-case here, when ScrollView.scrollToEnd is called during the render pass, before any Views are mounted on the screen: https://our.intern.facebook.com/intern/diffusion/FBS/browse/master/xplat/js/RKJSModules/Apps/Profile/ProfileEdit/ui/featured_highlights_migration/ProfileEditFeaturedHighlightsMigrationProfilePreview.js?commit=75f66a9077abb81b7797079b567df759dd023a79&lines=221-229 Changelog: [Internal] Fix for dispatching ViewCommands early Reviewed By: mdvacca Differential Revision: D20478681 fbshipit-source-id: 052b3ecf4913a0096f590637faf0f68a072e2427
This commit is contained in:
committed by
Facebook GitHub Bot
parent
44618c80ed
commit
bb7f4dc818
+10
-13
@@ -24,7 +24,6 @@ import com.facebook.react.R;
|
||||
import com.facebook.react.bridge.Callback;
|
||||
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.bridge.ReactSoftException;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.SoftAssertions;
|
||||
@@ -766,13 +765,12 @@ public class NativeViewHierarchyManager {
|
||||
UiThreadUtil.assertOnUiThread();
|
||||
View view = mTagsToViews.get(reactTag);
|
||||
if (view == null) {
|
||||
ReactSoftException.logSoftException(
|
||||
TAG,
|
||||
new IllegalViewOperationException(
|
||||
"Trying to send command to a non-existing view " + "with tag " + reactTag));
|
||||
return;
|
||||
throw new IllegalViewOperationException(
|
||||
"Trying to send command to a non-existing view with tag ["
|
||||
+ reactTag
|
||||
+ "] and command "
|
||||
+ commandId);
|
||||
}
|
||||
|
||||
ViewManager viewManager = resolveViewManager(reactTag);
|
||||
viewManager.receiveCommand(view, commandId, args);
|
||||
}
|
||||
@@ -782,13 +780,12 @@ public class NativeViewHierarchyManager {
|
||||
UiThreadUtil.assertOnUiThread();
|
||||
View view = mTagsToViews.get(reactTag);
|
||||
if (view == null) {
|
||||
ReactSoftException.logSoftException(
|
||||
TAG,
|
||||
new IllegalViewOperationException(
|
||||
"Trying to send command to a non-existing view " + "with tag " + reactTag));
|
||||
return;
|
||||
throw new IllegalViewOperationException(
|
||||
"Trying to send command to a non-existing view with tag ["
|
||||
+ reactTag
|
||||
+ "] and command "
|
||||
+ commandId);
|
||||
}
|
||||
|
||||
ViewManager viewManager = resolveViewManager(reactTag);
|
||||
viewManager.receiveCommand(view, commandId, args);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user