React-native iOS不显示图像(pod问题) [英] React-native iOS not showing images (pods issue)

查看:1146
本文介绍了React-native iOS不显示图像(pod问题)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的本机应用程序中安装了一个软件包(具体来说,它是来自react-navigation的createMaterialTopTabNavigator),但是安装成功后,出现了崩溃(错误:@ react-navigation / material-top-tabs / src / index.tsx:意外令牌(16:12)),我试图对其进行修复,因此我对其进行了修复,但随后iOS上的图像停止工作。

I was installing a package in my react-native application (to be specific it was createMaterialTopTabNavigator from react-navigation) but after the installation succeed, something crash (error: @react-navigation/material-top-tabs/src/index.tsx: unexpected token (16:12)) and I was trying to fix it, so I fixed it but then the images on iOS stoped working.

在安装该软件包之前,我的Image组件在两种平台(iOS和Android)上均正常运行。

Before the installation of that package, my Image component was working perfectly in both platforms (iOS and Android).

我想这与处理XCode中图像的软件包/吊舱有关,但是我已经尝试了一些东西,但没有用(我不是XCode专家)。

I guess is something related with the packages/pods that take care of images in XCode, but I have tried some stuff but didn't work (I'm not an expert in XCode).

在Android上,它们工作正常。

On Android they are working fine.

我所做的解决问题但不起作用:

What I have done to solve the problem but didn't work:

-从 0.61.5升级我的react-native版本,到 0.62

-Upgrade my react-native version from "0.61.5" to "0.62"

-已删除的pod,清理项目并使用 pod install

-Deleted pods, clean the project and reinstall pods with "pod install"

重新安装Pod-尝试了此答案 https://stackoverflow.com/questions/58356653/react-native-ios-not-showing-local-image但是我想这不完全是我的问题。

-Tried this answer "https://stackoverflow.com/questions/58356653/react-native-ios-not-showing-local-image" but I guess that is not exactly my issue.

您知道我还能做什么吗?我的想法不多了,在Internet上找不到关于此主题的太多信息。

Do you know what else can I do? I'm running out of ideas and I do not find too much about this topic on the internet.

谢谢!

更新
Image组件使其动画就像加载图像一样,只是不显示它。因此,我确定这与iOS项目有关,也是因为在android中工作正常。

Update The Image component make its animation as if the image is loaded, it just does not display it. So I'm sure that is something related with the iOS project, and also because in android is working fine.

推荐答案

图片问题如果您没有运行最新的react-native版本或不打算升级到最新版本的react-native,则可以在Xcode12版本中找到该修补程序,然后转到

Images issue is seen in Xcode12 builds and the fix if you are not running latest react-native version or not planning to upgrade to latest version of react-native, then go to


node_modules>反应本机图书馆>图片> RCTUIImageViewAnimated.m
搜索 if(_currentFrame)

添加以下else块到下面的if块

add the following else block to the if block as below

 if (_currentFrame) {
    layer.contentsScale = self.animatedImageScale;
    layer.contents = (__bridge id)_currentFrame.CGImage;
  } else {
    [super displayLayer:layer];
  }

Ref: https://github.com/facebook/react-native/issues/29279#issuecomment-658244428

这篇关于React-native iOS不显示图像(pod问题)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆