Answer the question
In order to leave comments, you need to log in
How to set automatic image height in react-native?
The goal is to display the image on the full width of the screen, and the height is automatically obtained.
But if height is not specified, the image will not be displayed.
Please tell me how can I do this?
Thank you for your attention.
Answer the question
In order to leave comments, you need to log in
There are several ways, depending on what result you expect.
You can:
1) specify the height as a % of the parent element;
2) use screen height , for static size
import { Dimensions } from 'react-native';
const screenHeight = Dimensions.get('screen').height;
Image.getSize(uri, success, [failure]);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question