Skip to content

Instantly share code, notes, and snippets.

View ArkaneKhan's full-sized avatar

Muhammad Shahbaz ArkaneKhan

  • Karachi, Pakistan
  • 01:22 (UTC -12:00)
View GitHub Profile
adjustSize = (sourceWidth, sourceHeight, shareImage) => {
const width = shareImage
? Metrics.screenWidth - Metrics.doubleBaseMargin * 2
: Metrics.screenWidth;
const height = Metrics.screenHeight;
let ratio = 1;
if (width && height) {
ratio = Math.min(width / sourceWidth, height / sourceHeight);
export function regionFrom(lat, lon, accuracy) {
const oneDegreeOfLongitudeInMeters = 111.32 * 1000;
const circumference = (40075 / 360) * 1000;
const latDelta = accuracy * (1 / (Math.cos(lat) * circumference));
const lonDelta = (accuracy / oneDegreeOfLongitudeInMeters);
return {
latitude: lat,
longitude: lon,
// @flow
import React, { Component } from "react";
import { connect } from "react-redux";
import _ from "lodash";
// redux imports
import {
request as attachmentRequest,
clear as clearAttachmentRequest
import React, { Component } from "react";
import Geolocation from "react-native-geolocation-service";
import { connect } from "react-redux";
import { PermissionsAndroid } from "react-native";
import OpenSettings from "react-native-open-settings";
import Utils from "../../utils";
// redux imports
import { CURRENT_LOCATION } from "../../actions/ActionTypes";
import { generalSaveAction } from "../../actions/GeneralAction";
@ArkaneKhan
ArkaneKhan / FormHandler_Constants.js
Created February 6, 2019 09:09
Dynamic form handler react-native
const INPUT_TYPES = {
TEXT: "TEXT",
EMAIL: "EMAIL",
PASSWORD: "PASSWORD",
NUMBER: "NUMBER",
PHONE: "PHONE"
};
export { INPUT_TYPES };
@ArkaneKhan
ArkaneKhan / ButtonView.js
Created February 4, 2019 07:11
reusable button component
// @flow
import React from "react";
import PropTypes from "prop-types";
import {
TouchableOpacity,
Platform,
TouchableNativeFeedback,
View
} from "react-native";
@ArkaneKhan
ArkaneKhan / FlatWebservice.js
Created February 4, 2019 07:09
reusable list component
// @flow
import _ from "lodash";
import React from "react";
import PropTypes from "prop-types";
import { FlatList as FlatListRN, View } from "react-native";
import {
Separator,
LoadingRequest,
EmptyViewRequest,
const iconInsets = {
top: 6,
left: 0,
bottom: -6,
right: 0
};
export const getTabs = () => {
return {
bottomTabs: {
@ArkaneKhan
ArkaneKhan / index.js
Created May 15, 2018 06:29
metrics file code
/*
* @flow
* TODO: value * ratio difference between Android and iOS is of 2 value;
* 16 in iOS is equals to 14 in android but this need to be verify.
*/
import { Dimensions, Platform, StyleSheet } from "react-native";
const { width, height } = Dimensions.get("window");
@ArkaneKhan
ArkaneKhan / index.js
Created May 15, 2018 06:27
store creation codee
// @flow
import * as storage from "redux-storage";
import { createLogger } from "redux-logger";
import createSagaMiddleware from "redux-saga";
import filter from "redux-storage-decorator-filter";
import { composeWithDevTools } from "remote-redux-devtools";
import { createStore, applyMiddleware } from "redux";
import createEngine from "redux-storage-engine-reactnativeasyncstorage";
// import reducers from "../reducers";