From b95e6c90d987397da988d721fc93a53644635f2f Mon Sep 17 00:00:00 2001 From: nicksqy Date: Tue, 8 Sep 2015 21:12:22 +1000 Subject: [PATCH] fix imports and add merge as a dependency --- Camera.ios.js | 36 +++++++++--------------------------- package.json | 8 ++++---- 2 files changed, 13 insertions(+), 31 deletions(-) diff --git a/Camera.ios.js b/Camera.ios.js index 3e6a4e0..015be71 100644 --- a/Camera.ios.js +++ b/Camera.ios.js @@ -1,15 +1,9 @@ -var React = require('React'); -var DeviceEventEmitter = require('RCTDeviceEventEmitter'); -var NativeModules = require('NativeModules'); -var ReactNativeViewAttributes = require('ReactNativeViewAttributes'); -var StyleSheet = require('StyleSheet'); -var createReactNativeComponentClass = require('createReactNativeComponentClass'); -var PropTypes = require('ReactPropTypes'); -var StyleSheetPropType = require('StyleSheetPropType'); -var NativeMethodsMixin = require('NativeMethodsMixin'); -var flattenStyle = require('flattenStyle'); +var React = require('react-native'); +var { StyleSheet, requireNativeComponent, PropTypes, NativeModules, DeviceEventEmitter } = React; var merge = require('merge'); +var CAMERA_REF = 'camera'; + var constants = { Aspect: NativeModules.CameraManager.Aspect, BarCodeType: NativeModules.CameraManager.BarCodeType, @@ -54,11 +48,8 @@ var Camera = React.createClass({ ]) }, - mixins: [NativeMethodsMixin], - - viewConfig: { - uiViewClassName: 'UIView', - validAttributes: ReactNativeViewAttributes.UIView + setNativeProps(props) { + this.refs[CAMERA_REF].setNativeProps(props); }, getDefaultProps() { @@ -98,7 +89,7 @@ var Camera = React.createClass({ }, render() { - var style = flattenStyle([styles.base, this.props.style]); + var style = [styles.base, this.props.style]; var aspect = this.props.aspect, type = this.props.type, @@ -153,7 +144,7 @@ var Camera = React.createClass({ torchMode: torchMode }); - return + return ; }, _onBarCodeRead(e) { @@ -199,16 +190,7 @@ var Camera = React.createClass({ }); -var RCTCamera = createReactNativeComponentClass({ - validAttributes: merge(ReactNativeViewAttributes.UIView, { - aspect: true, - type: true, - orientation: true, - flashMode: true, - torchMode: true - }), - uiViewClassName: 'RCTCamera', -}); +var RCTCamera = requireNativeComponent('RCTCamera', Camera); var styles = StyleSheet.create({ base: { }, diff --git a/package.json b/package.json index ecc4aa9..1d270af 100644 --- a/package.json +++ b/package.json @@ -9,9 +9,6 @@ "main": "Camera.ios.js", "author": "Lochlan Wansbrough (http://lwansbrough.com)", "nativePackage": true, - "peerDependencies": { - "react-native": "*" - }, "keywords": [ "react-native", "react", @@ -20,5 +17,8 @@ "qr", "code", "barcode" - ] + ], + "dependencies": { + "merge": "^1.2.0" + } }