Permalink
Browse files

Kill @UIProp in favor of @ReactProp.

Differential Revision: D2582624

fb-gh-sync-id: b04b4c90ee478d995968cab4364e1ab0964b6ebe
  • Loading branch information...
kmagiera authored and facebook-github-bot-9 committed Oct 26, 2015
1 parent 6a7567e commit 137a0b86113510b52cc931cc32f5b24f400115c1

This file was deleted.

Oops, something went wrong.
@@ -11,8 +11,6 @@
import javax.annotation.Nullable;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;
import android.view.View;
@@ -30,8 +28,6 @@
*/
public abstract class ViewManager<T extends View, C extends ReactShadowNode> {
private static final Map<Class, Map<String, UIProp.Type>> CLASS_PROP_CACHE = new HashMap<>();
public final void updateProperties(T viewToUpdate, CatalystStylesDiffMap props) {
Map<String, ViewManagersPropertyCache.PropSetter> propSetters =
ViewManagersPropertyCache.getNativePropSettersForViewManagerClass(getClass());
@@ -208,42 +204,6 @@ public void receiveCommand(T root, int commandId, @Nullable ReadableArray args)
}
public Map<String, String> getNativeProps() {
// TODO(krzysztof): This method will just delegate to ViewManagersPropertyRegistry once
// refactoring is finished
Class cls = getClass();
Map<String, String> nativeProps =
ViewManagersPropertyCache.getNativePropsForView(cls, getShadowNodeClass());
while (cls.getSuperclass() != null) {
Map<String, UIProp.Type> props = getNativePropsForClass(cls);
for (Map.Entry<String, UIProp.Type> entry : props.entrySet()) {
nativeProps.put(entry.getKey(), entry.getValue().toString());
}
cls = cls.getSuperclass();
}
return nativeProps;
}
private Map<String, UIProp.Type> getNativePropsForClass(Class cls) {
// TODO(krzysztof): Blow up this method once refactoring is finished
Map<String, UIProp.Type> props = CLASS_PROP_CACHE.get(cls);
if (props != null) {
return props;
}
props = new HashMap<>();
for (Field f : cls.getDeclaredFields()) {
UIProp annotation = f.getAnnotation(UIProp.class);
if (annotation != null) {
UIProp.Type type = annotation.value();
try {
String name = (String) f.get(this);
props.put(name, type);
} catch (IllegalAccessException e) {
throw new RuntimeException(
"UIProp " + cls.getName() + "." + f.getName() + " must be public.");
}
}
}
CLASS_PROP_CACHE.put(cls, props);
return props;
return ViewManagersPropertyCache.getNativePropsForView(getClass(), getShadowNodeClass());
}
}
@@ -19,7 +19,6 @@
import com.facebook.react.uimanager.BaseViewManager;
import com.facebook.react.uimanager.ReactProp;
import com.facebook.react.uimanager.ThemedReactContext;
import com.facebook.react.uimanager.UIProp;
/**
* Manages instances of ProgressBar. ProgressBar is wrapped in a FrameLayout because the style of
@@ -19,11 +19,9 @@
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
import com.facebook.react.uimanager.BaseViewManager;
import com.facebook.react.uimanager.CatalystStylesDiffMap;
import com.facebook.react.uimanager.PixelUtil;
import com.facebook.react.uimanager.ReactProp;
import com.facebook.react.uimanager.ThemedReactContext;
import com.facebook.react.uimanager.UIProp;
import com.facebook.react.uimanager.ViewDefaults;
import com.facebook.react.uimanager.ViewProps;
import com.facebook.react.common.annotations.VisibleForTesting;
@@ -35,7 +35,6 @@
import com.facebook.react.uimanager.ReactProp;
import com.facebook.react.uimanager.ThemedReactContext;
import com.facebook.react.uimanager.UIManagerModule;
import com.facebook.react.uimanager.UIProp;
import com.facebook.react.uimanager.ViewDefaults;
import com.facebook.react.uimanager.ViewProps;
import com.facebook.react.uimanager.events.EventDispatcher;

0 comments on commit 137a0b8

Please sign in to comment.