Skip to content

Instantly share code, notes, and snippets.

@roeib
roeib / FlatList.js
Last active April 28, 2019 18:48
FlatList React Native
import React, { Component } from "react";
import { View, Text, FlatList } from "react-native";
class FlatListDemo extends Component {
constructor(props) {
super(props);
this.state = {
loading: false,
data: [],
@roeib
roeib / app.js
Last active May 6, 2019 08:31
splash screen app.js
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
*/
import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View} from 'react-native';
<TextInput
style={{height: 40, borderColor: 'gray', borderWidth: 1}}
placeholder="Email"
maxLength={40}
keyboardType="email-address"
underlineColorAndroid='transparent'
/>
@roeib
roeib / inputs.js
Last active May 15, 2019 06:44
text input
import React, { Component } from "react";
import {
View,
TextInput,
} from "react-native";
export default class Inputs extends Component {
constructor(props) {
super(props);
this.state = {
import React, { Component } from 'react';
import {
StyleSheet,
Text,
View,
TextInput,
TouchableHighlight,
} from 'react-native';
export default class LoginView extends Component {
import React, { useState } from 'react';
const Counter = () => {
// Declare a new state variable, which we'll call "count"
const [count, setCount] = useState(0);
return (
<div>
<p>You clicked {count} times</p>
<button onClick={() => setCount(count + 1)}>
const [count, setCount] = useState(0);
import React, { useState } from 'react';
class Example extends React.Component {
constructor(props) {
super(props);
this.state = {
count: 0
};
}
componentDidMount() {
document.title = `You clicked ${this.state.count} times`;
import React, { useState, useEffect } from 'react';
function Example() {
const [count, setCount] = useState(0);
useEffect(() => {
document.title = `You clicked ${count} times`;
});
return (