Use commands from JS in RefreshControl instead of setNativeProps

Summary: Changelog: [Internal] RefreshControl uses commands instead of setNativeProps

Reviewed By: TheSavior

Differential Revision: D18475794

fbshipit-source-id: fbfe3fcfa465c821d673bf9a9666c989ba4f9545
This commit is contained in:
Samuel Susla
2019-12-23 11:58:49 -08:00
committed by Facebook Github Bot
parent 2237ea6d2e
commit 9c27ccd7d0
4 changed files with 22 additions and 77 deletions
@@ -1,50 +0,0 @@
/**
* 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.bridge.ReadableArray;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.BaseViewManagerInterface;
import com.facebook.react.uimanager.LayoutShadowNode;
public class PullToRefreshViewManagerDelegate<T extends View, U extends BaseViewManagerInterface<T> & PullToRefreshViewManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public PullToRefreshViewManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case "tintColor":
mViewManager.setTintColor(view, value == null ? null : ((Double) value).intValue());
break;
case "titleColor":
mViewManager.setTitleColor(view, value == null ? null : ((Double) value).intValue());
break;
case "title":
mViewManager.setTitle(view, value == null ? null : (String) value);
break;
case "refreshing":
mViewManager.setRefreshing(view, value == null ? false : (boolean) value);
break;
default:
super.setProperty(view, propName, value);
}
}
public void receiveCommand(PullToRefreshViewManagerInterface<T> viewManager, T view, String commandName, ReadableArray args) {
switch (commandName) {
case "setNativeRefreshing":
viewManager.setNativeRefreshing(view, args.getBoolean(0));
break;
}
}
}
@@ -1,21 +0,0 @@
/**
* 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: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
public interface PullToRefreshViewManagerInterface<T extends View> {
void setTintColor(T view, @Nullable Integer value);
void setTitleColor(T view, @Nullable Integer value);
void setTitle(T view, @Nullable String value);
void setRefreshing(T view, boolean value);
void setNativeRefreshing(T view, boolean refreshing);
}