Files
react-native/ReactAndroid/src/main/java/com/facebook/react/viewmanagers/ModalHostViewManagerDelegate.java
T
Pavol Fulop c35a419e5d Make android modal to appear underneath translucent StatusBar (#26706)
Summary:
As described in https://github.com/facebook/react-native/issues/26559 , the modal is not appearing underneath translucent StatusBar so you can see previous view underneath the StatusBar instead. As a solution you can now provide prop to set the modal to have translucent StatusBar and therefore the content will appear underneath. I tried to reuse layout flags that are possibly set if you use StatusBar component but sadly values in them do not reflect the props set by StatusBar component.

## Changelog

[Android] [added] - Added statusBarTranslucent prop to Modal component, to indicate if StatusBar should appear translucent.
Pull Request resolved: https://github.com/facebook/react-native/pull/26706

Test Plan:
### With StatusBar translucent

![image](https://user-images.githubusercontent.com/3984319/66131336-8bfdf200-e5f3-11e9-940e-c6bb3f67ea6f.png)

``` <Modal statusBarTranslucent>```
### Without

![image](https://user-images.githubusercontent.com/3984319/66131403-a768fd00-e5f3-11e9-9814-ff7592b4ceac.png)

``` <Modal>```

Differential Revision: D17872874

Pulled By: mdvacca

fbshipit-source-id: 8c4b48a75cddf86c4429b62d0c63313e7a2dd1b8
2019-10-10 22:14:23 -07:00

55 lines
2.0 KiB
Java

/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated by codegen project: GeneratePropsJavaDelegate.js
*/
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.BaseViewManagerInterface;
import com.facebook.react.uimanager.LayoutShadowNode;
public class ModalHostViewManagerDelegate<T extends View, U extends BaseViewManagerInterface<T> & ModalHostViewManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
public ModalHostViewManagerDelegate(U viewManager) {
super(viewManager);
}
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
case "animationType":
mViewManager.setAnimationType(view, (String) value);
break;
case "presentationStyle":
mViewManager.setPresentationStyle(view, (String) value);
break;
case "transparent":
mViewManager.setTransparent(view, value == null ? false : (boolean) value);
break;
case "statusBarTranslucent":
mViewManager.setStatusBarTranslucent(view, value == null ? false : (boolean) value);
break;
case "hardwareAccelerated":
mViewManager.setHardwareAccelerated(view, value == null ? false : (boolean) value);
break;
case "animated":
mViewManager.setAnimated(view, value == null ? false : (boolean) value);
break;
case "supportedOrientations":
mViewManager.setSupportedOrientations(view, (ReadableArray) value);
break;
case "identifier":
mViewManager.setIdentifier(view, value == null ? 0 : ((Double) value).intValue());
break;
default:
super.setProperty(view, propName, value);
}
}
}