microsoft/vscode-react-native
Publicmirrored fromhttps://github.com/microsoft/vscode-react-nativeAvailable
SampleApplication/index.ios.js
59lines · modecode
| 1 | /** |
| 2 | * Sample React Native App |
| 3 | * https://github.com/facebook/react-native |
| 4 | */ |
| 5 | 'use strict'; |
| 6 | import React, { |
| 7 | AppRegistry, |
| 8 | Component, |
| 9 | StyleSheet, |
| 10 | Text, |
| 11 | View, |
| 12 | TouchableHighlight |
| 13 | } from 'react-native'; |
| 14 | |
| 15 | class SampleApplication extends Component { |
| 16 | showMessage () { |
| 17 | alert("You pressed a button"); |
| 18 | } |
| 19 | render() { |
| 20 | return ( |
| 21 | <View style={styles.container}> |
| 22 | <Text style={styles.welcome}> |
| 23 | Welcome to React Native! |
| 24 | </Text> |
| 25 | <Text style={styles.instructions}> |
| 26 | To get started, edit index.ios.js |
| 27 | </Text> |
| 28 | <Text style={styles.instructions}> |
| 29 | Press Cmd+R to reload,{'\n'} |
| 30 | Cmd+D or shake for dev menu |
| 31 | </Text> |
| 32 | <TouchableHighlight onPress={() => this.showMessage()}> |
| 33 | <Text>Toggle</Text> |
| 34 | </TouchableHighlight> |
| 35 | </View> |
| 36 | ); |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | const styles = StyleSheet.create({ |
| 41 | container: { |
| 42 | flex: 1, |
| 43 | justifyContent: 'center', |
| 44 | alignItems: 'center', |
| 45 | backgroundColor: '#F5FCFF', |
| 46 | }, |
| 47 | welcome: { |
| 48 | fontSize: 20, |
| 49 | textAlign: 'center', |
| 50 | margin: 10, |
| 51 | }, |
| 52 | instructions: { |
| 53 | textAlign: 'center', |
| 54 | color: '#333333', |
| 55 | marginBottom: 5, |
| 56 | }, |
| 57 | }); |
| 58 | |
| 59 | AppRegistry.registerComponent('SampleApplication', () => SampleApplication); |
| 60 | |