-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Closed
Labels
BugPlatform: AndroidAndroid applications.Android applications.Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.
Description
🐛 Bug Report
This bug occurs unpredictably but continuously in Android 8.0. There is #20288 related this bug but it is not perfect solution, So we have still faced this issue.
Since the issue is merged on react-native, dropView method is like below.
protected synchronized void dropView(View view) {
UiThreadUtil.assertOnUiThread();
if (mTagsToViewManagers.get(view.getId()) == null) {
// This view has already been dropped (likely due to a threading issue caused by async js
// execution). Ignore this drop operation.
return;
}
if (!mRootTags.get(view.getId())) {
// For non-root views we notify viewmanager with {@link ViewManager#onDropInstance}
resolveViewManager(view.getId()).onDropViewInstance(view);
}
ViewManager viewManager = mTagsToViewManagers.get(view.getId());
if (view instanceof ViewGroup && viewManager instanceof ViewGroupManager) {
ViewGroup viewGroup = (ViewGroup) view;
ViewGroupManager viewGroupManager = (ViewGroupManager) viewManager;
for (int i = viewGroupManager.getChildCount(viewGroup) - 1; i >= 0; i--) {
View child = viewGroupManager.getChildAt(viewGroup, i);
if (child == null) {
FLog.e(TAG, "Unable to drop null child view");
} else if (mTagsToViews.get(child.getId()) != null) {
dropView(child);
}
}
viewGroupManager.removeAllViews(viewGroup);
}
mTagsToViews.remove(view.getId());
mTagsToViewManagers.remove(view.getId());
}
The parameter, View view is passed on dropView method and it may be sometimes null. So view object can not invoke getId method.
Simply add this codes below in the top of dropView method.
if (view == null) return;
To Reproduce
I have tried to reproduce this bug, but It is difficult to make the circumstance that the bug occurs.
Expected Behavior
The bug do not occur when view is null.
Code Example
Environment
[skip envinfo]
I used this environment but this issue will occur on all versions.
OS: macOS 10.14.4
Node: 8.12.0
Yarn: Not Found
npm: 6.4.1
Watchman: 4.9.0
Xcode: Xcode 10.1 Build version 10B61
Android Studio: 3.2 AI-181.5540.7.32.5014246
react: 16.3.0-alpha.1 => 16.3.0-alpha.1
react-native: 0.55.4 => 0.55.4
Metadata
Metadata
Assignees
Labels
BugPlatform: AndroidAndroid applications.Android applications.Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.
