react native:andorid给iOS的navi多出20像素左右

前端之家收集整理的这篇文章主要介绍了react native:andorid给iOS的navi多出20像素左右前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

react native:andorid给iOS的navi多出20像素左右

头部发白了


安卓普遍的navi头都多出来一点,就是statebar多了20像素,一个沉浸式的问题,暂时这样处理,这样iOS和安卓大体就差不多了



package com.qinggu.damai;

import android.view.View;

import com.facebook.react.ReactActivity;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.imagepicker.ImagePickerPackage;

import java.util.Arrays;
import java.util.List;

public class MainActivity extends ReactActivity {
    /**
     * 沉浸式问题处理
     */
    void stateBartoDo() {
        getWindow().getDecorView().setsystemUIVisibility(View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
    }

    /**
     * Returns the name of the main component registered from JavaScript.
     * This is used to schedule rendering of the component.
     */
    @Override
    protected String getMainComponentName() {
        stateBartoDo();
        return "JdApp";
    }

    /**
     * Returns whether dev mode should be enabled.
     * This enables e.g. the dev menu.
     */
    @Override
    protected boolean getUseDeveloperSupport() {
        return BuildConfig.DEBUG;
    }

    /**
     * A list of packages used by the app. If the app uses additional views
     * or modules besides the default ones,add more packages here.
     */
    @Override
    protected List<ReactPackage> getPackages() {
        return Arrays.<ReactPackage>asList(
                new MainReactPackage(),new ImagePickerPackage()
        );
    }
}

猜你在找的React相关文章