Download - React Native Internals
import React, { Component,} from 'react';
import { AppRegistry, Text,} from 'react-native';
class SampleApp extends Component { render() { return ( <Text style={{ margin: 40 }}> Hello, World! </Text> ); }}
AppRegistry.registerComponent('SampleApp', () => SampleApp);
@tadeuzagallo #reactamsterdam
@implementation MyNativeModule
+ (NSString *)moduleName { return @""; }+ (void)load { RCTRegisterModule(self); }
@end
@tadeuzagallo #reactamsterdam
{ "remoteModuleConfig":[ // [ $moduleName, $exportedConstants:{}? $methods:[]?, $asyncIndexes:[]? ] ["RCTStatusBarManager",["getHeight","setStyle","setHidden","setNetworkActivityIndicatorVisible"]], ["RCTSourceCode",{"scriptURL":"http:\/\/localhost:8081\/index.ios.bundle?platform=ios&dev=true"},["getScriptText"],[0]], ["RCTAlertManager",["alertWithArgs"]], ["RCTExceptionsManager",["reportSoftException","reportFatalException","updateExceptionMessage","reportUnhandledException"]], // ... ]}
@tadeuzagallo #reactamsterdam
// import React, {// Component,// } from 'react';//// import {// AppRegistry,// Text, TouchableHighlight,// } from 'react-native';//// class SampleApp extends Component { onPress() { alert('Hello, World!'); }// render() {// return ( <TouchableHighlight style={{ margin: 40 }} onPress={this.onPress}> <Text> Button </Text> </TouchableHighlight>;// );// }// }//// AppRegistry.registerComponent('SampleApp', () => SampleApp);
@tadeuzagallo #reactamsterdam
class SampleApp extends Component { onPress() {-> alert('Hello, World!'); } ... }
@tadeuzagallo #reactamsterdam
if (Platform.OS === 'ios') { AlertIOS.alert(title, message, buttons);} else if (Platform.OS === 'android') { AlertAndroid.alert(title, message, buttons);}
@tadeuzagallo #reactamsterdam
// import React, {// Component,// } from 'react';//// import {// AppRegistry,// Text,// TouchableHighlight,// } from 'react-native';//// class SampleApp extends Component {// onPress() { Alert.alert('Hello, World!', 'Press ok to alert again', [ { text: 'Ok', onPress() { alert('Ok!') } }, { text: 'Cancel', onPress() { alert('Cancel') } }, ]);// }// render() {// return (// <TouchableHighlight style={{ margin: 40 }} onPress={this.onPress}>// <Text>// Button// </Text>// </TouchableHighlight>;// );// }// }//// AppRegistry.registerComponent('SampleApp', () => SampleApp);
@tadeuzagallo #reactamsterdam