Browse files

Fix Android startup exception

This is an attempt to fix the following startup exception that I get when running any of the example apps:

> Unrecognized type: interface com.facebook.react.bridge.Dynamic for method: com.facebook.react.uimanager.LayoutShadowNode#setFlexBasis

I really have no idea what I'm doing here, just trying to get UIExplorer to compile and run so I can test my upcoming PRs. ~~Unfortunately, this doesn't actually make the apps run, but at least it does get rid of the startup exception!~~ Edit: it works now.

**Test plan:** Run Movies and UIExplorer example app
Closes #11896

Differential Revision: D4418927

Pulled By: mkonicek

fbshipit-source-id: 34788b790b6bfc46ff39a0d9ca1698a5c20662e1
  • Loading branch information...
philikon authored and facebook-github-bot committed Jan 14, 2017
1 parent c7e3819 commit 237ee2ddf61b0e986a44cae8a3398071501b7d47
@@ -12,6 +12,7 @@
import android.view.View;
import com.facebook.common.logging.FLog;
import com.facebook.react.bridge.Dynamic;
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
@@ -114,6 +115,22 @@ public void updateShadowNodeProp(
protected abstract @Nullable Object extractProperty(ReactStylesDiffMap props);
private static class DynamicPropSetter extends PropSetter {
public DynamicPropSetter(ReactProp prop, Method setter) {
super(prop, "mixed", setter);
public DynamicPropSetter(ReactPropGroup prop, Method setter, int index) {
super(prop, "mixed", setter, index);
protected Object extractProperty(ReactStylesDiffMap props) {
return props.getDynamic(mPropName);
private static class IntPropSetter extends PropSetter {
private final int mDefaultValue;
@@ -331,7 +348,9 @@ private static PropSetter createPropSetter(
ReactProp annotation,
Method method,
Class<?> propTypeClass) {
if (propTypeClass == boolean.class) {
if (propTypeClass == Dynamic.class) {
return new DynamicPropSetter(annotation, method);
} else if (propTypeClass == boolean.class) {
return new BooleanPropSetter(annotation, method, annotation.defaultBoolean());
} else if (propTypeClass == int.class) {
return new IntPropSetter(annotation, method, annotation.defaultInt());
@@ -361,7 +380,13 @@ private static void createPropSetters(
Class<?> propTypeClass,
Map<String, PropSetter> props) {
String[] names = annotation.names();
if (propTypeClass == int.class) {
if (propTypeClass == Dynamic.class) {
for (int i = 0; i < names.length; i++) {
new DynamicPropSetter(annotation, method, i));
} else if (propTypeClass == int.class) {
for (int i = 0; i < names.length; i++) {

0 comments on commit 237ee2d

Please sign in to comment.