Skip to content

Instantly share code, notes, and snippets.

View m4har's full-sized avatar
💭
i like food

Mahardika m4har

💭
i like food
View GitHub Profile
@m4har
m4har / index.js
Created May 15, 2019 14:57
component Loading Indicator
// src/components/Loading/index.js
import React from "react";
import { ActivityIndicator, Platform } from "react-native";
import Modal from "../Modal";
const Loading = ({ onDismiss, visible, onRequestClose }) => (
<Modal
visible={visible}
@m4har
m4har / index.js
Last active May 15, 2019 14:56
component Modal / Popup
// src/components/Modal/index.js
import React from "react";
import { Modal, View } from "react-native";
const ModalView = ({ visible, onDismiss, children, onRequestClose }) => (
<Modal
visible={visible}
onDismiss={onDismiss}
transparent
@m4har
m4har / index.js
Created May 15, 2019 14:47
component Gradient View
// src/components/Gradient/index.js
// contoh disini dengan gambar
import React from "react";
import { ImageBackground, StatusBar } from "react-native";
const Gradient = ({ children, style }) => (
<ImageBackground
source={require("../../assets/img/bg.png")}
style={style}
@m4har
m4har / index.js
Created May 15, 2019 14:45
component formInput
// src/components/FormInput/index.js
import React from "react";
import { TextInput, View } from "react-native";
const FormInput = ({ secureTextEntry, ...props }) => (
<View style={styles.container}>
<TextInput
style={styles.textInput}
secureTextEntry={secureTextEntry}
@m4har
m4har / index.js
Last active May 15, 2019 14:39
component button
// src/components/Button/index.js
import React from "react";
import { TouchableOpacity, Text } from "react-native";
const Button = ({ onPress, style, title, ...props }) => (
<TouchableOpacity
{...props}
onPress={onPress}
style={[styles.container, style]}
>