mirror of
https://github.com/status-im/react-native-camera.git
synced 2026-08-30 21:21:06 +00:00
Removed left over import. Updated Android stuff.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.lwansbrough.RCTCamera">
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.lwansbrough.ReactCamera">
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-feature android:name="android.hardware.camera" />
|
||||
<uses-feature android:name="android.hardware.camera.autofocus" />
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
var { requireNativeComponent } = require('react-native');
|
||||
|
||||
var iface = {
|
||||
name: 'ImageView',
|
||||
propTypes: {
|
||||
src: PropTypes.string,
|
||||
borderRadius: PropTypes.number,
|
||||
resizeMode: PropTypes.oneOf(['cover', 'contain', 'stretch']),
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = requireNativeComponent('RCTCamera', iface);
|
||||
@@ -1,6 +1,5 @@
|
||||
var React = require('react-native');
|
||||
var { StyleSheet, requireNativeComponent, PropTypes, NativeModules, DeviceEventEmitter } = React;
|
||||
var merge = require('merge');
|
||||
|
||||
var CAMERA_REF = 'camera';
|
||||
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
"type" : "git",
|
||||
"url" : "https://github.com/lwansbrough/react-native-camera.git"
|
||||
},
|
||||
"version": "0.3.4",
|
||||
"version": "0.3.5",
|
||||
"description": "A Camera component for React Native. Also reads barcodes.",
|
||||
"author": "Lochlan Wansbrough <lochie@live.com> (http://lwansbrough.com)",
|
||||
"nativePackage": true,
|
||||
|
||||
Reference in New Issue
Block a user