'Why is the Safe Area in React PWA is always 0px?

Hi I'am building a PWA with react and I've been trying to add a padding to my Footer to avoid the safe area, but for some reason it's always 0px;

I have these tags in HTML:

<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
<meta name="mobile-web-app-capable" content="yes">

And I'm trying to set the CSS like this for my footer:

padding-bottom: env(safe-area-inset-bottom);

It's always 0px!



Solution 1:[1]

The best way for doing this is, firstly you must create your own function for getting this field (FIYNUM_0) value by using PERIOD table primary key id field, and on this function, we will be controlling the existing column FIYNUM_0. If a column exists we return this field value from PERIOD table by using the input parameter as id field. Else we will return ''. For Example:

Create function GET_FIYNUM_0 
(
    @table_id integer
)  
returns 
    varchar(200)  
begin  
  declare 
  @pdata varchar(200)
  
    IF (exists(select tbl.object_id 
               from sys.columns col 
               inner join sys.tables tbl on tbl.object_id = col.object_id 
               where col.name = 'FIYNUM_0' and tbl.name = 'PERIOD')) 
    begin 
            SELECT @pdata = FIYNUM_0 from TEST_DB.dbo.PERIOD where id = @table_id
    end else 
    begin 
            SET @pdata = ''
    end
    
    RETURN @pdata
end

But after then, we can create our view very-very easily. Example:

CREATE VIEW PERIOD_FCY
AS
SELECT   
    dbo.GET_FIYNUM_0(PER.ID) as MYFIELD
from 
    TEST_DB.dbo.PERIOD PER

This GET_FIYNUM_0(PER.ID) will return FIYNUM_0 field value when if this column exists, but in else will be return empty string.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ramin Faracov