Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Toast不显示图标 #1354

Open
1 task done
Jhh910 opened this issue Jul 13, 2024 · 5 comments
Open
1 task done

[Bug] Toast不显示图标 #1354

Jhh910 opened this issue Jul 13, 2024 · 5 comments
Labels

Comments

@Jhh910
Copy link

Jhh910 commented Jul 13, 2024

💬 前提强调

  • I have searched the issues of this repository and believe that this is not a duplicate.

🙋 描述详情/重现步骤

// 化验工单详情
import React, {useState, useEffect, useRef} from 'react';
import {
ActivityIndicator,
} from 'react-native';
import {Toast, Provider} from '@ant-design/react-native';

// 提交化验项目
const submitLabItem = async () => {
try {
Promise.all(
onChangeText.map(async item => {
const response = await labItemHandleApi(item);
// 在这里可以对每个元素的响应进行处理
}),
).then(() => {
// Alert.alert('提交成功', '', [{text: '知道了', style: 'cancel'}]);
Toast.show({
content: '提交成功',
// icon: ,
icon: ,

    });
    // Toast.success('Success');

}
}
return (


........


);
};

🔴 版本

8.19.2

💻 运行环境

Android

⚫️ npx react-native info输出信息

System:
OS: Windows 11 10.0.22621
CPU: (16) x64 12th Gen Intel(R) Core(TM) i5-12500H
Memory: 2.10 GB / 15.73 GB
Binaries:
Node:
version: 18.12.1
path: D:\nodejs\node.EXE
Yarn: Not Found
npm:
version: 10.7.0
path: E:\SmartWater\SmartWaterAndroidApp\node_modules.bin\npm.CMD
Watchman: Not Found
SDKs:
Android SDK: Not Found
Windows SDK: Not Found
IDEs:
Android Studio: Not Found
Visual Studio:

  • 17.9.34622.214 (Visual Studio Community 2022)
    Languages:
    Java: 17.0.11
    Ruby: Not Found
    npmPackages:
    "@react-native-community/cli": Not Found
    react:
    installed: 18.2.0
    wanted: 18.2.0
    react-native:
    installed: 0.74.0
    wanted: 0.74.0
    react-native-windows: Not Found
    npmGlobalPackages:
    "react-native": Not Found
    Android:
    hermesEnabled: true
    newArchEnabled: false
    iOS:
    hermesEnabled: Not found
    newArchEnabled: Not found

补充说明

不显示图标 并且show方法被划掉了

@Jhh910 Jhh910 added the Bug🐛 label Jul 13, 2024
@1uokun
Copy link
Collaborator

1uokun commented Jul 15, 2024

检查一下@ant-design/icons-react-native是否安装成功
https://github.com/ant-design/ant-design-icons/tree/master/packages/icons-react-native

@Jhh910
Copy link
Author

Jhh910 commented Jul 15, 2024

检查一下@ant-design/icons-react-native是否安装成功 https://github.com/ant-design/ant-design-icons/tree/master/packages/icons-react-native

"@ant-design/icons-react-native": "^2.3.2",有的

@1uokun
Copy link
Collaborator

1uokun commented Jul 15, 2024

如果是xcode环境,需要借助react-native-asset正确link字体文件
如果是expo环境,文档里有加载font的实例代码

@snowwindsand
Copy link

snowwindsand commented Jul 17, 2024

可以试一下网站上的这一步,我按这步操作了,仍然没显示,不过你可以试一下

将字体资源路径配置到根目录下的 react-native.config.js 文件中 ( 如果没有,请创建 )

module.exports = {
assets: ['node_modules/@ant-design/icons-react-native/fonts'],
};
然后执行react-native-asset的命令

npx react-native-asset

@1uokun
Copy link
Collaborator

1uokun commented Jul 17, 2024

image

icon字段只在5.2.0版本才支持,注意一下版本,目前还在rc阶段

5.1.3版本之前只能通过

  • Toast.success(props)
  • Toast.fail(props)
  • ...

执行带图标的toast

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants