Comments (9)
@KingAmo I suggest to uses transparent PNG. If you do that, no need to update the images if you want to change the splash screen background color! :)
For the guys you want a small tuto:
- Add an ImageView inside the .xib UIView using drag'n'drop
- Add constraints left: 0, right: 0, top: 0, bottom: 0 (you can include notch safe insets automatically)
- Enjoy image scaling setting 🤙
from react-native-bootsplash.
React Native should have a launch screen by default. To use a full screen image, you should refer to official documentation of apple xib stuff.
But since you didn't look there first, let me share one of my splashcreen I have under the hand :)
My splash screenscreen.png
, once added to the iOS project, has been added in Xcode by using the Interface Builder.
To add the image, just hit the button that look like an iPhone home button (sort of ([ ])
) in the top right corner of xcode
Then choose an image.
And apply the following constraints
(You can use the buttons in the bottom right corner)
Alternatively, you can adapt this .xib (xml) file :)
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view clipsSubviews="YES" contentMode="scaleToFill" id="mQO-OZ-GhJ">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="splashscreen.png" adjustsImageSizeForAccessibilityContentSizeCategory="YES" translatesAutoresizingMaskIntoConstraints="NO" id="5gn-MB-2H7">
<rect key="frame" x="-241" y="0.0" width="896" height="896"/>
<constraints>
<constraint firstAttribute="width" secondItem="5gn-MB-2H7" secondAttribute="height" multiplier="1:1" id="tBu-Bh-JPi"/>
</constraints>
</imageView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="5gn-MB-2H7" firstAttribute="firstBaseline" secondItem="mQO-OZ-GhJ" secondAttribute="firstBaseline" id="9CM-2N-kwV"/>
<constraint firstItem="5gn-MB-2H7" firstAttribute="centerY" secondItem="mQO-OZ-GhJ" secondAttribute="centerY" id="UIg-jf-rVl"/>
<constraint firstItem="5gn-MB-2H7" firstAttribute="centerX" secondItem="mQO-OZ-GhJ" secondAttribute="centerX" id="VqM-5Z-wCO"/>
<constraint firstAttribute="baseline" secondItem="5gn-MB-2H7" secondAttribute="baseline" id="g37-ya-jJo"/>
</constraints>
<point key="canvasLocation" x="137.68115942028987" y="142.63392857142856"/>
</view>
</objects>
<resources>
<image name="splashscreen.png" width="2048" height="2048"/>
</resources>
</document>
Hope this helped (I should write a blog post about that & add link to it in the readme...)
from react-native-bootsplash.
how can i do it for android??
from react-native-bootsplash.
@MoOx thanks a lot~ but it seems that your code displays an icon in the center of the screen. anyway,i got it how to set a full screen image in LaunchScreen.xib
file , thanks
from react-native-bootsplash.
@KingAmo what was the size of your png? In my example, my image was 2048 x 2048 (so a big splash screen)
from react-native-bootsplash.
@MoOx here it is ,there are three different size which is in Images.xcassets
, not a square image
from react-native-bootsplash.
Oh yeah so that's not a square single PNG. Yeah so constraints must be different I guess.
from react-native-bootsplash.
@zoontek your solution perfect!
from react-native-bootsplash.
@zoontek
Thanks, this really helpful
from react-native-bootsplash.
Related Issues (20)
- Background image and linear gradient baackground color
- Splash Screen Reappears During Screen Transitions on Android HOT 10
- Crash on Android <= 9 - Attempt to invoke virtual method Drawable.isProjected() on a null object reference - solved in 5.1.2 HOT 2
- Bug when assembleeRelease HOT 1
- iOS error during debug scheme starting HOT 2
- How can i show code push progress bar in splash screen? HOT 1
- Output/Document need to manually create missing images HOT 1
- Default Android system splashscreen appears before my custom splashscreen HOT 1
- Add option to use system scheme instead of scheme returned by useColorScheme in useHideAnimation HOT 6
- 我在屏幕中间放一个logo,我还需要在屏幕底部放些文字,要怎么做呢?
- Add plugin for nx HOT 1
- splash icon disappeared in android HOT 3
- Adding android:windowBackground causes it to appear after original splash hides HOT 3
- Generated background has incorrect color HOT 6
- Generate splashscreen HOT 1
- iOS: building failed with RN 0.73 and new arch enabled HOT 3
- RN 0.74 - How to avoid `createRootViewWithBridge` HOT 1
- Small icon size on Samsung devices with Android 12 HOT 3
- Expo config plugin overrides AppDelegate imports from other plugins HOT 8
- circle in the center at the beginning of the splash screen display (android) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-bootsplash.