microsoft/vscode-react-native

Public

mirrored fromhttps://github.com/microsoft/vscode-react-nativeAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
c8ff508e5391b3583d7ab78a4ad2b6c66fffa16b

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

SampleApplication/index.android.js

71lines · modecode

1'use strict';
2import React, {
3 AppRegistry,
4 Component,
5 StyleSheet,
6 Text,
7 View,
8 TouchableNativeFeedback,
9 Alert
10} from 'react-native';
11
12// import {SampleApplication} from './sampleApplication';
13
14class SampleApplication extends Component {
15 showMessage() {
16 Alert.alert(
17 'Alert Title',
18 'You pressed a button',
19 [
20 {text: 'Ask me later', onPress: () =>
21 console.log('Ask me later pressed')},
22 {text: 'Cancel', onPress: () =>
23 console.log('Cancel Pressed'), style: 'cancel'},
24 {text: 'OK', onPress: () =>
25 console.log('OK Pressed')},
26 ]);
27 }
28
29 render() {
30 return (
31 <View style={styles.container}>
32 <Text style={styles.welcome}>
33 Welcome to React Native!
34 </Text>
35 <Text style={styles.instructions}>
36 To get started, edit index.android.js
37 </Text>
38 <Text style={styles.instructions}>
39 Shake or press menu button for dev menu
40 </Text>
41 <TouchableNativeFeedback onPress={() => this.showMessage()}>
42 <View>
43 <Text>Toggle</Text>
44 </View>
45 </TouchableNativeFeedback>
46 </View>
47 );
48 }
49}
50
51
52const styles = StyleSheet.create({
53 container: {
54 flex: 1,
55 justifyContent: 'center',
56 alignItems: 'center',
57 backgroundColor: '#F5FCFF',
58 },
59 welcome: {
60 fontSize: 20,
61 textAlign: 'center',
62 margin: 10,
63 },
64 instructions: {
65 textAlign: 'center',
66 color: '#333333',
67 marginBottom: 5,
68 },
69});
70
71AppRegistry.registerComponent('SampleApplication', () => SampleApplication);
72