React Native 0.64 发布,iOS 上 Hermes 支持

栏目: 软件资讯 · 发布时间: 3年前

内容简介:React Native 0.64 已经发布了,此版本主要亮点包括: 在 iOS 上加入 Hermes 默认情况下启用 Inline Requires React 17 Hermes opt-in on iOS 在此版本中,用户可以使用 Hermes 在 iOS 上进行构建。要在 iOS 上启...

React Native 0.64 已经发布了,此版本主要亮点包括:

  • 在 iOS 上加入 Hermes
  • 默认情况下启用 Inline Requires
  • React 17

Hermes opt-in on iOS

在此版本中,用户可以使用 Hermes 在 iOS 上进行构建。要在 iOS 上启用 Hermes,可在你的 Podfile 中设置 hermes_enabled 为 true,然后运行 pod 安装。

use_react_native!(
   :path => config[:reactNativePath],
   # to enable hermes on iOS, change `false` to `true` and then install pods
   :hermes_enabled => true
)

 所有必要的更改将自动完成。值得注意的是,iOS 上对 Hermes 的支持仍处于早期阶段。

默认情况下启用 Inline Requires

Inline Requires 是一个 Metro 配置选项,其已作为一种可选配置选项存在多年。现在,新的应用程序将默认启用 Inline Requires 选项,以帮助人们无需额外配置即可快速使用 React Native 应用程序。

Inline Requires 是一种 Babel 变换,它可以将模块导入并转换为 inline。例如,Inline Requires 将这个模块导入调用从文件的 top 转换到使用它的地方。

Before:

import { MyFunction } from 'my-module';

const MyComponent = (props) => {
  const result = myFunction();

  return (<Text>{result}</Text>);
};

After:

const MyComponent = (props) => {
  const result = require('my-module').MyFunction;

  return (<Text>{result}</Text>);
};

更多相关信息可查看文档

React 17

React 17 不包含面向开发者的新功能,也没有重大的突破性变化。对于 React Native 应用来说,主要的变化是一个新的 JSX 转换,使得文件不再需要导入 React 就能够使用 JSX。

有关 React 17 的更多信息,可参见 React 博客

完整更新内容可以查看:


以上所述就是小编给大家介绍的《React Native 0.64 发布,iOS 上 Hermes 支持》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Head First Web Design

Head First Web Design

Ethan Watrall、Jeff Siarto / O’Reilly Media, Inc. / 2009-01-02 / USD 49.99

Want to know how to make your pages look beautiful, communicate your message effectively, guide visitors through your website with ease, and get everything approved by the accessibility and usability ......一起来看看 《Head First Web Design》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

MD5 加密
MD5 加密

MD5 加密工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具