facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
119.58k stars 24.37k forks source link

[Android] Some images are not shown #17784

Closed ozgurrgul closed 6 years ago

ozgurrgul commented 6 years ago

Is this a bug report?

Yes.

Have you read the Contributing Guidelines?

Yes.

Environment

OS:  macOS Sierra 10.12.6
Node:  9.3
npm:  5.6.0
Watchman:  4.7.0
Xcode:  Xcode 9.2
Android Studio:  2

Packages: (wanted => installed) react-native:0.52.0 react: 16.2.0

Target Platform: Android

Steps to Reproduce

When I create images with following code, they are not shown sometimes:

<Image source={LogoIcon} style={styles.logo} />

// style:
const styles = StyleSheet.create({
    logo: {
        width: size(42),
        height: size(42),
        resizeMode: 'contain',
        justifyContent: 'center',
        alignItems: 'center',
    }
});

It's not related to it, but here is size function

function size(px) {

    let calculatedScale;

    if(isIOs()) {

        switch (getDeviceWidth()) {
            case 320: // iPhone 4, 4S, 5, 5S
                calculatedScale = 0.77;
                break;
            case 375: // iPhone 6, 6S
                calculatedScale = 0.902;
                break;
            case 414: // iPhone 6 plus, 6S plus
                calculatedScale = 1;
                break;
            default:
                calculatedScale = 1;
        }

        return Math.ceil(px * calculatedScale);
    }

    if(isAndroid()) {

        if (getDeviceWidth() <= 414) { // Android smart phones
            calculatedScale = getDeviceWidth() / 414;
        } else { // Android tablets
            calculatedScale = 1;
        }

        return Math.ceil(px * calculatedScale);
    }

    return px;
}

Expected Behavior

Images must show every time.

Actual Behavior

Images are not showing, only a transparent section. This problem occurs when I use Images in FlatList's renderItem method but sometimes all application images are not showing.

I did encounter this problem when testing with a Huawei device. I successfully tested with:

react-native-bot commented 6 years ago

Thanks for posting this! It looks like you may not be using the latest version of React Native, v0.53.0, released on January 2018. Can you make sure this issue can still be reproduced in the latest version?

I am going to close this, but please feel free to open a new issue if you are able to confirm that this is still a problem in v0.53.0 or newer.

How to ContributeWhat to Expect from Maintainers

salmanwaheed commented 6 years ago

This message was created automatically by mail delivery software.

A message that you sent could not be delivered to one or more of its recipients. This is a temporary error. The following address(es) deferred:

mkdirenv@gmail.com Domain salmanwaheed.info has exceeded the max emails per hour (159/150 (106%)) allowed. Message will be reattempted later

------- This is a copy of the message, including all the headers. ------ Received: from o11.sgmail.github.com ([167.89.101.202]:42057) by box1177.bluehost.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.89_1) (envelope-from bounces+848413-a7b0-hello=salmanwaheed.info@sgmail.github.com) id 1epQUt-003Iyo-9M for hello@salmanwaheed.info; Fri, 23 Feb 2018 20:27:39 -0700 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=github.com; h=from:reply-to:to:cc:in-reply-to:references:subject:mime-version:content-type:content-transfer-encoding:list-id:list-archive:list-post:list-unsubscribe; s=s20150108; bh=qpsZOrawa/wtVT0Uw2rzvz996Sg=; b=dScn9NGmKyE1xuW7 YOdwsHEM3AVI59B26fR0+/k4/NJQ3Avg0HgHdZUv9S/r4Hii7PRu0ojIvBK55ZlG 53O9d2OubUhoOTgAqEN0BaURr8wFMWQf6KNy3ZD/BOFE8eqGqIKf2Pu7CFrpcB5V 3XL9NMkcUx8pzFQN/FyqDOKgYAA= Received: by filter0489p1las1.sendgrid.net with SMTP id filter0489p1las1-31379-5A90DB9F-4 2018-02-24 03:27:27.878155742 +0000 UTC Received: from github-smtp2b-ext-cp1-prd.iad.github.net (github-smtp2b-ext-cp1-prd.iad.github.net [192.30.253.17]) by ismtpd0004p1iad2.sendgrid.net (SG) with ESMTP id OxyJn0p_RJKxZqoRK63kxA for hello@salmanwaheed.info; Sat, 24 Feb 2018 03:27:27.810 +0000 (UTC) Date: Sat, 24 Feb 2018 03:27:27 +0000 (UTC) From: React Native Bot notifications@github.com Reply-To: facebook/react-native reply@reply.github.com To: facebook/react-native react-native@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Message-ID: facebook/react-native/issues/17784/368194894@github.com In-Reply-To: facebook/react-native/issues/17784@github.com References: facebook/react-native/issues/17784@github.com Subject: Re: [facebook/react-native] [Android] Some images are not shown (#17784) Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="--==_mimepart_5a90da8f5c646_413b2b198187eec8279977"; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: list X-GitHub-Sender: react-native-bot X-GitHub-Recipient: salmanwaheed X-GitHub-Reason: subscribed List-ID: facebook/react-native List-Archive: https://github.com/facebook/react-native List-Post: mailto:reply@reply.github.com List-Unsubscribe: mailto:unsub+00ef1b38c50099bb7e0104c2e79d20900a71fef636cb53d392cf0000000116a89c8f92a169ce117395e4@reply.github.com, https://github.com/notifications/unsubscribe/AO8bODVLhzNF5XEarPVCPGdj4kxf9y_lks5tX4CPgaJpZM4RyWYV X-Auto-Response-Suppress: All X-GitHub-Recipient-Address: hello@salmanwaheed.info X-SG-EID: 92ws1MVnlto3blxqXlf5goB0ee0kdDGWR6vcWx8d6494CeoFS3R5POIWOe/VGe2TGfahvQG6c68bYf y72yP/QfzXkFbwVkI6SXrimVC+yfEZ9pMjbh4v9TrtxxOjORXg6vcuAi9Z648/l1bW2pKJVqlWXcEF +4cYGSaCsSgNllXsL0G6QvBiaqY+ZYH0APTgeeuAPgymMuSkxv9tiHBtHNPxJ8/bpvIWAD0AbFAc8x 4= X-Spam-Status: No, score=-1.1 X-Spam-Score: -10 X-Spam-Bar: - X-Ham-Report: Spam detection software, running on the system "box1177.bluehost.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see root\@localhost for details.

Content preview: Thanks for posting this! It looks like you may not be using the latest version of React Native, v0.53.0, released on January 2018. Can you make sure this issue can still be reproduced in the latest version? [...]

Content analysis details: (-1.1 points, 5.0 required)

pts rule name description


0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: github.com] -0.5 SPF_PASS SPF: sender matches SPF record -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain 0.0 HTML_IMAGE_ONLY_32 BODY: HTML: images with 2800-3200 bytes of words 0.0 HTML_MESSAGE BODY: HTML included in message -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.4 AWL AWL: Adjusted score from AWL reputation of From: address X-Spam-Flag: NO

----==_mimepart_5a90da8f5c646_413b2b198187eec8279977 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

Thanks for posting this! It looks like you may not be using the latest vers= ion of React Native, v0.53.0, released on January 2018. Can you make sure t= his issue can still be reproduced in the latest version?=20

I am going to close this, but please feel free to open a new issue if you a= re able to confirm that this is still a problem in v0.53.0 or newer.

How to Contribute =E2=80=A2 What to Expect from Maintainers

--=20 You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/facebook/react-native/issues/17784#issuecomment-368194894=

----==_mimepart_5a90da8f5c646_413b2b198187eec8279977 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

Thanks for posting this! It looks like you may not be using the latest v= ersion of React Native, v0.53.0, released on January 2018. Can you make sur= e this issue can still be reproduced in the latest version?

I am going to close this, but please feel free to open a new issue if yo= u are able to confirm that this is still a problem in v0.53.0 or newer.

How to Contribute =E2=80=A2 What to Expect from Maintainers

<p style=3D"font-size:small;-webkit-text-size-adjust:none;color:#666;">&mda= sh;
You are receiving this because you are subscribed to this thread.<= br />Reply to this email directly, <a href=3D"https://github.com/facebook/r= eact-native/issues/17784#issuecomment-368194894">view it on GitHub, or = <a href=3D"https://github.com/notifications/unsubscribe-auth/AO8bOAjMnf0iwd= cIgyeoqSjaT8qQ9A8tks5tX4CPgaJpZM4RyWYV">mute the thread.<img alt=3D"" h= eight=3D"1" src=3D"https://github.com/notifications/beacon/AO8bOJdOSVtooNO_= 8L8DtoDhA4I_ZTOlks5tX4CPgaJpZM4RyWYV.gif" width=3D"1" />

<div itemscope itemtype=3D"http://schema.org/EmailMessage"> <div itemprop=3D"action" itemscope itemtype=3D"http://schema.org/ViewAction= "> <link itemprop=3D"url" href=3D"https://github.com/facebook/react-native/i= ssues/17784#issuecomment-368194894"> <meta itemprop=3D"name" content=3D"View Issue">
<meta itemprop=3D"description" content=3D"View this Issue on GitHub">

<script type=3D"application/json" data-scope=3D"inboxmarkup">{"api_version"= :"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"Gi= tHub"},"entity":{"external_key":"github/facebook/react-native","title":"fac= ebook/react-native","subtitle":"GitHub repository","main_image_url":"https:= //cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95f= c-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com= /assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":= {"name":"Open in GitHub","url":"https://github.com/facebook/react-native"}}= ,"updates":{"snippets":[{"icon":"PERSON","message":"@react-native-bot in #1= 7784: Thanks for posting this! It looks like you may not be using the lates= t version of React Native, v0.53.0, released on January 2018. Can you make = sure this issue can still be reproduced in the latest version? \n\nI am goi= ng to close this, but please feel free to open a new issue if you are able = to confirm that this is still a problem in v0.53.0 or newer.\n\n\u003csub\u= 003eHow to Contribute =E2=80=A2 What to Expect from Maintainers\u003c/sub= \u003e\n\n"}],"action":{"name":"View Issue","url":"https://github.com/faceb= ook/react-native/issues/17784#issuecomment-368194894"}}}=

----==_mimepart_5a90da8f5c646_413b2b198187eec8279977--

ghost commented 6 years ago

Having the same issue with the same specs, but react native .54.2!

ImagineZzf commented 6 years ago

I hava the same issue ,but react native 0.55.0