class WXListComponent extends BasicListComponent<BounceRecyclerView> {

  @Override
  public void addChild(final WXComponent child, int index) {
    super.addChild(child, index);
    if (child == null || index < -1) {
      return;
    }

    if (child instanceof WXRefresh && getHostView() != null) {
        getHostView().setOnRefreshListener((WXRefresh) child);
        getHostView().postDelayed(WXThread.secure(new Runnable() {
        @Override
        public void run() {
          getHostView().setHeaderView(child);
        }
      }), 100);
    }

    if (child instanceof WXLoading && getHostView() != null) {
        getHostView().setOnLoadingListener((WXLoading) child);
        getHostView().postDelayed(WXThread.secure(new Runnable() {
        @Override
        public void run() {
          getHostView().setFooterView(child);
        }
      }), 100);
    }

    // Synchronize DomObject's attr to Component and Native View
    if(mRecyclerDom != null && getHostView() != null && (mColumnWidth != mRecyclerDom.getColumnWidth() ||
            mColumnCount != mRecyclerDom.getColumnCount() ||
            mColumnGap != mRecyclerDom.getColumnGap())) {
      updateRecyclerAttr();
      getHostView().getInnerView().initView(getContext(), mLayoutType,mColumnCount,mColumnGap,getOrientation());
    }
  }

}

class WXListComponentTest {

   WXListComponent component;

  @Test
  public void testAddChild() throws Exception {

    WXComponent child = WXDivTest.create(component);
    ComponentTest.create(child);
    component.addChild(child);

    child = WXHeaderTest.create(component);
    ComponentTest.create(child);
    component.addChild(child);

  }

}