Closed
Description
I try to bridge GLSurfaceView to React Native on Android.
This is ViewManager subclass
GLSurfaceViewManager.java
package com.oney.kk;
import android.os.SystemClock;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CompoundButton;
import android.opengl.GLSurfaceView;
import com.facebook.csslayout.CSSNode;
import com.facebook.csslayout.MeasureOutput;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.uimanager.*;
import android.util.Log;
public class GLSurfaceViewManager extends SimpleViewManager<GLSurfaceView> {
private final static String TAG = GLSurfaceViewManager.class.getCanonicalName();
public static final String REACT_CLASS = "GLSurfaceView";
@Override
public String getName() {
return REACT_CLASS;
}
@UIProp(UIProp.Type.NUMBER)
public static final String PROP_SRC = "src";
@Override
public GLSurfaceView createViewInstance(ThemedReactContext context) {
Log.d(TAG, "create!"); // Never call
GLSurfaceView view = new GLSurfaceView(context);
return view;
}
@Override
public void updateView(final GLSurfaceView view, final CatalystStylesDiffMap props) {
super.updateView(view, props);
if (props.hasKey(PROP_SRC)) {
// do something...
}
}
}
GLSurfaceView.js
'use strict';
var React = require('react-native');
var { requireNativeComponent } = React;
var theView = {
name: 'GLSurfaceView',
propTypes: {
src: React.PropTypes.number,
},
};
var GLSurfaceView = requireNativeComponent('GLSurfaceView', theView);
module.exports = GLSurfaceView;
And I get "GLSurfaceView" has no propType for native prop "GLSurfaceView.scaleX" of native type number