Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve type definition & README #545

Merged
merged 2 commits into from
Jun 12, 2023

Conversation

DavidBertet
Copy link
Contributor

@DavidBertet DavidBertet commented Jun 2, 2023

Summary

Update type definition to really reflect what the package is capable of and benefit from TypeScript autocompletion and warnings

Update documentation accordingly, add missing parameters, change it slightly so it reflects the actual feature set

It completes the fix for this issue #524
It does fix that issue #498, by using cameraType

It is mainly cosmetic changes to add types and fix TypeScript warnings. Though, there is a few other related changes

  • forward Camera props through <CameraScreen/>. like setting cameraType end up setting cameraType of the <Camera />
  • remove dead code like surfaceColor, rightButtonText (which means allowCaptureRetake is broken, but that's another subject)
  • get rid of some lodash functions
  • actually use this.props.cameraFlipImageStyle as a style
  • add flashImageStyle instead of re-using torchImageStyle for flash state button, which is a different button on screen
  • check this.props.torchOnImage && this.props.torchOffImage or this.state.flashData?.image are defined before to show the buttons

How did you test this change?

As is, it's hard to test. It has been tested on top of #544 with the example app on real devices for both platforms.

All buttons work as expected. There is no more warnings from TypeScript

@DavidBertet DavidBertet force-pushed the task/improve_type_definition branch from da1558a to d757f4f Compare June 2, 2023 09:03
@DavidBertet DavidBertet force-pushed the task/improve_type_definition branch from d757f4f to 05c8f18 Compare June 2, 2023 09:09
@scarlac scarlac merged commit 8e7b1da into teslamotors:master Jun 12, 2023
@scarlac
Copy link
Collaborator

scarlac commented Jun 12, 2023

Thank you!
Just so you don't get disappointed, we are planning on removing the CameraScreen component in the future, as it's not really possible to make a predefined capture experience that fits everyone well.

@DavidBertet
Copy link
Contributor Author

Thank you! Just so you don't get disappointed, we are planning on removing the CameraScreen component in the future, as it's not really possible to make a predefined capture experience that fits everyone well.

Makes sense, could be shared as a sample in the example project

@DavidBertet DavidBertet deleted the task/improve_type_definition branch June 28, 2023 04:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants