Skip to content

Instantly share code, notes, and snippets.

View viniciusdacal's full-sized avatar

Vinicius Dacal viniciusdacal

View GitHub Profile
import React, { Component } from 'react';
import { View } from 'react-native';
const FixedDimensionsBasics = () => (
<View>
<View style={{ width: 50, height: 50, backgroundColor: 'powderblue' }} />
<View style={{ width: 100, height: 100, backgroundColor: 'skyblue' }} />
<View style={{ width: 150, height: 150, backgroundColor: 'steelblue' }} />
</View>
);
import React, { Component } from 'react';
import { Text } from 'react-native';
const HelloWorld = () => (
<Text>Hello world!</Text>
);
import React, { Component } from 'react';
import { View } from 'react-native';
const FlexDirectionBasics = () => (
<View style={{ flex: 1, flexDirection: 'row' }}>
<View style={{ width: 50, height: 50, backgroundColor: 'powderblue' }} />
<View style={{ width: 50, height: 50, backgroundColor: 'skyblue' }} />
<View style={{ width: 50, height: 50, backgroundColor: 'steelblue' }} />
</View>
);
import React, { Component } from 'react';
import { AppRegistry, Text } from 'react-native';
import HelloWorld from './HelloWorld';
AppRegistry.registerComponent('HelloWorldApp', () => HelloWorld);
import React from 'react';
import { Text, TouchableHighlight } from 'react-native';
class MyButton extends Component {
_onPressButton() {
console.log('You tapped the button!');
}
render() {
return (
import React, { Component } from 'react';
import { TextInput } from 'react-native';
class UselessTextInput extends Component {
constructor(props) {
super(props);
this.state = { text: 'Useless Placeholder' };
}
render() {
import React from 'react';
import ReactDom from 'react-dom';
const Button = ({ children, type = 'button' }) => (
<button type={type} className='btn'>
{children}
</button>
);
ReactDOM.render(
import React from 'react';
import Button from './Button'
const GroupButton = ({ children}) => (
<div className='btn-group'>
{children}
</div>
);
ReactDOM.render(
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<title>React App</title>
</head>
<body>
<div id="root"></div>
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
class App extends Component {
render() {
return (
<div className="App">
<div className="App-header">
<img src={logo} className="App-logo" alt="logo" />