Skip to content

Instantly share code, notes, and snippets.

View OkancanCosar's full-sized avatar
😎
Focusing To React-Native

OkancanCosar

😎
Focusing To React-Native
View GitHub Profile
@OkancanCosar
OkancanCosar / app.json
Created August 2, 2022 06:13
LocalAuthentication with expo
...
expo > ios > infoPlist
"NSFaceIDUsageDescription": "This app use face id authentication."
...
@OkancanCosar
OkancanCosar / App.tsx
Created July 13, 2022 07:31
expo notification
import React, { useEffect } from "react";
import { NotificationHandler } from "./NotificationHandler";
const App = (): JSX.Element => {
useEffect(() => {
NotificationHandler.init();
}, []);
return (
@OkancanCosar
OkancanCosar / GeoLocationData.ts
Created December 20, 2021 06:55
react get ip
import axios from "axios";
interface IGeolocationData {
country_code: string;
country_name: string;
city: string;
postal: string;
latitude: number;
longitude: number;
IPv4: string;
[{"day":"2021-01-01T00:00:00","prices":[{"priceDate":"2021-01-01T00:00:00","productName":"Kurşunsuz Benzin 95","productShortName":"KURS","productCode":"A100","amount":7.3},{"priceDate":"2021-01-01T00:00:00","productName":"Motorin EcoForce","productShortName":"MT_ECO","productCode":"A128","amount":6.69},{"priceDate":"2021-01-01T00:00:00","productName":"Motorin UltraForce","productShortName":"MT_ULT","productCode":"A121","amount":6.73},{"priceDate":"2021-01-01T00:00:00","productName":"Gazyağı","productShortName":"GAZ","productCode":"A110","amount":5.4},{"priceDate":"2021-01-01T00:00:00","productName":"Fuel Oil","productShortName":"F. Oil","productCode":"A212","amount":4.22},{"priceDate":"2021-01-01T00:00:00","productName":"Yüksek Kükürtlü Fuel Oil","productShortName":"YKFO","productCode":"A218","amount":3.78},{"priceDate":"2021-01-01T00:00:00","productName":"Kalorifer Yakıtı","productShortName":"Kalori","productCode":"A201","amount":4.76}]},{"day":"2021-01-05T00:00:00","prices":[{"priceDate":"2021-01-05T00:00:0
@OkancanCosar
OkancanCosar / gist:cbf5795d7d1b8fab3658e88f305dee63
Created September 28, 2021 08:22
react-navigation drawer scroll
isDrawerOpenSty: {
height: p.height - 80,
overflow: "hidden",
},
import { useIsDrawerOpen } from '@react-navigation/drawer';
const isDrawerOpen = useIsDrawerOpen();
<View style={[styles.centerArea, isDrawerOpen ? styles.isDrawerOpenSty : {}]}> </View>
@OkancanCosar
OkancanCosar / index.tsx
Created June 30, 2021 06:34
useDeviceOrientation
import { useEffect, useState, useCallback } from 'react';
import { Dimensions } from 'react-native';
const screen = Dimensions.get('window');
export function useDeviceOrientation() {
const isOrientationPortrait = ({
width,
height,
}: {
@OkancanCosar
OkancanCosar / .prettierrc.json
Created June 28, 2021 09:57
prettier config
{
"tabWidth": 2,
"semi": true,
"singleQuote": false,
"packageManager": "yarn",
"trailingComma": "all",
"arrowParens": "avoid",
"jsxBracketSameLine": true,
"printWidth": 120
}
@OkancanCosar
OkancanCosar / index.js
Created June 28, 2021 09:15
AsyncStorage usage
const [[, storageUser], [, storageToken]] = await AsyncStorage.multiGet(["@Tbest:user", "@Tbest:token"]);
await AsyncStorage.multiSet([
["@Tbest:user", JSON.stringify(response.user)],
["@Tbest:token", response.token],
]);
@OkancanCosar
OkancanCosar / App.js
Last active June 21, 2021 11:41
Firebase handle notification
import React, { useEffect } from "react";
import { SafeAreaView, StyleSheet, View, Text } from "react-native";
import messaging from "@react-native-firebase/messaging";
const TOPIC = "MyNews";
const App = () => {
const requestUserPermission = async () => {
/**
import * as crypto from 'crypto-js'
let key = crypto.enc.Utf8.parse('1234567890123456') // 16 karakter
let iv = crypto.enc.Utf8.parse('1234567890123456')
export const encrypt = (string: string): string => {
let cipherText = crypto.AES.encrypt(string, key, {
keySize: 128 / 8,
iv: iv,
mode: crypto.mode.CBC,