class WXSwitch extends WXComponent<WXSwitchView> {

  @Override
  public void addEvent(String type) {
    super.addEvent(type);
    if (type != null && type.equals(Constants.Event.CHANGE) && getHostView() != null) {
      if (mListener == null) {
        mListener = new CompoundButton.OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            Map<String, Object> params = new HashMap<>(2);
            params.put("value", isChecked);

            Map<String, Object> domChanges = new HashMap<>();
            Map<String, Object> attrsChanges = new HashMap<>();
            attrsChanges.put("checked",Boolean.toString(isChecked));
            domChanges.put("attrs",attrsChanges);
            fireEvent(Constants.Event.CHANGE, params,domChanges);
          }
        };
      }
      getHostView().setOnCheckedChangeListener(mListener);
    }
  }

  @Deprecated public  WXSwitch(WXSDKInstance instance, WXVContainer parent, String instanceId, boolean isLazy, BasicComponentData basicComponentData);
  public  WXSwitch(final WXSDKInstance instance, WXVContainer parent, boolean isLazy, BasicComponentData basicComponentData);

}