Blog
首页
文档
收藏
关于
  • 在线转换时间戳 (opens new window)
  • 在线压缩图片 (opens new window)
  • Float-Double转二进制 (opens new window)
  • 文件转Hex字符串 (opens new window)

HiuZing

🍑
首页
文档
收藏
关于
  • 在线转换时间戳 (opens new window)
  • 在线压缩图片 (opens new window)
  • Float-Double转二进制 (opens new window)
  • 文件转Hex字符串 (opens new window)
  • 前端面试题

  • JavaScript

  • Vue2

  • port

  • CSS

  • Node.js

  • JavaScript优化

  • uniapp

  • Mini Program

  • TypeScript

  • 面向对象编程

  • UI组件

  • Plugin

  • Vue3

  • 性能优化

  • Axios

  • 状态管理

  • React

  • Mock

  • Icon

  • Template

  • 构建工具

  • 项目规范配置

  • Taro

  • SVG

  • React Native

    • 沙盒环境-Expo

    • 原生环境

      • 案例

        • React Native蓝牙
        • React Native文件系统
        • React Native扫描二维码
        • React Native国际化
        • React Native使用antd库报警告
          • 警告
          • 解决方法
        • React Native 自定义字体
        • React Native 响应式布局
        • React Native 使用SVG
      • 文档

    • React Native第三方库
  • 前端
  • React Native
  • 原生环境
  • 案例
HiuZing
2024-01-07
目录

React Native使用antd库报警告

# 警告

warn Package @ant-design/react-native contains invalid configuration: "dependency.assets" is not allowed. Please verify it's properly linked using "react-native config" command and contact the package maintainers about this.
1

# 解决方法

  1. npm I react-native-asset

  2. 配置文件react-native.config.js

    module.exports = {
       assets: ["node_modules/@ant-design/icons-react-native/fonts"]
    };
    
    1
    2
    3
  3. 添加到 app.json 中

    "packagerOpts": {
        "config": "metro.config.js"
      }
    
    1
    2
    3
  4. npx react-native-asset

  5. 更新Package @ant-design/react-native依赖项的[react-native.config.js]文件

    dependency: {
      assets: ['../icons-react-native/fonts'],
    },
        
    // 替换为
    module.exports = {
      project: {
        ios: {},
        android: {
          sourceDir: './<project_name>/android'
        }
      },
      assets: ['../<project_name>/fonts']
    };
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
  6. 更新 icon-react-native 的 node_modules 内的依赖关系:

    module.exports = {
      project: {
        ios: {},
        android: {}
      },
      assets: ['fonts']
    };
    
    1
    2
    3
    4
    5
    6
    7
上次更新: 2024/08/14, 04:14:33
React Native国际化
React Native 自定义字体

← React Native国际化 React Native 自定义字体→

最近更新
01
React Native 使用SVG
08-13
02
Docker基础命令
08-04
03
算数逻辑单元
07-30
更多文章>
Theme by Vdoing | Copyright © 2021-2024 WeiXiaojing | 友情链接
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式