标签: react-native-hermes

React Native 0.63 和 Hermes 的国际填充

当我在应用程序中打开 Hermes 时,我遇到了问题。特别是在 Intl 支持下,我在 Android 中收到此错误ReferenceError: Property 'Intl' doesn't exist, js engine: hermes

我已经读过这些帖子了

但我无法让它发挥作用。有没有人成功应用这些解决方案或让它与其他方法一起使用?

反应本机 0.63.3

intl polyfills react-native react-native-hermes

5
推荐指数
1
解决办法
7626
查看次数

ReferenceError:属性“Reflect”不存在,js引擎:hermes react-native

我试图hermes通过在 React Native 网站中关注此https://reactnative.dev/docs/hermes来在我的 React Native 应用程序中启用,但我收到此错误消息: ReferenceError: Property 'Reflect' doesn't exist, js engine: hermes 我的 RN 版本:0.63.4

提前谢谢你

javascript gradle reactjs react-native react-native-hermes

4
推荐指数
1
解决办法
4万
查看次数

在 iOS 上使用 Hermes 时出现 RCT-Folly 错误

在 Podfile 中启用 Hermes 并重建构建时,由于 RCT-Folly,它会失败。不知道它有什么作用。

要重新初始化所有内容,我使用以下命令:

rm -rf node_modules && rm package-lock.json && npm install && cd ios && rm -rf Pods && rm Podfile.lock && pod deintegrate && pod setup && pod install && cd ..

我还启动了 Metro 捆绑器:

npx react-native --reset-cache

有人有解决办法吗?

该应用程序使用react-native v0.64,我们希望使用hermes获得更好的性能。

所有信息:

ios/Podfile

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '10.0'

target 'unblnd' do
  config = use_native_modules!
  use_react_native!(
    :path => config[:reactNativePath],
    :hermes_enabled => true
  )

  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-BluetoothPeripheral', :path => "#{permissions_path}/BluetoothPeripheral"
  pod 'Permission-Calendars', …
Run Code Online (Sandbox Code Playgroud)

performance xcode ios react-native react-native-hermes

4
推荐指数
3
解决办法
3万
查看次数

React Native:RCT-Folly 致命错误 - 找不到“fmt/compile.h”文件

我想为我的 iOS React Native 项目启用 Hermes,但出现下一个错误:

In file included from ../ios/Pods/RCT-Folly/folly/Singleton.cpp:35:
../ios/Pods/RCT-Folly/folly/portability/FmtCompile.h:19:10: fatal error: 'fmt/compile.h' file not found
#include <fmt/compile.h>
         ^~~~~~~~~~~~~~~
Run Code Online (Sandbox Code Playgroud)

我的配置:

System:
    OS: macOS 11.6.1
  Binaries:
    Node: 12.22.7 - /usr/local/bin/node
    npm: 6.14.15 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2 
    react-native: ^0.66.3 => 0.66.3 
Run Code Online (Sandbox Code Playgroud)

我的 Pod 文件:

In file included from ../ios/Pods/RCT-Folly/folly/Singleton.cpp:35:
../ios/Pods/RCT-Folly/folly/portability/FmtCompile.h:19:10: fatal …
Run Code Online (Sandbox Code Playgroud)

xcode ios cocoapods react-native react-native-hermes

4
推荐指数
1
解决办法
3856
查看次数

使用 Hermes JS 引擎时返回无效日期的时刻

当我使用jsc引擎时,一切工作正常,但是当我在反应本机应用程序中从jsc引擎切换到Hermes引擎时,我开始在使用时刻时收到无效日期。

代码:

const defaultDate = moment(currentTimeStamp).format("YYYY/MM/DD"); //till this it works fine
return moment(defaultDate).toDate().getTime(); // throws INVALID DATE
Run Code Online (Sandbox Code Playgroud)

momentjs react-native moment-timezone react-native-hermes

3
推荐指数
1
解决办法
1356
查看次数

为什么enableHermes: false但是global.HermesInternal = {}?

在 android\app\build.gradle 中:

project.ext.react = [
    entryFile: "index.js",
    enableHermes: false,
]
Run Code Online (Sandbox Code Playgroud)

在index.js中

console.log('hermes -> ishermes', global.HermesInternal !== null);
Run Code Online (Sandbox Code Playgroud)
npm run android
Run Code Online (Sandbox Code Playgroud)

在日志中:

    Time    Tag Message
    18:28:15.576    ReactNativeJS   'hermes -> ishermes', true
Run Code Online (Sandbox Code Playgroud)

为什么enableHermes: false但是global.HermesInternal = {}?

反应本机:0.61.5

模拟器

react-native react-native-hermes

1
推荐指数
1
解决办法
3210
查看次数