-
Notifications
You must be signed in to change notification settings - Fork 24.7k
Add edge-to-edge opt-in support #52088
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@sbuggay has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
packages/react-native/ReactAndroid/src/main/java/com/facebook/react/common/EdgeToEdge.kt
Outdated
Show resolved
Hide resolved
...e-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/ProjectUtils.kt
Show resolved
Hide resolved
...-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/PropertyUtils.kt
Show resolved
Hide resolved
packages/react-native/ReactAndroid/src/main/java/com/facebook/react/config/EdgeToEdgeFlags.kt
Outdated
Show resolved
Hide resolved
@sbuggay has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@sbuggay Do you need me to rebase? |
Yeah that would be good. Also this PR is now driven by @alanleedev |
0515f30
to
63da6e7
Compare
@cortinico @alanleedev Commits squashed + branch rebased against |
c431f28
to
b1614e2
Compare
@alanleedev has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@zoontek Need to fix code here: https://github.com/facebook/react-native/blob/main/packages/react-native/ReactCxxPlatform/react/coremodules/DeviceInfoModule.h#L31
|
@alanleedev Done ✅ |
internal val Project.isEdgeToEdgeEnabled: Boolean | ||
get() = | ||
(project.hasProperty(EDGE_TO_EDGE_ENABLED) && | ||
project.property(EDGE_TO_EDGE_ENABLED).toString().toBoolean()) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
project.property(EDGE_TO_EDGE_ENABLED).toString().toBoolean()) || | |
Boolean.parseBoolean(project.property(EDGE_TO_EDGE_ENABLED)) || |
@@ -121,6 +122,9 @@ public void onCreate(Bundle savedInstanceState) { | |||
() -> { | |||
String mainComponentName = getMainComponentName(); | |||
final Bundle launchOptions = composeLaunchOptions(); | |||
if (WindowUtilKt.isEdgeToEdgeFeatureFlagOn() && mActivity != null) { | |||
WindowUtilKt.enableEdgeToEdge(mActivity.getWindow()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got a lint warning here as mActivity.getWindow()
is nullable so may need to add a null check.
Summary:
This follows #47554
Compared to the initial proposal, I had to remove the
edgeToEdgeEnabled
property from the rootgradle.properties
and put it in the appgradle.properties
instead (explaining theAgpConfiguratorUtils.kt
/GenerateEntryPointTask.kt
/ProjectUtils.kt
/PropertyUtils.kt
changes)This PR:
MainActivity
(whenedgeToEdgeEnabled
is set totrue
)StatusBar
backgroundColor
andtranslucent
(whenedgeToEdgeEnabled
is set totrue
)statusBarTranslucent
andnavigationBarTranslucent
onModal
when edge-to-edge is enabledisEdgeToEdge
constant toDeviceInfoModule
forreact-native-is-edge-to-edge
detectionChangelog:
Test Plan:
enableEdgeToEdge
value inpackages/rn-tester/android/app/gradle.properties
demo.mp4