react-native-fit-image | Responsive image component to fit | iOS library
kandi X-RAY | react-native-fit-image Summary
kandi X-RAY | react-native-fit-image Summary
Responsive image component to fit perfectly itself.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of react-native-fit-image
react-native-fit-image Key Features
react-native-fit-image Examples and Code Snippets
Community Discussions
Trending Discussions on react-native-fit-image
QUESTION
I am newbie at react-native.
What I want to do is that fit an image in device and keep the ratio of image. Simply I want to make width : 100%
I searched how to make it and seems resizeMode = 'contain'
is good for that.
However, since I used resizeMode = 'contain'
, the image keeps the position vertically centered which I don't want.
I want it to be vertically top.
I tried to use a plug-in such as react-native-fit-image but no luck.
And I found the reason why the image is not sizing automatically. But still I have no idea how to make it.
So, my question is what is the best way to deal with this situation?
Do I have to manually put width, height
size each images?
I want :
- Keep image's ratio.
- Vertically top positioned.
React native test code :
https://snack.expo.io/ry3_W53rW
Eventually what I want to make :
https://jsfiddle.net/hadeath03/mb43awLr/
Thanks.
...ANSWER
Answered 2018-Mar-07 at 22:00The image is vertically centered, because you added flex: 1
to the style property. Don't add flex: 1, because that will fill the image to its parent, which is not desired in this case.
You should always add a height and width on an image in React Native. In case the image is always the same, you can use Dimensions.get('window').width
to calculate the size the image should be. For example, if the ratio is always 16x9, the height is 9/16th of the width of the image. The width equals device width, so:
QUESTION
I am using stack navigator to navigate between screen in my react native app. But it is giving me an error using this.props.navigation.navigate . kindly tell me what i am doing wrong here .
I am using react-native router-flux too in my app but for some purpose i need to use stack navigator as my app has home page and it shows some content of blog feed and onclicking read more it should open detailed view of only that specific blog feed in detailed page, therefore, for this purpose i am using stack navigator here . Here is my code:
Home.js:
...ANSWER
Answered 2017-Aug-23 at 10:25in onPress
callback, this
may be changed, so the value of this.props.navigation
may be different to your expect. you should use a variable to save navigation
and avoid use this
in callback. see my code below.
QUESTION
i'm creating react native app and on it's first page(Home page) it will show some content of blog feeds and on clicking Read more it will show the detailed view of that blog feed on the next page. So, my question is how to do it ? Here is my output: Output Image
So on clicking read more button it should open the detailed view of only that blog feed and my question is how to do it in react native?
Here is my code:
...ANSWER
Answered 2017-Aug-18 at 12:40You should use a navigation library, eg. react-navigation.
QUESTION
ANSWER
Answered 2017-Aug-17 at 12:36You can pass data in HTMLView after removing image tag like follow so if there is no image in HTML string it will display without image
]*>/g,"")}/>
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install react-native-fit-image
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page