Skip to content

Commit 468afb8

Browse files
authored
Merge pull request #21 from FiW/master
iOS: set contentMode to ScaleAspectFit
2 parents f87cbb8 + 2466d7c commit 468afb8

File tree

4 files changed

+11
-14
lines changed

4 files changed

+11
-14
lines changed

android/src/main/java/com/reactnativecomponent/splashscreen/RCTSplashScreen.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ protected static Activity getActivity() {
3232
}
3333

3434
public static void openSplashScreen(Activity activity) {
35-
openSplashScreen(activity, false, ImageView.ScaleType.FIT_XY);
35+
openSplashScreen(activity, false);
36+
}
37+
38+
public static void openSplashScreen(Activity activity, boolean isFullScreen) {
39+
openSplashScreen(activity, isFullScreen, ImageView.ScaleType.CENTER_CROP);
3640
}
3741

3842
public static void openSplashScreen(final Activity activity, final boolean isFullScreen, final ImageView.ScaleType scaleType) {

ios/RCTSplashScreen/RCTSplashScreen/RCTSplashScreen.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ + (void)open:(RCTRootView *)v withImageNamed:(NSString *)imageName {
2323
UIImageView *view = [[UIImageView alloc]initWithFrame:[UIScreen mainScreen].bounds];
2424

2525
view.image = [UIImage imageNamed:imageName];
26-
26+
view.contentMode = UIViewContentModeScaleAspectFill;
27+
2728
[[NSNotificationCenter defaultCenter] removeObserver:rootView name:RCTContentDidAppearNotification object:rootView];
2829

2930
[rootView setLoadingView:view];

ios/SplashScreenResource/LaunchScreen.xib

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,9 @@
55
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
66
</dependencies>
77
<objects>
8-
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
9-
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
10-
<view contentMode="scaleToFill" id="iN0-l3-epB">
11-
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
12-
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
8+
<view contentMode="scaleAspectFill" id="iN0-l3-epB">
139
<subviews>
14-
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="splash.png" translatesAutoresizingMaskIntoConstraints="NO" id="ZkI-RL-69Z">
15-
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
10+
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" image="splash.png" translatesAutoresizingMaskIntoConstraints="NO" id="ZkI-RL-69Z">
1611
</imageView>
1712
</subviews>
1813
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
@@ -22,12 +17,9 @@
2217
<constraint firstAttribute="bottom" secondItem="ZkI-RL-69Z" secondAttribute="bottom" id="afY-hI-KgI"/>
2318
<constraint firstItem="ZkI-RL-69Z" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="eMX-qT-GeJ"/>
2419
</constraints>
25-
<nil key="simulatedStatusBarMetrics"/>
26-
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
27-
<point key="canvasLocation" x="548" y="455"/>
2820
</view>
2921
</objects>
3022
<resources>
31-
<image name="splash.png" width="720" height="1280"/>
23+
<image name="splash.png"/>
3224
</resources>
3325
</document>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"repository": {
1010
"type": "git",
11-
"url": "git+https://github.com/react-native-component/react-native-smart-splash-screen.git"
11+
"url": "git+https://github.com/FiW/react-native-smart-splash-screen.git"
1212
},
1313
"keywords": [
1414
"react-native",

0 commit comments

Comments
 (0)