Skip to content

Instantly share code, notes, and snippets.

@josenaves
Created February 12, 2017 21:00
Show Gist options
  • Save josenaves/0a1c95b3464b2b2f708357d763c89c9e to your computer and use it in GitHub Desktop.
Save josenaves/0a1c95b3464b2b2f708357d763c89c9e to your computer and use it in GitHub Desktop.
Module example
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View
} from 'react-native';
import * as lib from './src/temp.js';
export default class TempProject extends Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome to React Native!!!!!!!!
</Text>
<Text style={styles.instructions}>
To get started, edit index.android.js
</Text>
<Text style={styles.instructions}>
Double tap R on your keyboard to reload,{'\n'}
Shake or press menu button for dev menu{'\n'}
Message from file: {lib.message}
</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});
AppRegistry.registerComponent('TempProject', () => TempProject);
// put this file in src/temp.js
export const message = 'Hello from file';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment