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

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

问题描述

我在我的 react-native 应用程序中安装了一个包(具体地说,它是 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:

-将我的 react-native 版本从0.61.5"升级;到0.62"

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

-删除 pod,清理项目并使用pod install"重新安装 pod

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

-尝试了这个答案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.

你知道我还能做什么吗?我的想法不多了,我在互联网上找不到太多关于这个主题的信息.

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)

node_modules > react-native > Libraries > Images > RCTUIImageViewAnimated.m search for 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];
  }

参考:https://github.com/facebook/react-本机/问题/29279#issuecomment-658244428

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

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