Skip to content

Instantly share code, notes, and snippets.

//
// SwiftAdvanceTests.swift
// SwiftAdvanceTests
//
// Created by wuufone on 2018/9/17.
// Copyright © 2018年 wuufone. All rights reserved.
//
import XCTest
@testable import SwiftAdvance
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View
} from 'react-native';
export default class HelloReactNativeDemo extends Component {
render() {
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
<View style={styles.container}>
</View>
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
}
<View style={{
backgroundColor: '#F5FCFF',
flex: 1,
justifyContent: 'center', // 垂直置中
alignItems: 'center' // 水平置中
}}>
<Text>
Welcome to React Native!
To get started, edit index.ios.js
Press Cmd+R to reload,
<View style={{backgroundColor: '#F5FCFF', flex: 1}}>
<Text>
Welcome to React Native!
To get started, edit index.ios.js
Press Cmd+R to reload,
Cmd+D or shake for dev menu
</Text>
</View>
<View style={{backgroundColor: '#F5FCFF'}}>
<Text>
Welcome to React Native!
To get started, edit index.ios.js
Press Cmd+R to reload,
Cmd+D or shake for dev menu
</Text>
</View>
<Text>
Welcome to React Native!
To get started, edit index.ios.js
Press Cmd+R to reload,
Cmd+D or shake for dev menu
</Text>
NSURL *jsCodeLocation;
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
moduleName:@"HelloReactNativeDemo"
initialProperties:nil
launchOptions:launchOptions];
rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
return YES;
}