reactjs - 图像随着警报消失
问题描述
描述
当应用程序触发警报(来自 Alert 命名空间)时,屏幕上呈现的所有本地图像都会在 iOS 上消失。
反应原生版本:
0.63.2 世博 SDK v40.0.0
重现步骤
提供重现问题的详细步骤列表。
- 打造世博小吃
- 创建一个 Pressable 组件(Pressable、Button、TouchableOpacity 等...)
- 创建图像
- 设置 onPress 属性以调用触发警报的函数。
- 切换到 iOS 标签并点击 Tap to Play
预期成绩
警报触发并且图像保持在屏幕上呈现
小吃、代码示例、屏幕截图或存储库链接:
https://snack.expo.io/@razorshnegax/1f5b93'
代码示例:
import React from 'react';
import { Text, View, Button, Image, Alert } from 'react-native';
export default class Index extends React.Component {
render() {
return (
<View>
<Button
onPress={() => {
let eer = 'ees';
// Fires the alert
Alert.alert(eer);
}}
title="yeep"
/>
// The image that dissappears
<Image source={require('./image.gif')} />
</View>
);
}
}
解决方案
这是因为您使用的是“gif”,而不是图像。来自 iOS 中的图像react-native
不支持 gif。
来源。
If you replace it with a png file, it won't disappear.
推荐阅读
- mysql - VS2019中用MYSQL连接Entity Framework
- sql - 有没有办法将我输入的日期作为查询参数输入到访问报告中文本框中的 msgbox 中?
- c# - 无法使用 Emgu Mat.CopyTo 写入子矩阵
- react-native - 适用于 iOS 和 Android 的原生 Base 选择器,具有动态创建的项目列表
- python - 使用python将整数列添加到日期列以获取“未来日期”
- c# - 在 MovePosition 协程结束时防止刚体抖动
- redux-observable - Redux-Observable 调度多个动作并等待响应
- serialization - 如何强制 YamlDotNet 对所有多行字符串使用折叠块标量
- java - 需要帮助创建 10% 随机数组进行排序
- google-chrome - 新的 Chrome SameSite 更改如何影响旧 cookie?