问题标签 [imagebackground]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
88 浏览

javascript - 在 ImageBackground 中添加要要求的变量

我正在使用来自 react-native lib 的 ImageBackground。ImageBackground 使用 source={require('asd.png')} 例如。

但我试图在里面添加变量来要求。

但我收到错误。第 122 行的无效调用:require(image)

0 投票
0 回答
137 浏览

javascript - ERROR : undefined is not an object (evaluation 'style.width')

Hello everyone I'm having trouble with component and I get an undefined error message.So my app has 2 screen,the first one has a list of imagebackgrounds and when you press on one of the images you get a description of that image on another screen.So on this second screen I get the image that I pressed on in an image component (not background). The problem I'm having is that when I save I get the undefined error.

First screen component :

0 投票
1 回答
64 浏览

react-native - 如何在 react-native 中的 Imagebackground 的一角添加阴影

我需要ImageBackground在 WhatsApp 的角落添加阴影以显示星星。 在此处输入图像描述

如何在 react-native 中实现这一点。

0 投票
0 回答
193 浏览

react-native - 已解决如何通过导航在 React Native 中设置全屏背景图像

我希望我的应用程序看起来像这样: 它应该是什么样子

这是我的 App.js:

这是我的 HomeScreen.js

输出在这里

ImageBackground 覆盖了所有组件。如果我注释掉 alignItems,这里是输出

如果我将宽度设置为 200,则会发生以下情况

版本:

这个问题对我来说非常重要,但有关代码的任何其他提示将不胜感激。

要了解问题,您需要查看链接中的图像。我保证的链接没有错。我真的需要一些关于背景图像的帮助。

0 投票
1 回答
35 浏览

javascript - React Native - 图片背景内容超出了屏幕

我正在向我的应用程序添加图像背景,但图像的水平部分超出了屏幕(右侧和左侧部分被剪切)。我尝试使用 resizeMode 覆盖和包含但它都没有做任何事情。有没有其他方法可以使图像留在屏幕内?(我在 Image 上使用 resizeMode 并且它通常包含图像 {same picture})。

图像水平部分被剪掉了一点,我需要让它全部显示而不被剪掉。 水平图像被剪切

0 投票
1 回答
52 浏览

android - 如何向我的反应原生应用程序添加背景图像?

我对本机反应还很陌生,但我有一些经验。通过遵循我已经完成的教程并进行自己的修改,我正在为 ios 和 android 创建自己的应用程序。在创建应用程序的过程中,我忘记添加背景图像。经过几天的努力,我很绝望,所以我决定在这里问我的问题。

我正在尝试将背景图像添加到我的 App.js 文件中。图像加载正确,但我的页面内容(在里面<LifelineNavigator />)要么被隐藏,要么在 android 上消失了。而对于 ios,内容似乎在一个小的居中 flexbox 中。另外,我正在尝试删除白色背景。

任何建议肯定会有所帮助。非常感谢!上帝保佑!

这是我的代码:

IOS截图

安卓截图