简体   繁体   中英

Scaling View in React Native

I'm trying to implement a camera, but when I start it, it's not scaling well. The component is inside a View, and it is shrunk vertically, but if in the return method I put only the camera, it works well, so I think the problem comes from the View style, but I can't figure out how to solve it. The camera should render when a button is pressed, but when I press it this is what happens:

This is the snack: Snack

Thanks for the help.

I saw your code on snack and if you remove the position absolute property on the View Component you have in Book.js on 243 line and add flex: 1 to that view you will get the desired output. Remeber that View always takes the height of the max content of children if we do not explicity give height or give flex:1. And if we are using position property with flex than position propeties will work but flex properties won't work. So choose one of them and than do your design accordingly. If you need to have position property than take the device height from expo constants and pass that height to the View enclosing your camera.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM