Skip to content

Instantly share code, notes, and snippets.

View khalid32's full-sized avatar
🤩
enthusiastic

Khalid Syfullah Zaman khalid32

🤩
enthusiastic
View GitHub Profile
@khalid32
khalid32 / StackNavigator Tutorial
Last active June 24, 2017 13:55
new native based react-navigation component for smooth navigation....
import React, { Component } from 'react';
import { AppRegistry, StyleSheet, Text, View, Button } from 'react-native';
import { StackNavigator } from 'react-navigation';
class HomeScreen extends React.Component {
static navigationOptions = {
title: 'Welcome',
};
render() {
@khalid32
khalid32 / TabNavigator Tutorial
Last active June 19, 2017 18:34
new native based react-navigation component for smooth navigation....
import React, { Component } from 'react';
import { AppRegistry, StyleSheet, Text, View, Button } from 'react-native';
import { TabNavigator } from 'react-navigation';
class HomeScreen extends React.Component {
render() {
return (
<View style={styles.container}>
<View style={[styles.adjust, {flex: 2, backgroundColor: '#68bc43'}]}>
@khalid32
khalid32 / Callback Function
Created June 20, 2017 05:12
An example which shows how to write a callback function and a callback-accepting function..
// Create a function that accepts another function as an argument
const callbackAcceptingFunction = (fn) => {
// Calls the function with any required arguments
return fn(1, 2, 3)
}
// Callback gets arguments from the above call
const callback = (arg1, arg2, arg3) => {
return arg1 + arg2 + arg3
}
@khalid32
khalid32 / Slider Component
Created June 25, 2017 17:31
Here I backup all react-native component; basically for understanding how it works...
import React, { Component } from 'react';
import { StyleSheet, Text, View, Slider } from 'react-native';
class SlideText extends React.Component {
constructor(props){
super(props);
this.state = {
value: this.props.value,
min: this.props.min,
import React, { Component } from 'react';
import {
StyleSheet,
Text,
View,
ListView,
ScrollView
} from 'react-native';
import Swipeout from 'react-native-swipeout';
function towerBuilder(nFloors) {
let space = "", star = "", result = [];
for (let i = 1; i <= nFloors; i++) {
space = (" ").repeat(nFloors - i);
star = ("*").repeat((2 * i) - 1);
result.push(space + star + space);
}
return result;
}
import React, { Component } from 'react';
import {
StyleSheet,
Text,
View,
Animated,
Easing,
Image,
} from 'react-native';
@khalid32
khalid32 / Animated MapView with Marker.Animated
Created July 18, 2017 05:47
this is an example of how to move MapView.Marker smoothly by using Animated API and Easing...
import React, { Component } from 'react';
import {
StyleSheet,
Text,
View,
Dimensions,
Animated,
Easing,
} from 'react-native';
1. A description of React's new core algorithm, React Fiber
React Fiber is an ongoing reimplementation of React's core algorithm. It is the culmination of over two years of research by the React team.
The goal of React Fiber is to increase its suitability for areas like animation, layout, and gestures. Its headline feature is incremental rendering: the ability to split rendering work into chunks and spread it out over multiple frames.
Other key features include the ability to pause, abort, or reuse work as new updates come in; the ability to assign priority to different types of updates; and new concurrency primitives.
Lear more: https://github.com/acdlite/react-fiber-architecture
2. You can view its Timeline here: http://isfiberreadyyet.com
@khalid32
khalid32 / Hide Navigation Bar in react-native-router-flux
Last active August 28, 2017 10:28
some tips & tricks on using react-native-router-flux...
// use `hideNavBar={true}` on `Scene`(key=``root``) Component
return (
<Router>
<Scene key="root" hideNavBar={true}>
<Scene key="login" component={Login} title="Login"/>
<Scene key="frontPage" component={FrontPage} title="FrontPage" initial={true}/>
<Scene key="mainPage" component={MainPage}/>
</Scene>
</Router>