Use React-native to make a simple application-03 Welcome interface

Source: Internet
Author: User

The welcome interface for Android and iOS is not the same, there is a default Welcome screen in iOS, and Android needs to write it yourself. So I'm going to say a few words about the welcome interface of these two platforms. Let's take a look at the implementation effect:

Android:

Ios:

First, the implementation of the iOS Welcome interface:

Its realization and react-native is not a half-penny relationship. You need to implement this interface in Xcode. That is, to design launchscreen.xib:

Because not the iOS developer, also not very understanding of iOS, so I drag and drop, and finally set the image to center on the line.

Second, the Android Welcome interface implementation

First, we create a welcomescreen.js file

Enter the code:

1' Use strict '2 3Import React from ' react-native '4 5 var {6 Image,7 StyleSheet,8 View,9 Animated,Ten Proptypes One} =React A  - class Welcomepage extends React.component { -    return ( the<view style={styles.container}> -<Animated.image -onloadend={() = { -Animated.timing ( This. _animatedvalue, { +tovalue:100, -duration:1000 + }). Start () A         }} atSource={{uri: ' Http://192.168.6.5:8888/getImage?imgName=welcome.jpg '}} style={[styles.img, {opacity: Interpolatedcoloranimation}]}/> -</View> -     ) -   } - } - varStyles =stylesheet.create ({ in container: { -Flex:1, toJustifycontent: ' Center ', +Alignitems: ' Center ', -BackgroundColor: ' #ffffff ' the   }, * img: { $Flex:1,Panax Notoginsengwidth:400, -height:200, theResizeMode: ' contain ' +   } A }) the  +Module.exports = Welcomepage

The Android Welcome screen with a fade-in effect is built. which uses the animated animation, if you do not understand the official documents can be viewed, here I recommend a good introduction react native animation URL: http://browniefed.com/ React-native-animation-book/index.html

Finally look at the running effect

iOS is just going to run right in Xcode.

Android needs to introduce this interface in the Index.android.js file, enter the command: "$react-native run-android", you can see the effect on the real machine or simulator

1 ' use strict '23var React = require (' react-native ')45  var welcomescreen = require ('./src/screens/welcomescreen ')6 React.AppRegistry.registerComponent (' Guokuapp ', () = Welcomescreen)

Use React-native to make a simple application-03 Welcome interface

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.