Flow type AndroidSwitch and generate Android OSS classes

Summary: This diff adds Flow types to `AndroidSwitchNativeComponent`.

Reviewed By: TheSavior

Differential Revision: D17205083

fbshipit-source-id: 3d11f11e269388b78a5f0ed528be94df04f9719d
This commit is contained in:
Oleksandr Melnykov
2019-09-23 07:15:16 -07:00
committed by Facebook Github Bot
parent bf89d1d536
commit 23557d1f9a
4 changed files with 104 additions and 23 deletions
@@ -0,0 +1,56 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated by codegen project: GeneratePropsJavaDelegate.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.BaseViewManagerInterface;
import com.facebook.react.uimanager.LayoutShadowNode;
public class AndroidSwitchManagerDelegate<T extends View, U extends BaseViewManagerInterface<T> & AndroidSwitchManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public AndroidSwitchManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case "disabled":
mViewManager.setDisabled(view, value == null ? false : (boolean) value);
break;
case "enabled":
mViewManager.setEnabled(view, value == null ? false : (boolean) value);
break;
case "thumbColor":
mViewManager.setThumbColor(view, value == null ? null : ((Double) value).intValue());
break;
case "trackColorForFalse":
mViewManager.setTrackColorForFalse(view, value == null ? null : ((Double) value).intValue());
break;
case "trackColorForTrue":
mViewManager.setTrackColorForTrue(view, value == null ? null : ((Double) value).intValue());
break;
case "value":
mViewManager.setValue(view, value == null ? false : (boolean) value);
break;
case "on":
mViewManager.setOn(view, value == null ? false : (boolean) value);
break;
case "thumbTintColor":
mViewManager.setThumbTintColor(view, value == null ? null : ((Double) value).intValue());
break;
case "trackTintColor":
mViewManager.setTrackTintColor(view, value == null ? null : ((Double) value).intValue());
break;
default:
super.setProperty(view, propName, value);
}
}
}