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

Is there any way to set the zoom value? #568

Closed
chermie opened this Issue Jan 26, 2017 · 6 comments

Comments

Projects
None yet
3 participants
@chermie

chermie commented Jan 26, 2017

Hi,

I need to create a zoom slider, is there any method to set the zoom value or bring the native zoom slider to the camera viewfinder?

Many thanks in advance,
Pete.r

@Marthyn

This comment has been minimized.

Marthyn commented Feb 9, 2017

I would also like to do this.

EDIT:

On this line: https://github.com/lwansbrough/react-native-camera/blob/master/ios/RCTCamera.m#L178
I see that the zoom is influenced by pinch level, there could be a method setting the zoom level manually i think. Currently do not have enough objective C knowledge to fix this. But i would like to learn 😄

@chermie

This comment has been minimized.

chermie commented Feb 9, 2017

hi @Marthyn, I have added that functionality, please have a look here: sps-property@d55113f

@Marthyn

This comment has been minimized.

Marthyn commented Feb 9, 2017

@peterchermie That's awesome! So then you just call the method setZoom on the camera? Like:

zoomBySlider = (zoomLevel:number) => {
    if (this.camera) {
      this.camera.setZoom(zoomLevel);
    }

And do you also know what zoomlevels there are available?

@chermie

This comment has been minimized.

chermie commented Feb 9, 2017

@Marthyn yup, you just call this.camera.setZoom(zoomLevel)

zoomLevel can be anything from 1 to 16.

I use it with the slider, like this:
<Slider value={0} minimumValue={1} maximumValue={16} onValueChange={value => this.camera.setZoom(value)} />

I hope that helps 😄

@Marthyn

This comment has been minimized.

Marthyn commented Feb 9, 2017

You made my day @peterchermie 👍

@sibelius

This comment has been minimized.

Member

sibelius commented Jan 23, 2018

fixed on master

@sibelius sibelius closed this Jan 23, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment