forked from react-native-camera/react-native-camera
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(windows): updated for react-native-windows 0.62 (react-native-ca…
…mera#2882) Build: * Updated ReactNativeCameraCPP projects to use the new RNW lib props/targets provided in 0.62 for easier upgrades * Added new ReactNativeCameraCPP solution and readme with instructions for building locally * Added ReactNativeCameraCPP61 solution and project to maintain 0.61 support ReactNativeCameraCPP RNCamera component: * Added properties: defaultVideoQuality, mirrorVideo, autoFocus, whiteBalance, cameraId * Removed deprecated properties: torchMode * Expanded Type constant (front/back) to include other Windows types (Unknown, Top, Bottom, Left, Right) ReactNativeCamperaCPP RNCamera module: * Cleaned up async error handling: * Uncaught exceptions no longer crash the app, instead returning the error via the promise reject as expected * Passed in options and promises are now properly captured so as to not get deleted before async operations are completed * Fixed issue when passed in option values are doubles instead of integers * Moved all possible processing off of the UI thread * Fixed device enumeration by id/type to support non-integrated cameras * Piped out CaptureTarget constants for "target" option (memory, disk, cameraRoll, temp) * Added BarCodeType constant stubs * Added FaceDetection constants stubs * Added VideoCodec constants for "codec" option (H264, HEVC, WMV) * takePicture: * Added options: target, quality, doNotSave, base64, width, mirrorImage, exif, writeExif * Added result properties: width, height, base64, exif * Fixed issue where EXIF data was being stripped from photos * record: * Added options: target, mute, quality, maxDuration, videoBitrate, codec * Added result properties: codec * stopRecording: Added implementation * isRecording: Added implementation * pausePreview: Added implementation * resumePreview: Added implementation * getCameraIds: Added implementation
- Loading branch information
1 parent
d62da5f
commit 93e6581
Showing
27 changed files
with
2,884 additions
and
1,438 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
--- | ||
AccessModifierOffset: -1 | ||
AlignAfterOpenBracket: AlwaysBreak | ||
AlignConsecutiveAssignments: false | ||
AlignConsecutiveDeclarations: false | ||
AlignEscapedNewlinesLeft: true | ||
AlignOperands: false | ||
AlignTrailingComments: false | ||
AllowAllParametersOfDeclarationOnNextLine: false | ||
AllowShortBlocksOnASingleLine: false | ||
AllowShortCaseLabelsOnASingleLine: false | ||
AllowShortFunctionsOnASingleLine: Empty | ||
AllowShortIfStatementsOnASingleLine: false | ||
AllowShortLoopsOnASingleLine: false | ||
AlwaysBreakAfterReturnType: None | ||
AlwaysBreakBeforeMultilineStrings: true | ||
AlwaysBreakTemplateDeclarations: true | ||
BinPackArguments: false | ||
BinPackParameters: false | ||
BraceWrapping: | ||
AfterClass: false | ||
AfterControlStatement: false | ||
AfterEnum: false | ||
AfterFunction: false | ||
AfterNamespace: false | ||
AfterObjCDeclaration: false | ||
AfterStruct: false | ||
AfterUnion: false | ||
BeforeCatch: false | ||
BeforeElse: false | ||
IndentBraces: false | ||
BreakBeforeBinaryOperators: None | ||
BreakBeforeBraces: Attach | ||
BreakBeforeTernaryOperators: true | ||
BreakConstructorInitializersBeforeComma: false | ||
BreakAfterJavaFieldAnnotations: false | ||
BreakStringLiterals: false | ||
ColumnLimit: 120 | ||
CommentPragmas: '^ IWYU pragma:' | ||
ConstructorInitializerAllOnOneLineOrOnePerLine: true | ||
ConstructorInitializerIndentWidth: 4 | ||
ContinuationIndentWidth: 4 | ||
Cpp11BracedListStyle: true | ||
DerivePointerAlignment: false | ||
DisableFormat: false | ||
ForEachMacros: [ FOR_EACH_RANGE, FOR_EACH, ] | ||
IncludeBlocks: Preserve | ||
IncludeCategories: | ||
- Regex: 'pch.h' | ||
Priority: -1 | ||
- Regex: '.*\.g\..*' | ||
Priority: 1 | ||
- Regex: '^<.*\.h(pp)?>' | ||
Priority: 2 | ||
- Regex: '^<.*' | ||
Priority: 3 | ||
- Regex: '.*' | ||
Priority: 4 | ||
IndentCaseLabels: true | ||
IndentWidth: 2 | ||
IndentWrappedFunctionNames: false | ||
KeepEmptyLinesAtTheStartOfBlocks: false | ||
MacroBlockBegin: '' | ||
MacroBlockEnd: '' | ||
MaxEmptyLinesToKeep: 1 | ||
NamespaceIndentation: None | ||
ObjCBlockIndentWidth: 2 | ||
ObjCSpaceAfterProperty: true | ||
ObjCSpaceBeforeProtocolList: true | ||
PenaltyBreakBeforeFirstCallParameter: 1 | ||
PenaltyBreakComment: 300 | ||
PenaltyBreakFirstLessLess: 120 | ||
PenaltyBreakString: 1000 | ||
PenaltyExcessCharacter: 1000000 | ||
PenaltyReturnTypeOnItsOwnLine: 200 | ||
PointerAlignment: Right | ||
ReflowComments: true | ||
SortIncludes: true | ||
SpaceAfterCStyleCast: false | ||
SpaceBeforeAssignmentOperators: true | ||
SpaceBeforeParens: ControlStatements | ||
SpaceInEmptyParentheses: false | ||
SpacesBeforeTrailingComments: 1 | ||
SpacesInAngles: false | ||
SpacesInContainerLiterals: true | ||
SpacesInCStyleCastParentheses: false | ||
SpacesInParentheses: false | ||
SpacesInSquareBrackets: false | ||
Standard: Cpp11 | ||
TabWidth: 8 | ||
UseTab: Never | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# React Native Camera (Windows) | ||
|
||
React Native Camera is currently maintained for React Native Windows (RNW) >= 0.61. | ||
|
||
There are two implementations of `react-native-camera` in this folder: | ||
|
||
1. _ReactNativeCameraCPP_ is the currently maintained implementation: | ||
1. Use _ReactNativeCameraCPP_ for RNW >= 0.62. | ||
2. Use _ReactNativeCameraCPP61_ for RNW 0.61. | ||
2. _RNCamera_ is a legacy implementation for `[email protected]`. It is no longer maintained. | ||
|
||
## Why all the different versions? | ||
|
||
RNW was originally implemented in C#, where development stopped at version 0.59. _RNCamera_ is the version of React Native Camera written in C# against that (now "legacy") RNW. | ||
|
||
RNW was then rebuilt from scratch in C++, and version 0.61 was the first release to support native community modules. _ReactNativeCameraCPP_ is the version of React Native Camera written in C++ against the current RNW. | ||
|
||
RNW 0.62 brought a variety of build improvements, but now requires both Visual Studio 2019 and a newer Windows SDK. So while the native module APIs are 99% forward-compatible, it's currently necessary to maintain a separate `ReactNativeCameraCPP61.vcxproj` project for RNW 0.61 users. The `ReactNativeCameraCPP.vcxproj` project targets RNW >= 0.62 users. | ||
|
||
# Local Development Setup (RNW >= 0.62) | ||
|
||
In order to work on _ReactNativeCameraCPP_, you'll need to install the [Windows Development Dependencies](https://microsoft.github.io/react-native-windows/docs/rnw-dependencies). | ||
|
||
In addition, `react-native-camera` targets React Native 0.59 and doesn't include React Native Windows as a dependency. So in order to build _ReactNativeCameraCPP_ locally you'll need to temporarily upgrade the development dependencies: | ||
|
||
``` | ||
yarn upgrade react-native@^0.62.2 | ||
yarn add react-native-windows@^0.62.0 --dev | ||
``` | ||
|
||
Now you should be able to open `ReactNativeCameraCPP.sln` in Visual Studio and build the project. | ||
|
||
> _Note:_ In order to test your code changes don't break RNW 0.61, you'll want to do the above steps but targeting RN/RNW 0.61, and using `ReactNativeCameraCPP61.sln`. |
Oops, something went wrong.