Skip to content

Instantly share code, notes, and snippets.

View Ansonmathew's full-sized avatar

Anson Mathew Ansonmathew

View GitHub Profile
import React, { useState } from "react";
import { Modal, StyleSheet, Text, TouchableOpacity, View } from "react-native";
const export default App = () => {
const [modalVisible, setModalVisible] = useState(false);
return (
<View style={styles.centeredView}>
<Modal animationType= "fade"
transparent= {true}
visible= {modalVisible}>
import React, { useEffect, useState } from 'react';
import { Platform, StyleSheet, View, TextInput, TouchableOpacity, Alert, Text } from 'react-native';
export default function UselessTextInput() {
const [value, onChangeText] = React.useState(null);
checkSwitch = () => {
if (value == '1') {
this.ONE();
import React, { useEffect, useState } from 'react';
import { Platform, StyleSheet, View, TextInput, TouchableOpacity, Alert, Text } from 'react-native';
export default function UselessTextInput() {
const [value, onChangeText] = React.useState(null);
checkSwitch = () => {
switch(value) {
case '1':
import React, { useState, useEffect } from "react";
import { StyleSheet, Text, TouchableOpacity, View } from "react-native";
export default App = () => {
const [count, setCount] = useState(0);
const [result_add, add] = useState(0);
const [result_substraction, substraction] = useState(0);
const [operattion, setOperattion] = useState(null);
const onAddCount= () => {
@Ansonmathew
Ansonmathew / app.js
Created July 6, 2020 15:51
React Native Flatlist
import React, {useState, useEffect, useRef} from 'react';
import { View, Text, FlatList, Image } from 'react-native';
const ITEM_HEIGHT = 70;
const itemList = [
{id: '1', name: 'Kepa Arrizabalaga', country: 'Spain', image: 'https://resources.premierleague.com/premierleague/photos/players/250x250/p109745.png'},
{id: '2', name: 'Antonio Rüdiger', country: 'Germany', image: 'https://resources.premierleague.com/premierleague/photos/players/110x140/p102380.png'},
{id: '3', name: 'Marcos Alonso', country: 'Spain', image: 'https://resources.premierleague.com/premierleague/photos/players/250x250/p82263.png'},
{id: '4', name: 'Andreas Christensen', country: 'Denmark', image: 'https://resources.premierleague.com/premierleague/photos/players/250x250/p135363.png'},
@Ansonmathew
Ansonmathew / app.js
Created July 6, 2020 15:51
React Native Flatlist
import React, {useState, useEffect, useRef} from 'react';
import { View, Text, FlatList, Image } from 'react-native';
const ITEM_HEIGHT = 70;
const itemList = [
{id: '1', name: 'Kepa Arrizabalaga', country: 'Spain', image: 'https://resources.premierleague.com/premierleague/photos/players/250x250/p109745.png'},
{id: '2', name: 'Antonio Rüdiger', country: 'Germany', image: 'https://resources.premierleague.com/premierleague/photos/players/110x140/p102380.png'},
{id: '3', name: 'Marcos Alonso', country: 'Spain', image: 'https://resources.premierleague.com/premierleague/photos/players/250x250/p82263.png'},
{id: '4', name: 'Andreas Christensen', country: 'Denmark', image: 'https://resources.premierleague.com/premierleague/photos/players/250x250/p135363.png'},
@Ansonmathew
Ansonmathew / App.js
Created July 6, 2020 11:40
React Native Switch
import React, {useState} from 'react';
import { StyleSheet, Text, View, Switch } from 'react-native';
export default function App () {
const [switchValue, setSwitchValue] = useState(false);
return (
<View style={styles.container}>
<Text style={styles.textStyle}>Switch Example</Text>
<Text style={styles.textStyle}>{switchValue ? 'on' :'off'}</Text>
@Ansonmathew
Ansonmathew / app.js
Created July 6, 2020 11:27
Modal Example
import React, {useState} from 'react';
import { StyleSheet, Text, View, Button, Modal } from 'react-native';
export default function App () {
const [showModal, setModalStatus] = useState(false);
return (
<View style = {styles.container}>
<Modal
animationType = {"fade"}
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
*/
import React, { Component } from "react";
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
*/
import React, { Component } from 'react';