Java 类com.facebook.react.uimanager.RootView 实例源码

项目:react-native-event-bridge    文件:MSREventBridgeModule.java   
/**
 * Returns the descendant of the given view which is the root of the React Native views
 */
@Nullable
private View findRootView(ViewGroup parent) {
  for (int i = 0; i < parent.getChildCount(); i++) {
    View child = parent.getChildAt(i);
    if (child instanceof RootView) {
      return child;
    } else if (child instanceof ViewGroup) {
      child = findRootView((ViewGroup) child);
      if (child != null) {
        return child;
      }
    }
  }
  return null;
}