skip to content
Andrei Calazans

How to set React Native Core's feature flags on Android

/ 1 min read

So perhaps you are like me, trying to figure out why the hell something is broken with React Native’s Fabric renderer but not with the old archicture. And you think if I could only get some logs?

Well, there is a feature flag for that called enableFabricLogs but how can I set that flag without having to build React Native from source?

How To

In your MainApplication.kt

import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlagsDefaults
...

...
// inside initialize at the end
ReactNativeFeatureFlags.override(object : ReactNativeFeatureFlagsDefaults() {
  override fun enableFabricLogs(): Boolean = true
})

You can view all the default features flags on Android here.

What about iOS? I don’t care about iOS, it’s never as broken as Android ; )