From 61488449b996da5881e4711e0813e9c90b6e57a1 Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Wed, 6 Jul 2022 07:17:10 -0700 Subject: [PATCH] Fix a bug for which is impossible to disable Hermes (#34142) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/34142 The `||=` operator in an expression like `x = a ||= b` works in a way that: - if a is null, it assigns b to x - if a is `falsy`, it assigns b to x - otherwise, it assigns a to x. In our setup, if the user set `hermes_enabled` to `false` in the Podfile (one of the suggested way to disabled Hermes), the `options[:hermes_enabled]` part will evaluate to false and, therefore, `hermes_enabled` will obtain the value of `true`. ## Changelog [iOS][Changed] - Use the correct operator to decide whether Hermes is enabled or not. Reviewed By: cortinico Differential Revision: D37643845 fbshipit-source-id: 387f7bd642250c40873400d22d7d85451462c073 --- scripts/react_native_pods.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/react_native_pods.rb b/scripts/react_native_pods.rb index c3ca45a2394709..d5457ddc8996d3 100644 --- a/scripts/react_native_pods.rb +++ b/scripts/react_native_pods.rb @@ -36,7 +36,7 @@ def use_react_native! (options={}) production = options[:production] ||= false # Include Hermes dependencies - hermes_enabled = options[:hermes_enabled] ||= true + hermes_enabled = options[:hermes_enabled] != nil ? options[:hermes_enabled] : true flipper_configuration = options[:flipper_configuration] ||= FlipperConfiguration.disabled