mirror of
https://github.com/status-im/react-native-camera.git
synced 2026-08-31 13:41:08 +00:00
Removed left over import. Updated Android stuff.
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
package com.lwansbrough.RCTCamera;
|
||||
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.bridge.Callback;
|
||||
|
||||
/**
|
||||
* {@link NativeModule}
|
||||
*/
|
||||
|
||||
public class RCTCameraModule extends ReactContextBaseJavaModule {
|
||||
|
||||
ReactApplicationContext reactContext;
|
||||
|
||||
public RCTCameraModule(ReactApplicationContext reactContext) {
|
||||
super(reactContext);
|
||||
this.reactContext = reactContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "RCTCamera";
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void test(ReadableMap options, Callback callback) {
|
||||
callback.invoke(null, "test");
|
||||
}
|
||||
}
|
||||
+4
-16
@@ -11,25 +11,13 @@ import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.uimanager.ViewManager;
|
||||
import com.facebook.react.bridge.JavaScriptModule;
|
||||
|
||||
public class RCTCamera implements ReactPackage {
|
||||
|
||||
@Override
|
||||
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
|
||||
List<NativeModule> modules = new ArrayList<>();
|
||||
|
||||
modules.add(new RCTCamera(reactContext));
|
||||
|
||||
return modules;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Class<? extends JavaScriptModule>> createJSModules() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
public class ReactCamera implements ReactPackage {
|
||||
|
||||
@Override
|
||||
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
|
||||
return Collections.emptyList();
|
||||
return Arrays.<ViewManager>asList(
|
||||
new ReactCameraManager()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.lwansbrough.RCTCamera;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.facebook.react.ReactPackage;
|
||||
import com.facebook.react.bridge.NativeModule;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.uimanager.ViewManager;
|
||||
import com.facebook.react.bridge.JavaScriptModule;
|
||||
|
||||
public class ReactCameraManager extends SimpleViewManager<ReactCameraView> {
|
||||
|
||||
public static final String REACT_CLASS = "RCTCamera";
|
||||
|
||||
@UIProp(UIProp.Type.STRING)
|
||||
public static final String PROP_SRC = "src";
|
||||
@UIProp(UIProp.Type.NUMBER)
|
||||
public static final String PROP_BORDER_RADIUS = "borderRadius";
|
||||
@UIProp(UIProp.Type.STRING)
|
||||
public static final String PROP_RESIZE_MODE = ViewProps.RESIZE_MODE;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return REACT_CLASS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReactCameraView createViewInstance(ThemedReactContext context) {
|
||||
return new ReactCameraView(context, Fresco.newDraweeControllerBuilder(), mCallerContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateView(final ReactImageView view, final CatalystStylesDiffMap props) {
|
||||
super.updateView(view, props);
|
||||
|
||||
if (props.hasKey(PROP_RESIZE_MODE)) {
|
||||
view.setScaleType(
|
||||
ImageResizeMode.toScaleType(props.getString(PROP_RESIZE_MODE)));
|
||||
}
|
||||
if (props.hasKey(PROP_SRC)) {
|
||||
view.setSource(props.getString(PROP_SRC));
|
||||
}
|
||||
if (props.hasKey(PROP_BORDER_RADIUS)) {
|
||||
view.setBorderRadius(props.getFloat(PROP_BORDER_RADIUS, 0.0f));
|
||||
}
|
||||
view.maybeUpdateView();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user