teslamotors / react-native-camera-kit

A high performance, easy to use, rock solid camera library for React Native apps.
MIT License
2.45k stars 581 forks source link

Pass Component as icons. #358

Open codakkk opened 3 years ago

codakkk commented 3 years ago

https://github.com/teslamotors/react-native-camera-kit/blob/feacdfb0bfb4e94abfa795719dac24152214b92d/src/CameraScreen.tsx#L135

RN-Camera-Kit should let the developer pass a Component over a string for icons. This is useful when using libraries like react-native-vector-icons. Example:

<CameraScreen 
      .....
      torchOffImage={<MaterialCommunityIcons name="torch" />}
/>

EDIT: I'm actually working on a PR for this request :)

codakkk commented 3 years ago

@aarongrider Hi Aaron, I'm actually having some problems after cloning the repository (probably something missing).

1) On each react-native import, I get this error: Parse errors in imported module 'react-native': ';' expected. (13:32)eslintimport/namespace Parse errors in imported module 'react-native': ';' expected. (13:32)eslintimport/named

2) Also, foreach

import Camera from './Camera'; 

I'm getting this: Cannot find module './Camera' or its corresponding type declarations.

The first one seems a problem relative to eslint, just found out that removing 'import/named': 'error' and 'import/namespace': 'error' from .eslintrc.js solves the problem (Is there a different way? Am I missing something?)

The second error seems something about platform-specific extensions, as if TypeScript cannot understand what is going on. I'm using TypeScript 4.1.2.

What am I missing?

aarongrider commented 3 years ago

Hey @codakkk, are you trying to run the example project or are you adding camera-kit to your existing project?

You will want to either:

We haven't published the latest in master to npm yet. We will be publishing a v11 release in the next few weeks once we have have had sufficient time to finish testing.

codakkk commented 3 years ago

Hey @codakkk, are you trying to run the example project or are you adding camera-kit to your existing project?

You will want to either:

  • clone this project if you are running the example
  • manually add camera-kit from GitHub "react-native-camera-kit": "git+https://github.com/teslamotors/react-native-camera-kit.git"

We haven't published the latest in master to npm yet. We will be publishing a v11 release in the next few weeks once we have have had sufficient time to finish testing.

The example is working right now. I'm trying to add the feature described in the issue, the fact is there are those errors I can't get over.

aarongrider commented 3 years ago

Change your package.json try changing from "react-native-camera-kit": 10.0.0 -> "react-native-camera-kit": "git+https://github.com/teslamotors/react-native-camera-kit.git"

codakkk commented 3 years ago

Change your package.json try changing from "react-native-camera-kit": 10.0.0 -> "react-native-camera-kit": "git+https://github.com/teslamotors/react-native-camera-kit.git"

Some misunderstanding happening here 😄 I actually want to implemente the feature described in the issue, placing components over just texts on Icons. The fact is, when I clone the repository, the errors I wrote in my past replies happens.

codakkk commented 3 years ago

I pushed a PR (#378) for this Issue