fix(rn-camera): remove lodash dependency (#1996)

This commit is contained in:
Laurin Quast 2018-12-14 12:13:27 +01:00 committed by GitHub
parent be785be001
commit 5fe55e16ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 8 deletions

View File

@ -9,7 +9,6 @@
"logo": "https://opencollective.com/opencollective/logo.txt"
},
"dependencies": {
"lodash": "^4.17.10",
"prop-types": "^15.6.2"
},
"devDependencies": {
@ -21,7 +20,6 @@
"@semantic-release/github": "^5.2.1",
"@semantic-release/npm": "^5.0.5",
"@semantic-release/release-notes-generator": "^7.1.3",
"@types/lodash": "^4.14.116",
"@types/react": "^16.4.14",
"@types/react-native": "^0.56.18",
"babel-eslint": "^8.2.6",

View File

@ -1,7 +1,6 @@
// @flow
import React from 'react';
import PropTypes from 'prop-types';
import { mapValues } from 'lodash';
import {
findNodeHandle,
Platform,
@ -152,6 +151,14 @@ const CameraManager: Object = NativeModules.RNCameraManager ||
const EventThrottleMs = 500;
const mapValues = (input, mapper) => {
const result = {};
Object.entries(input).map(([key, value]) => {
result[key] = mapper(value, key);
});
return result;
};
export default class Camera extends React.Component<PropsType, StateType> {
static Constants = {
Type: CameraManager.Type,
@ -461,7 +468,7 @@ export default class Camera extends React.Component<PropsType, StateType> {
}
}
_convertNativeProps(props: PropsType) {
_convertNativeProps({ children, ...props }: PropsType) {
const newProps = mapValues(props, this._convertProp);
if (props.onBarCodeRead) {

View File

@ -845,10 +845,6 @@
into-stream "^4.0.0"
lodash "^4.17.4"
"@types/lodash@^4.14.116":
version "4.14.116"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.116.tgz#5ccf215653e3e8c786a58390751033a9adca0eb9"
"@types/prop-types@*":
version "15.5.5"
resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.5.5.tgz#17038dd322c2325f5da650a94d5f9974943625e3"