Open efstathiosntonas opened 2 years ago
Hi , You can try this command. RCT_NEW_ARCH_ENABLED=1 pod install
fabric_enabled=1 hermes_enabled=1 RCT_NEW_ARCH_ENABLED=1 pod install
this will enable Hermes and fabric.
i got this error: Invalid Podfile file: undefined method `get_default_flags' please help
Hey, you can just not use flags? I mean, these are changes so impactful that I don't see a need to use flags here, just set it manually to either true or false a no bothering if your flag is passed from CLI.
Looks cleaner than having some hermes_enabled=1
around CLI scripts or yarn scripts.
thanks, i removed flag then it's work.
What about when using fastlane; https://docs.fastlane.tools/actions/cocoapods/
i think it may be included i react-native 0.69. there is a rc release available on react-native-upgrade-helper:
https://react-native-community.github.io/upgrade-helper/?from=0.68.1&to=0.69.0-rc.0
there is a new _xcode.env
file which i think is where you set the flags. this is just speculation but it seems like it could be the place you define these flags. though it would still be nice with some official confirmation.
though this file has no hermes_enabled
and fabric_enabled
variables, so it may not be it.
edit:
i just tried adding the _xcode.env
file to a project and adding
export hermes_enabled=true
at the bottom, to see if it enables hermes. hermes is still false for me.
i also tried to add
hermes_enabled=true
to me .env
file. still false
maybe someone has already seen it, but i posted in the react-native repo asking for clarification: https://github.com/facebook/react-native-website/issues/3105
and a pr was made by someone from the react-native team: https://github.com/facebook/react-native-website/pull/3109
so basically, it seems the default flags are just that, default values. if you want to change the value you dont have to edit the flag values anywhere, you just write true
/false
directly in the Podfile
.
so i believe that closes this issue.
you're right @efstathiosntonas this has caused some confusion and thanks @Adnan-Bacic for raising again / updating us 👍
we've just recently added to the template and website
# By default, Hermes is disabled on Old Architecture, and enabled on New Architecture. # You can enabled/disable it manually by replacing
flags[:hermes_enabled]
withtrue
orfalse
.
where 0.68 adds/sets the below internally (not in 0.67.0)
# 0.68-stable: react-native/scripts/react_native_pods.rb
def get_default_flags()
flags = {
:fabric_enabled => false,
:hermes_enabled => false,
}
if ENV['RCT_NEW_ARCH_ENABLED'] == '1'
flags[:fabric_enabled] = true
flags[:hermes_enabled] = true
end
return flags
end
# GitHub doesn't format permalink markdown to other repos
# So here's the snippet above
so RCT_NEW_ARCH_ENABLED
being our new 0.68+ environment variable
set via RCT_NEW_ARCH_ENABLED=1 pod install
(or unofficially via Podfile)
and our new .xcode.env
just let's us config other/more environment-related things, like which NODE_BINARY
(node PATH) to use
In the podfile, a better comment explaining how to enable hermes could also help to clarify this confussion.
Instead of
# to enable hermes on iOS, change
falseto
trueand then install pods
replace with
# to enable hermes on iOS, change
flags[:hermes_enabled]to
trueand then install pods
Or maybe another line stating that flags
are just static flags and can be replaced by booleans
Just dug into the source code https://github.com/facebook/react-native/blob/v0.69.0-rc.6/scripts/react_native_pods.rb#L135, the correct way to enable hermes
orfabric
is either:
export USE_HERMES=true
in .xcode.env
export RCT_NEW_ARCH_ENABLED=true
in .xcode.env
Of course you can replace :hermes_enabled => flags[:hermes_enabled]
with :hermes_enabled => true
if you only want to enable Hermes but not ready for Fabric
@efstathiosntonas
BTW, what is reactNativePath
in the line :path => config[:reactNativePath]
? (In earlier RN versions it used to be string literal)
Environment
not possible to get environment info, I'm using a yarn monorepo.
Things I’ve done to figure out my issue
Upgrading version
0.67.3 to 0.68.0
Description
According to upgrade-helper we must make these changes on
Podfile
Question is, how we set these flags? After running
pod install
hermes is removed since the default value forhermes_enabled
is false(?). Is there a step missing onupgrade-helper
?