mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-02-07 09:17:55 +08:00
Fix setting js responder for null react view for tag
Reviewed By: kmagiera Differential Revision: D2637015 fb-gh-sync-id: 03af870cee82519ed34a4bbbcbd2c72146fcf00f
This commit is contained in:
committed by
facebook-github-bot-4
parent
d5daef08ef
commit
32c19c1994
@@ -442,13 +442,26 @@ import com.facebook.react.touch.JSResponderHandler;
|
||||
return TouchTargetHelper.findTargetTagForTouch(touchY, touchX, (ViewGroup) view);
|
||||
}
|
||||
|
||||
public void setJSResponder(int reactTag, boolean blockNativeResponder) {
|
||||
public void setJSResponder(int reactTag, int initialReactTag, boolean blockNativeResponder) {
|
||||
if (!blockNativeResponder) {
|
||||
mJSResponderHandler.setJSResponder(initialReactTag, null);
|
||||
return;
|
||||
}
|
||||
|
||||
View view = mTagsToViews.get(reactTag);
|
||||
if (initialReactTag != reactTag && view instanceof ViewParent) {
|
||||
// In this case, initialReactTag corresponds to a virtual/layout-only View, and we already
|
||||
// have a parent of that View in reactTag, so we can use it.
|
||||
mJSResponderHandler.setJSResponder(initialReactTag, (ViewParent) view);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mRootTags.get(reactTag)) {
|
||||
SoftAssertions.assertUnreachable(
|
||||
"Cannot block native responder on " + reactTag + " that is a root view");
|
||||
}
|
||||
ViewParent viewParent = blockNativeResponder ? mTagsToViews.get(reactTag).getParent() : null;
|
||||
mJSResponderHandler.setJSResponder(reactTag, viewParent);
|
||||
mJSResponderHandler
|
||||
.setJSResponder(initialReactTag, view.getParent());
|
||||
}
|
||||
|
||||
public void clearJSResponder() {
|
||||
|
||||
Reference in New Issue
Block a user