mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
2d80a248cd
Summary: Changelog: [Internal] Introduce native command `setNativeRefreshing`, it has the word Native in order to avoid name conflict with setRefreshing in Android implementation. Even this component is iOS only, it would make it easier to merge them in the future. Introduce `RCTRefreshableProtocol` and make `RCTRefreshControl` and `RCTPullToRefreshViewComponentView` to conform to the protocol so view manager can forward command to both, Paper and Fabric component. Reviewed By: mmmulani Differential Revision: D18475804 fbshipit-source-id: 4c19225784efc931b7b8f2d2671cc839bce429bf
51 lines
1.8 KiB
Java
51 lines
1.8 KiB
Java
/**
|
|
* 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;
|
|
}
|
|
}
|
|
}
|