React Native Modal is not drawn below the StatusBar on Android












1














In React Native (With EXPO), I'm showing a Modal.
The Modal gets drawn behind the StatusBar in iOS but it's not happening on Android.



Do you know why? I could not find any solution for this.



The StatusBar has already set the translucent={true} prop. That's why you are able to see the Map behind the StatusBar on Android. But I can not draw the Modal component behind it (as I can do on iOS).



Here I add a couple of screenshots and an online viewer to check this behavior: https://snack.expo.io/BJR4oF4A7



Another weird behavior that I'm seeing is that it doesn't matter which translucent value I set, it always works in the same way (it's always translucent, even when I set it to false).



In case that this is impossible, how can I set the background to #FFF and the font-color to #000 on the StatusBar on Android?



I want to know:




  1. Why there are different behaviors in iOS and Android.

  2. Why changing the props of StatusBar still not changing its behavior (can be seen in the online viewer, changing translucent, or backgroundColor values)

  3. If it's impossible to get the modal drawn behind the StatusBar, so, how can I change the background and the font-color of it when a Modal is opened? (in Android) (with no hiding it)


Android
Android



iOS
iOS










share|improve this question





























    1














    In React Native (With EXPO), I'm showing a Modal.
    The Modal gets drawn behind the StatusBar in iOS but it's not happening on Android.



    Do you know why? I could not find any solution for this.



    The StatusBar has already set the translucent={true} prop. That's why you are able to see the Map behind the StatusBar on Android. But I can not draw the Modal component behind it (as I can do on iOS).



    Here I add a couple of screenshots and an online viewer to check this behavior: https://snack.expo.io/BJR4oF4A7



    Another weird behavior that I'm seeing is that it doesn't matter which translucent value I set, it always works in the same way (it's always translucent, even when I set it to false).



    In case that this is impossible, how can I set the background to #FFF and the font-color to #000 on the StatusBar on Android?



    I want to know:




    1. Why there are different behaviors in iOS and Android.

    2. Why changing the props of StatusBar still not changing its behavior (can be seen in the online viewer, changing translucent, or backgroundColor values)

    3. If it's impossible to get the modal drawn behind the StatusBar, so, how can I change the background and the font-color of it when a Modal is opened? (in Android) (with no hiding it)


    Android
    Android



    iOS
    iOS










    share|improve this question



























      1












      1








      1







      In React Native (With EXPO), I'm showing a Modal.
      The Modal gets drawn behind the StatusBar in iOS but it's not happening on Android.



      Do you know why? I could not find any solution for this.



      The StatusBar has already set the translucent={true} prop. That's why you are able to see the Map behind the StatusBar on Android. But I can not draw the Modal component behind it (as I can do on iOS).



      Here I add a couple of screenshots and an online viewer to check this behavior: https://snack.expo.io/BJR4oF4A7



      Another weird behavior that I'm seeing is that it doesn't matter which translucent value I set, it always works in the same way (it's always translucent, even when I set it to false).



      In case that this is impossible, how can I set the background to #FFF and the font-color to #000 on the StatusBar on Android?



      I want to know:




      1. Why there are different behaviors in iOS and Android.

      2. Why changing the props of StatusBar still not changing its behavior (can be seen in the online viewer, changing translucent, or backgroundColor values)

      3. If it's impossible to get the modal drawn behind the StatusBar, so, how can I change the background and the font-color of it when a Modal is opened? (in Android) (with no hiding it)


      Android
      Android



      iOS
      iOS










      share|improve this question















      In React Native (With EXPO), I'm showing a Modal.
      The Modal gets drawn behind the StatusBar in iOS but it's not happening on Android.



      Do you know why? I could not find any solution for this.



      The StatusBar has already set the translucent={true} prop. That's why you are able to see the Map behind the StatusBar on Android. But I can not draw the Modal component behind it (as I can do on iOS).



      Here I add a couple of screenshots and an online viewer to check this behavior: https://snack.expo.io/BJR4oF4A7



      Another weird behavior that I'm seeing is that it doesn't matter which translucent value I set, it always works in the same way (it's always translucent, even when I set it to false).



      In case that this is impossible, how can I set the background to #FFF and the font-color to #000 on the StatusBar on Android?



      I want to know:




      1. Why there are different behaviors in iOS and Android.

      2. Why changing the props of StatusBar still not changing its behavior (can be seen in the online viewer, changing translucent, or backgroundColor values)

      3. If it's impossible to get the modal drawn behind the StatusBar, so, how can I change the background and the font-color of it when a Modal is opened? (in Android) (with no hiding it)


      Android
      Android



      iOS
      iOS







      android react-native mobile expo






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 24 at 23:16

























      asked Nov 22 at 19:43









      Broda Noel

      578619




      578619
























          2 Answers
          2






          active

          oldest

          votes


















          0















          1. I believe you need to try the app as a standalone application, not using the Expo client. It somehow sometimes has hard time dealing with StatusBar (I've already experienced it too).

          2. You may use the hidden property that is working on both platforms, based on your current state: <StatusBar hidden={!!this.state.isModalShown} />


          This will simply hide the status bar whenever your modal is opened.






          share|improve this answer





















          • I should try on the standalone app. True. On another hand, I don't want to hide the StatusBar, I just want to change the font-color to #000 and the background color to #FFF
            – Broda Noel
            Nov 24 at 23:17










          • For your first question, after checking their implementation, I believe it's related to the iOS "presentationStyle" property
            – Arnaud
            Nov 24 at 23:28



















          0














          Set the barStyle to be the contrasting backgroundColor.



          Black writing on white background, so have dark-content on white status bar.



          <StatusBar barStyle="dark-content" backgroundColor={"#fff"} />





          share|improve this answer





















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53437241%2freact-native-modal-is-not-drawn-below-the-statusbar-on-android%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0















            1. I believe you need to try the app as a standalone application, not using the Expo client. It somehow sometimes has hard time dealing with StatusBar (I've already experienced it too).

            2. You may use the hidden property that is working on both platforms, based on your current state: <StatusBar hidden={!!this.state.isModalShown} />


            This will simply hide the status bar whenever your modal is opened.






            share|improve this answer





















            • I should try on the standalone app. True. On another hand, I don't want to hide the StatusBar, I just want to change the font-color to #000 and the background color to #FFF
              – Broda Noel
              Nov 24 at 23:17










            • For your first question, after checking their implementation, I believe it's related to the iOS "presentationStyle" property
              – Arnaud
              Nov 24 at 23:28
















            0















            1. I believe you need to try the app as a standalone application, not using the Expo client. It somehow sometimes has hard time dealing with StatusBar (I've already experienced it too).

            2. You may use the hidden property that is working on both platforms, based on your current state: <StatusBar hidden={!!this.state.isModalShown} />


            This will simply hide the status bar whenever your modal is opened.






            share|improve this answer





















            • I should try on the standalone app. True. On another hand, I don't want to hide the StatusBar, I just want to change the font-color to #000 and the background color to #FFF
              – Broda Noel
              Nov 24 at 23:17










            • For your first question, after checking their implementation, I believe it's related to the iOS "presentationStyle" property
              – Arnaud
              Nov 24 at 23:28














            0












            0








            0







            1. I believe you need to try the app as a standalone application, not using the Expo client. It somehow sometimes has hard time dealing with StatusBar (I've already experienced it too).

            2. You may use the hidden property that is working on both platforms, based on your current state: <StatusBar hidden={!!this.state.isModalShown} />


            This will simply hide the status bar whenever your modal is opened.






            share|improve this answer













            1. I believe you need to try the app as a standalone application, not using the Expo client. It somehow sometimes has hard time dealing with StatusBar (I've already experienced it too).

            2. You may use the hidden property that is working on both platforms, based on your current state: <StatusBar hidden={!!this.state.isModalShown} />


            This will simply hide the status bar whenever your modal is opened.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 24 at 23:11









            Arnaud

            219110




            219110












            • I should try on the standalone app. True. On another hand, I don't want to hide the StatusBar, I just want to change the font-color to #000 and the background color to #FFF
              – Broda Noel
              Nov 24 at 23:17










            • For your first question, after checking their implementation, I believe it's related to the iOS "presentationStyle" property
              – Arnaud
              Nov 24 at 23:28


















            • I should try on the standalone app. True. On another hand, I don't want to hide the StatusBar, I just want to change the font-color to #000 and the background color to #FFF
              – Broda Noel
              Nov 24 at 23:17










            • For your first question, after checking their implementation, I believe it's related to the iOS "presentationStyle" property
              – Arnaud
              Nov 24 at 23:28
















            I should try on the standalone app. True. On another hand, I don't want to hide the StatusBar, I just want to change the font-color to #000 and the background color to #FFF
            – Broda Noel
            Nov 24 at 23:17




            I should try on the standalone app. True. On another hand, I don't want to hide the StatusBar, I just want to change the font-color to #000 and the background color to #FFF
            – Broda Noel
            Nov 24 at 23:17












            For your first question, after checking their implementation, I believe it's related to the iOS "presentationStyle" property
            – Arnaud
            Nov 24 at 23:28




            For your first question, after checking their implementation, I believe it's related to the iOS "presentationStyle" property
            – Arnaud
            Nov 24 at 23:28













            0














            Set the barStyle to be the contrasting backgroundColor.



            Black writing on white background, so have dark-content on white status bar.



            <StatusBar barStyle="dark-content" backgroundColor={"#fff"} />





            share|improve this answer


























              0














              Set the barStyle to be the contrasting backgroundColor.



              Black writing on white background, so have dark-content on white status bar.



              <StatusBar barStyle="dark-content" backgroundColor={"#fff"} />





              share|improve this answer
























                0












                0








                0






                Set the barStyle to be the contrasting backgroundColor.



                Black writing on white background, so have dark-content on white status bar.



                <StatusBar barStyle="dark-content" backgroundColor={"#fff"} />





                share|improve this answer












                Set the barStyle to be the contrasting backgroundColor.



                Black writing on white background, so have dark-content on white status bar.



                <StatusBar barStyle="dark-content" backgroundColor={"#fff"} />






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Dec 1 at 2:36









                CodeYute

                214




                214






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53437241%2freact-native-modal-is-not-drawn-below-the-statusbar-on-android%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    What visual should I use to simply compare current year value vs last year in Power BI desktop

                    How to ignore python UserWarning in pytest?

                    Alexandru Averescu