Skip to content
This repository was archived by the owner on Oct 7, 2021. It is now read-only.

Commit 92a46df

Browse files
committed
handle resizeMode
1 parent cf4c087 commit 92a46df

7 files changed

Lines changed: 96 additions & 91 deletions

File tree

src/modules/setSplashScreen/ios/service.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,22 @@ import { getIosPackageName } from '../../../utils';
1010
export const addIosSplashScreen = async (
1111
imageSource: string,
1212
backgroundColor: string,
13-
resizeMode?: EResizeMode
13+
resizeMode: EResizeMode
1414
) => {
1515
try {
1616
const iosSplashImageFolder = addIosImageSetContents('SplashImage', EImageSetType.IMAGE);
1717
await generateIosSplashImages(imageSource, iosSplashImageFolder);
18-
setBackgroundColorToStoryBoard(backgroundColor);
18+
generateStoryboardFile(backgroundColor, resizeMode);
1919
setNewSplashScreenFileRefInInfoPlist();
2020
} catch (err) {
2121
console.log(err);
2222
}
2323
};
2424

25-
const setBackgroundColorToStoryBoard = (backgroundColor: string) => {
25+
const generateStoryboardFile = (backgroundColor: string, resizeMode: EResizeMode) => {
2626
const { red, green, blue, alpha } = getNormalizedRGBAColors(backgroundColor);
2727
replaceInFile(
28-
join(__dirname, `../../../../templates/ios/SplashScreen.storyboard`),
28+
join(__dirname, `../../../../templates/ios/SplashScreen.${resizeMode}.storyboard`),
2929
`./ios/${config.iosStoryboardName}.storyboard`,
3030
[
3131
{

templates/ios/LaunchScreen.center.xib

Lines changed: 0 additions & 27 deletions
This file was deleted.

templates/ios/LaunchScreen.contain.xib

Lines changed: 0 additions & 29 deletions
This file was deleted.

templates/ios/LaunchScreen.cover.xib

Lines changed: 0 additions & 31 deletions
This file was deleted.
File renamed without changes.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15705" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
3+
<device id="retina6_1" orientation="portrait" appearance="light"/>
4+
<dependencies>
5+
<deployment identifier="iOS"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/>
7+
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
8+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
9+
</dependencies>
10+
<scenes>
11+
<!--View Controller-->
12+
<scene sceneID="EHf-IW-A2E">
13+
<objects>
14+
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
15+
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
16+
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
17+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
18+
<subviews>
19+
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="obG-Y5-kRd">
20+
<rect key="frame" x="207" y="876" width="0.0" height="0.0"/>
21+
<fontDescription key="fontDescription" type="system" pointSize="17"/>
22+
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
23+
<nil key="highlightedColor"/>
24+
</label>
25+
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="SplashImage" translatesAutoresizingMaskIntoConstraints="NO" id="RL8-Sx-rSy">
26+
<rect key="frame" x="0" y="0" />
27+
</imageView>
28+
</subviews>
29+
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
30+
<constraints>
31+
<constraint firstItem="RL8-Sx-rSy" firstAttribute="top" secondItem="Bcu-3y-fUS" secondAttribute="top" id="AxW-a9-z2S"/>
32+
<constraint firstItem="Bcu-3y-fUS" firstAttribute="bottom" secondItem="RL8-Sx-rSy" secondAttribute="bottom" id="RfO-Bn-vEU"/>
33+
<constraint firstItem="Bcu-3y-fUS" firstAttribute="trailing" secondItem="RL8-Sx-rSy" secondAttribute="trailing" id="hHC-9d-4Ps"/>
34+
<constraint firstItem="RL8-Sx-rSy" firstAttribute="leading" secondItem="Bcu-3y-fUS" secondAttribute="leading" id="mga-C0-hVM"/>
35+
</constraints>
36+
<viewLayoutGuide key="safeArea" id="Bcu-3y-fUS"/>
37+
</view>
38+
</viewController>
39+
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
40+
</objects>
41+
<point key="canvasLocation" x="53" y="375"/>
42+
</scene>
43+
</scenes>
44+
<resources>
45+
<image name="SplashImage" width="896" height="896"/>
46+
</resources>
47+
</document>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15705" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
3+
<device id="retina6_1" orientation="portrait" appearance="light"/>
4+
<dependencies>
5+
<deployment identifier="iOS"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/>
7+
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
8+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
9+
</dependencies>
10+
<scenes>
11+
<!--View Controller-->
12+
<scene sceneID="EHf-IW-A2E">
13+
<objects>
14+
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
15+
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
16+
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
17+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
18+
<subviews>
19+
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="obG-Y5-kRd">
20+
<rect key="frame" x="207" y="876" width="0.0" height="0.0"/>
21+
<fontDescription key="fontDescription" type="system" pointSize="17"/>
22+
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
23+
<nil key="highlightedColor"/>
24+
</label>
25+
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="SplashImage" translatesAutoresizingMaskIntoConstraints="NO" id="RL8-Sx-rSy">
26+
<rect key="frame" x="0" y="0" width="100%" height="100%"/>
27+
</imageView>
28+
</subviews>
29+
<color key="backgroundColor" red="1" green="1" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
30+
<constraints>
31+
<constraint firstItem="RL8-Sx-rSy" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="07j-vS-pLh"/>
32+
<constraint firstItem="RL8-Sx-rSy" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="sUH-2V-BCR"/>
33+
</constraints>
34+
<viewLayoutGuide key="safeArea" id="Bcu-3y-fUS"/>
35+
</view>
36+
</viewController>
37+
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
38+
</objects>
39+
<point key="canvasLocation" x="53" y="375"/>
40+
</scene>
41+
</scenes>
42+
<resources>
43+
<image name="SplashImage" width="896" height="896"/>
44+
</resources>
45+
</document>

0 commit comments

Comments
 (0)