Skip to content

Instantly share code, notes, and snippets.

View galihlprakoso's full-sized avatar
⌨️
Software Engineer -- On a mission to make tech work for everyone.

Galih Laras Prakoso galihlprakoso

⌨️
Software Engineer -- On a mission to make tech work for everyone.
View GitHub Profile
package galihlprakoso.com.solidprinciple;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author galihlarasprakoso
*/
interface PekerjaBangunan {
const http = require('http');
const hostname = '127.0.0.1';
const port = 3000;
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Hello World\n');
});
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
export default class App extends React.Component {
render() {
return (
<View style={styles.container}>
<Text>Hello World!</Text>
</View>
);
<Image source={pic} style={{width: 193, height: 110}}/>
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
//Custom Component bernama Pahlawaan
class Pahlawan extends React.Component {
render(){
return (
<View>
{/* Menampilkan props 'nama' yang dikirimkan oleh Parentnya. */}
<Text>{this.props.nama}</Text>
class Pahlawan extends React.Component {
state = { tampil:true };//Menginisialisasi state tampil=true sebagai nilai awal
componentDidMount(){
setInterval(() => ( //Berfungsi untuk memanggil fungsi secara berulang-ulang
this.setState({ tampil: !this.state.tampil })//Mengubah state menjadi nilai inversnya
), 1000);//Delay dalam miliseconds 1000ms = 1 detik.
}
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
//Custom Component bernama Pahlawaan
class Pahlawan extends React.Component {
state = { tampil:true };//Menginisialisasi state tampil=true sebagai nilai awal
componentDidMount(){
setInterval(() => ( //Berfungsi untuk memanggil fungsi secara berulang-ulang
const styles = StyleSheet.create({
container: {
flex: 1,
flexDirection:'row',// <-- 1
alignItems: 'center',// <-- 2
justifyContent: 'center',// <-- 3
backgroundColor: '#fff'
},
namaPahlawan:{
color:'red',
import React from 'react';
//Mengimport TextInput, FlatList, TouchableHighlight, KeyboardAvoidingView
import { StyleSheet,Text, View, TextInput,
FlatList, TouchableHighlight, KeyboardAvoidingView } from 'react-native';
class Pahlawan extends React.Component {
//Hapus inisialisasi state dan kode untuk membuat teks tidak berkedip lagi
render(){
"ios": {
"supportsTablet": true,
"bundleIdentifier": "galihlprakoso.com.reactnativedasar"
},
"android": {
"package": "galihlprakoso.com.reactnativedasar"
}