diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..8bafed6 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,45 @@ +{ + "env": { + "browser": true, + "node": true, + "jest": true, + "es6": true + }, + "parser": "babel-eslint", + "parserOptions": { + "ecmaVersion": 6, + "sourceType": "module", + "ecmaFeatures": { + "modules": true + } + }, + "plugins": [ + "react", + "react-native", + ], + "extends": [ + "eslint:recommended", + "plugin:react/recommended", + ], + "rules": { + "comma-dangle": [2, "always-multiline"], + "quotes": [2, "single", { "allowTemplateLiterals": true }], + "react/prop-types": 0, + "react/jsx-no-bind": 0, + "react/display-name": 0, + "new-cap": 0, + "react-native/no-unused-styles": 2, + "react-native/no-inline-styles": 1, + "react-native/no-color-literals": 0, + "no-class-assign": 1, + "no-console": 1, + "object-curly-spacing": [1, "always"], + "no-unused-vars": ["error", { "ignoreRestSiblings": true }] + }, + "globals": { + "__DEV__": true, + "device": true, + "element": true, + "by": true, + } +} diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..ece6752 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Disable git large files for now! +# RNCameraExample/ios/Frameworks/FaceDetector/Frameworks/frameworks/FaceDetector.framework/FaceDetector filter=lfs diff=lfs merge=lfs -text diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 8f92998..742de16 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1 +1,27 @@ - \ No newline at end of file +### Warning +RCTCamera is **DEPRECATED** on v1.0.0 follow our migration guide here https://github.com/react-native-community/react-native-camera/blob/master/docs/migration.md + +### Which implementation are you using + +*RNCamera* or RCTCamera (RCTCamera will be removed on v2.0.0)? + +### Steps to reproduce +1. +2. +3. + +### Expected behaviour +Tell us what should happen + +### Actual behaviour +Tell us what happens instead + +### Environment +- **Node.js version**: +- **React Native version**: +- **React Native platform + platform version**: iOS 9.0, Android 5.0, etc + +### react-native-camera +**Version**: npm version or "master" + +> Love react-native-camera? Please consider supporting our collective: 👉 https://opencollective.com/react-native-camera/donate diff --git a/.npmignore b/.npmignore index f2bb551..634b669 100644 --- a/.npmignore +++ b/.npmignore @@ -1,2 +1,3 @@ /Example issue_template.md +/RNCameraExample diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..85af011 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,10 @@ +### master + +### 1.0.0 +- RNCamera as main camera implementation for both iOS and Android (base on expo module) +- FaceDetector feature for both iOS and Android (based on expo module) +- RCTCamera deprecated + +### 0.13.0 +- added RNCamera implementation for android +- added FaceDetector for android diff --git a/Example/.babelrc b/Example/.babelrc index 8df53fe..a9ce136 100644 --- a/Example/.babelrc +++ b/Example/.babelrc @@ -1,3 +1,3 @@ { -"presets": ["react-native"] -} \ No newline at end of file + "presets": ["react-native"] +} diff --git a/Example/.flowconfig b/Example/.flowconfig index 876e701..2f13324 100644 --- a/Example/.flowconfig +++ b/Example/.flowconfig @@ -12,19 +12,20 @@ ; For RN Apps installed via npm, "Libraries" folder is inside ; "node_modules/react-native" but in the source repo it is in the root .*/Libraries/react-native/React.js -.*/Libraries/react-native/ReactNative.js + +; Ignore polyfills +.*/Libraries/polyfills/.* [include] [libs] node_modules/react-native/Libraries/react-native/react-native-interface.js -node_modules/react-native/flow -flow/ +node_modules/react-native/flow/ [options] -module.system=haste +emoji=true -experimental.strict_type_args=true +module.system=haste munge_underscores=true @@ -32,13 +33,16 @@ module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|we suppress_type=$FlowIssue suppress_type=$FlowFixMe +suppress_type=$FlowFixMeProps +suppress_type=$FlowFixMeState suppress_type=$FixMe -suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-6]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) -suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-6]\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ +suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(5[0-7]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) +suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(5[0-7]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy +suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError unsafe.enable_getters_and_setters=true [version] -^0.36.0 +^0.57.0 diff --git a/Example/.gitignore b/Example/.gitignore index fc13f16..0826423 100644 --- a/Example/.gitignore +++ b/Example/.gitignore @@ -34,11 +34,11 @@ local.properties # node_modules/ npm-debug.log +yarn-error.log # BUCK buck-out/ \.buckd/ -android/app/libs *.keystore # fastlane @@ -46,8 +46,8 @@ android/app/libs # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the # screenshots whenever they are needed. # For more information about the recommended setup visit: -# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md +# https://docs.fastlane.tools/best-practices/source-control/ -fastlane/report.xml -fastlane/Preview.html -fastlane/screenshots +*/fastlane/report.xml +*/fastlane/Preview.html +*/fastlane/screenshots diff --git a/Example/Example.js b/Example/Example.js index 88820de..9ff7a7f 100644 --- a/Example/Example.js +++ b/Example/Example.js @@ -1,11 +1,5 @@ import React from 'react'; -import { - Image, - StatusBar, - StyleSheet, - TouchableOpacity, - View, -} from 'react-native'; +import { Image, StatusBar, StyleSheet, TouchableOpacity, View } from 'react-native'; import Camera from 'react-native-camera'; const styles = StyleSheet.create({ @@ -15,7 +9,7 @@ const styles = StyleSheet.create({ preview: { flex: 1, justifyContent: 'flex-end', - alignItems: 'center', + alignItems: 'center' }, overlay: { position: 'absolute', @@ -68,37 +62,39 @@ export default class Example extends React.Component { orientation: Camera.constants.Orientation.auto, flashMode: Camera.constants.FlashMode.auto, }, - isRecording: false + isRecording: false, }; } takePicture = () => { if (this.camera) { - this.camera.capture() - .then((data) => console.log(data)) + this.camera + .capture() + .then(data => console.log(data)) .catch(err => console.error(err)); } - } + }; startRecording = () => { if (this.camera) { - this.camera.capture({mode: Camera.constants.CaptureMode.video}) - .then((data) => console.log(data)) - .catch(err => console.error(err)); + this.camera + .capture({ mode: Camera.constants.CaptureMode.video }) + .then(data => console.log(data)) + .catch(err => console.error(err)); this.setState({ - isRecording: true + isRecording: true, }); } - } + }; stopRecording = () => { if (this.camera) { this.camera.stopCapture(); this.setState({ - isRecording: false + isRecording: false, }); } - } + }; switchType = () => { let newType; @@ -116,7 +112,7 @@ export default class Example extends React.Component { type: newType, }, }); - } + }; get typeIcon() { let icon; @@ -149,7 +145,7 @@ export default class Example extends React.Component { flashMode: newFlashMode, }, }); - } + }; get flashIcon() { let icon; @@ -169,12 +165,9 @@ export default class Example extends React.Component { render() { return ( -