Building Image Card in React NativeLazy load of images in ListViewHow do I auto-resize an image to fit a 'div' container?How to vertically align an image inside a divLoop inside React JSXHide keyboard in react-nativeWhat is the difference between using constructor vs getInitialState in React / React Native?Programmatically navigate using react routerWhat is the difference between React Native and React?How to build stackable cards in React with react-swipe-card?Enable overflow in native-base cards

As a DM, how to avoid unconscious metagaming when dealing with a high AC character?

Why hasn't the U.S. government paid war reparations to any country it attacked?

How are "soeben" and "eben" different from one another?

Behavior of the zero and negative/sign flags on classic instruction sets

Equivalent definitions of total angular momentum

I quit, and boss offered me 3 month "grace period" where I could still come back

How to use "regular expression" to separate specific strings in Oracle

Why does the trade federation become so alarmed upon learning the ambassadors are Jedi Knights?

Are L-functions uniquely determined by their values at negative integers?

HackerRank: Electronics Shop

How to fit a linear model in the Bayesian way in Mathematica?

Does optical correction give a more aesthetic look to the SBI logo?

Cubic programming and beyond?

Redox reactions redefined

What exactly is the Tension force?

Could the crash sites of the Apollo 11 and 16 LMs be seen by the LRO?

What is the German equivalent of 干物女 (dried fish woman)?

Does entangle require vegetation?

Did the Shuttle's rudder or elevons operate when flown on its carrier 747?

How do I define this subset using mathematical notation?

Published paper containing well-known results

Is `curl something | sudo bash -` a reasonably safe installation method?

Construct a pentagon avoiding compass use

Does ability to impeach an expert witness on science or scholarship go too far?



Building Image Card in React Native


Lazy load of images in ListViewHow do I auto-resize an image to fit a 'div' container?How to vertically align an image inside a divLoop inside React JSXHide keyboard in react-nativeWhat is the difference between using constructor vs getInitialState in React / React Native?Programmatically navigate using react routerWhat is the difference between React Native and React?How to build stackable cards in React with react-swipe-card?Enable overflow in native-base cards






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I'm trying to build a simple image card component in React Native and got some problems. This is my component now (It's available for you on snack):



enter image description here



  • I can't find a way to set border only on the top of the image on the card, keeping the bottom border flat.

Desired form:
enter image description here



  • The Image component doesn't seen to be rendered from the top showing the model's face, instead it's getting centered showing her body.

Here it's the original image for comparison:



enter image description here










share|improve this question




























    0















    I'm trying to build a simple image card component in React Native and got some problems. This is my component now (It's available for you on snack):



    enter image description here



    • I can't find a way to set border only on the top of the image on the card, keeping the bottom border flat.

    Desired form:
    enter image description here



    • The Image component doesn't seen to be rendered from the top showing the model's face, instead it's getting centered showing her body.

    Here it's the original image for comparison:



    enter image description here










    share|improve this question
























      0












      0








      0








      I'm trying to build a simple image card component in React Native and got some problems. This is my component now (It's available for you on snack):



      enter image description here



      • I can't find a way to set border only on the top of the image on the card, keeping the bottom border flat.

      Desired form:
      enter image description here



      • The Image component doesn't seen to be rendered from the top showing the model's face, instead it's getting centered showing her body.

      Here it's the original image for comparison:



      enter image description here










      share|improve this question














      I'm trying to build a simple image card component in React Native and got some problems. This is my component now (It's available for you on snack):



      enter image description here



      • I can't find a way to set border only on the top of the image on the card, keeping the bottom border flat.

      Desired form:
      enter image description here



      • The Image component doesn't seen to be rendered from the top showing the model's face, instead it's getting centered showing her body.

      Here it's the original image for comparison:



      enter image description here







      reactjs image react-native mobile components






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 26 at 6:32









      André MonteiroAndré Monteiro

      471 gold badge1 silver badge7 bronze badges




      471 gold badge1 silver badge7 bronze badges






















          2 Answers
          2






          active

          oldest

          votes


















          2














          Use this code. Added overflow: "hidden" to the View and removed borderRadius for Image. Tested in IOS.



          import * as React from 'react';
          import Text, View, Image from "react-native";


          export default class RootComponent extends React.Component

          render()
          return (
          <View style= flex: 1, alignItems: "center", justifyContent: "center" >
          <View style= backgroundColor: "#eee", borderRadius: 10, overflow: "hidden" >
          <View>
          <Image
          source=require("./assets/h4.jpg")
          style=
          height: 135,
          width: 155

          />
          </View>
          <View style= padding: 10, width: 155 >
          <Text>Title</Text>
          <Text style= color: "#777", paddingTop: 5 >
          Description of the image
          </Text>
          </View>
          </View>
          </View>
          );







          share|improve this answer






























            2














            By removing the height from the <Image> and setting it in its parent view, the image will be shown from the top.



             <View style= flex: 1, alignItems: "center", justifyContent: "center" >
            <View style= backgroundColor: "#eee", borderRadius: 10, overflow: 'hidden' >
            <View style= height: 135, width: 155, overflow: 'hidden' >
            <Image
            source=require("./assets/h4.jpg")
            style=
            width: 155

            />
            </View>
            <View style= padding: 10, width: 155 >
            <Text>Title</Text>
            <Text style= color: "#777", paddingTop: 5 >
            Description of the image
            </Text>
            </View>
            </View>
            </View>





            share|improve this answer


















            • 2





              Since it was two questions inside one I've selected the first posted to be correct. But this is correct too since it will render the image from top. Thank you !

              – André Monteiro
              Mar 26 at 23:29













            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55351050%2fbuilding-image-card-in-react-native%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            Use this code. Added overflow: "hidden" to the View and removed borderRadius for Image. Tested in IOS.



            import * as React from 'react';
            import Text, View, Image from "react-native";


            export default class RootComponent extends React.Component

            render()
            return (
            <View style= flex: 1, alignItems: "center", justifyContent: "center" >
            <View style= backgroundColor: "#eee", borderRadius: 10, overflow: "hidden" >
            <View>
            <Image
            source=require("./assets/h4.jpg")
            style=
            height: 135,
            width: 155

            />
            </View>
            <View style= padding: 10, width: 155 >
            <Text>Title</Text>
            <Text style= color: "#777", paddingTop: 5 >
            Description of the image
            </Text>
            </View>
            </View>
            </View>
            );







            share|improve this answer



























              2














              Use this code. Added overflow: "hidden" to the View and removed borderRadius for Image. Tested in IOS.



              import * as React from 'react';
              import Text, View, Image from "react-native";


              export default class RootComponent extends React.Component

              render()
              return (
              <View style= flex: 1, alignItems: "center", justifyContent: "center" >
              <View style= backgroundColor: "#eee", borderRadius: 10, overflow: "hidden" >
              <View>
              <Image
              source=require("./assets/h4.jpg")
              style=
              height: 135,
              width: 155

              />
              </View>
              <View style= padding: 10, width: 155 >
              <Text>Title</Text>
              <Text style= color: "#777", paddingTop: 5 >
              Description of the image
              </Text>
              </View>
              </View>
              </View>
              );







              share|improve this answer

























                2












                2








                2







                Use this code. Added overflow: "hidden" to the View and removed borderRadius for Image. Tested in IOS.



                import * as React from 'react';
                import Text, View, Image from "react-native";


                export default class RootComponent extends React.Component

                render()
                return (
                <View style= flex: 1, alignItems: "center", justifyContent: "center" >
                <View style= backgroundColor: "#eee", borderRadius: 10, overflow: "hidden" >
                <View>
                <Image
                source=require("./assets/h4.jpg")
                style=
                height: 135,
                width: 155

                />
                </View>
                <View style= padding: 10, width: 155 >
                <Text>Title</Text>
                <Text style= color: "#777", paddingTop: 5 >
                Description of the image
                </Text>
                </View>
                </View>
                </View>
                );







                share|improve this answer













                Use this code. Added overflow: "hidden" to the View and removed borderRadius for Image. Tested in IOS.



                import * as React from 'react';
                import Text, View, Image from "react-native";


                export default class RootComponent extends React.Component

                render()
                return (
                <View style= flex: 1, alignItems: "center", justifyContent: "center" >
                <View style= backgroundColor: "#eee", borderRadius: 10, overflow: "hidden" >
                <View>
                <Image
                source=require("./assets/h4.jpg")
                style=
                height: 135,
                width: 155

                />
                </View>
                <View style= padding: 10, width: 155 >
                <Text>Title</Text>
                <Text style= color: "#777", paddingTop: 5 >
                Description of the image
                </Text>
                </View>
                </View>
                </View>
                );








                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 26 at 6:43









                Sibiraj PRSibiraj PR

                1,2831 gold badge9 silver badges24 bronze badges




                1,2831 gold badge9 silver badges24 bronze badges























                    2














                    By removing the height from the <Image> and setting it in its parent view, the image will be shown from the top.



                     <View style= flex: 1, alignItems: "center", justifyContent: "center" >
                    <View style= backgroundColor: "#eee", borderRadius: 10, overflow: 'hidden' >
                    <View style= height: 135, width: 155, overflow: 'hidden' >
                    <Image
                    source=require("./assets/h4.jpg")
                    style=
                    width: 155

                    />
                    </View>
                    <View style= padding: 10, width: 155 >
                    <Text>Title</Text>
                    <Text style= color: "#777", paddingTop: 5 >
                    Description of the image
                    </Text>
                    </View>
                    </View>
                    </View>





                    share|improve this answer


















                    • 2





                      Since it was two questions inside one I've selected the first posted to be correct. But this is correct too since it will render the image from top. Thank you !

                      – André Monteiro
                      Mar 26 at 23:29















                    2














                    By removing the height from the <Image> and setting it in its parent view, the image will be shown from the top.



                     <View style= flex: 1, alignItems: "center", justifyContent: "center" >
                    <View style= backgroundColor: "#eee", borderRadius: 10, overflow: 'hidden' >
                    <View style= height: 135, width: 155, overflow: 'hidden' >
                    <Image
                    source=require("./assets/h4.jpg")
                    style=
                    width: 155

                    />
                    </View>
                    <View style= padding: 10, width: 155 >
                    <Text>Title</Text>
                    <Text style= color: "#777", paddingTop: 5 >
                    Description of the image
                    </Text>
                    </View>
                    </View>
                    </View>





                    share|improve this answer


















                    • 2





                      Since it was two questions inside one I've selected the first posted to be correct. But this is correct too since it will render the image from top. Thank you !

                      – André Monteiro
                      Mar 26 at 23:29













                    2












                    2








                    2







                    By removing the height from the <Image> and setting it in its parent view, the image will be shown from the top.



                     <View style= flex: 1, alignItems: "center", justifyContent: "center" >
                    <View style= backgroundColor: "#eee", borderRadius: 10, overflow: 'hidden' >
                    <View style= height: 135, width: 155, overflow: 'hidden' >
                    <Image
                    source=require("./assets/h4.jpg")
                    style=
                    width: 155

                    />
                    </View>
                    <View style= padding: 10, width: 155 >
                    <Text>Title</Text>
                    <Text style= color: "#777", paddingTop: 5 >
                    Description of the image
                    </Text>
                    </View>
                    </View>
                    </View>





                    share|improve this answer













                    By removing the height from the <Image> and setting it in its parent view, the image will be shown from the top.



                     <View style= flex: 1, alignItems: "center", justifyContent: "center" >
                    <View style= backgroundColor: "#eee", borderRadius: 10, overflow: 'hidden' >
                    <View style= height: 135, width: 155, overflow: 'hidden' >
                    <Image
                    source=require("./assets/h4.jpg")
                    style=
                    width: 155

                    />
                    </View>
                    <View style= padding: 10, width: 155 >
                    <Text>Title</Text>
                    <Text style= color: "#777", paddingTop: 5 >
                    Description of the image
                    </Text>
                    </View>
                    </View>
                    </View>






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Mar 26 at 8:12









                    MiloreMilore

                    1,1571 gold badge6 silver badges15 bronze badges




                    1,1571 gold badge6 silver badges15 bronze badges







                    • 2





                      Since it was two questions inside one I've selected the first posted to be correct. But this is correct too since it will render the image from top. Thank you !

                      – André Monteiro
                      Mar 26 at 23:29












                    • 2





                      Since it was two questions inside one I've selected the first posted to be correct. But this is correct too since it will render the image from top. Thank you !

                      – André Monteiro
                      Mar 26 at 23:29







                    2




                    2





                    Since it was two questions inside one I've selected the first posted to be correct. But this is correct too since it will render the image from top. Thank you !

                    – André Monteiro
                    Mar 26 at 23:29





                    Since it was two questions inside one I've selected the first posted to be correct. But this is correct too since it will render the image from top. Thank you !

                    – André Monteiro
                    Mar 26 at 23:29

















                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55351050%2fbuilding-image-card-in-react-native%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript