对于iOS:Dimensions.get('window')。height = 0
但是Dimensions.get('screen')。height =某物
为什么可以?
console.log('DIMENSIONS', Dimensions.get('window'), Dimensions.get('screen'));
// logs
window = {fontScale: 1, height: 0, width: 0, scale: 2}
screen = {fontScale: 1, height: 896, width: 414, scale: 2}
已修复。 RNSplashScreen在AppDelegate.m
中存在问题。
https://github.com/crazycodeboy/react-native-splash-screen#third-stepplugin-configuration
问题代码:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[RNSplashScreen show]; // here
// ...other code
return YES;
}
工作:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// ...other code
[RNSplashScreen show]; // here
// or
//[RNSplashScreen showSplash:@"LaunchScreen" inRootView:rootView];
return YES;
}