Skip to content

Commit

Permalink
Deprecate default_flags in Podfile (#39389)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #39389

The Podfile of the Template is using a function called `get_default_flags` to get the default flags.
Its behavior is duplicated in both the default value of the `use_react_native!` function and in the body of the same function, making that helper actually redundant.

In this change, we are deprecating it so we can remove it in 0.74 with no breakages.

## Changelog:
[iOS][Deprecated] - Deprecate `get_default_flags` in Ruby scripts

Reviewed By: dmytrorykun

Differential Revision: D49147290

fbshipit-source-id: 41a9f9aa4ba5d1a31d86953fe78778b45d28d9b2
  • Loading branch information
cipolleschi authored and facebook-github-bot committed Sep 13, 2023
1 parent 31ac73a commit f60b9f6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
3 changes: 3 additions & 0 deletions packages/react-native/scripts/cocoapods/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ def self.warn_if_not_on_arm64
end
end

# deprecated. These checks are duplicated in the react_native_pods function
# and we don't really need them. Removing this function will make it easy to
# move forward.
def self.get_default_flags
flags = {
:fabric_enabled => false,
Expand Down
3 changes: 3 additions & 0 deletions packages/react-native/scripts/react_native_pods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,10 @@ def install_modules_dependencies(spec, new_arch_enabled: ENV['RCT_NEW_ARCH_ENABL
end

# It returns the default flags.
# deprecated.
def get_default_flags()
warn 'get_default_flags is deprecated. Please remove the keys from the `use_react_native!` function'
warn 'if you are using the default already and pass the value you need in case you don\'t want the default'
return ReactNativePodsUtils.get_default_flags()
end

Expand Down
6 changes: 0 additions & 6 deletions packages/react-native/template/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,8 @@ end
target 'HelloWorld' do
config = use_native_modules!

# Flags change depending on the env values.
flags = get_default_flags()

use_react_native!(
:path => config[:reactNativePath],
# Hermes is now enabled by default. Disable by setting this flag to false.
:hermes_enabled => flags[:hermes_enabled],
:fabric_enabled => flags[:fabric_enabled],
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
Expand Down

0 comments on commit f60b9f6

Please sign in to comment.