Skip to content

Commit

Permalink
Fix a bug for which is impossible to disable Hermes (#34142)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #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
  • Loading branch information
Riccardo Cipolleschi authored and facebook-github-bot committed Jul 6, 2022
1 parent 303aaf8 commit 6148844
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/react_native_pods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 6148844

Please sign in to comment.