microsoft/vscode-react-native

Public

mirrored from https://github.com/microsoft/vscode-react-nativeAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
add-vsix-test-case

Branches

Tags

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

Clone

HTTPS

Download ZIP

SampleApplication/index.android.js

71lines · modeblame

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