npm i react-native-statusbar-props
react-native link react-native-statusbar-props
include ":react-native-statusbar-props"
project(":react-native-statusbar-props").projectDir = new File(rootProject.projectDir,"../node_modules/react-native-statusbar-props/android")
dependencies {
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
compile project(":react-native-statusbar-props")<---添加这一行
}
import com.statusbar.props.RCTStatusbarPropsPackage;
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new RCTStatusbarPropsPackage()<-----添加这一行
);
}
获取状态栏高度
import statusbarprops from 'react-native-statusbar-props';
console.log(statusbarprops.height)
https://github.com/gaokaikai/react-native-statusbar-props
留个❤️可好
https://github.com/gaokaikai/react-native-statusbar-props/issues