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 / network.java
Last active August 27, 2018 13:27
getWifiSSID, getNetworkCountryIso, getNetworkOperator, getSimOperator
/**
* Gets the SSID of the currently associated WiFi access point if there is one. Otherwise,
* returns empty string.
*/
@CalledByNative
public static String getWifiSSID(Context context) {
if (context == null) {
return "";
}
final Intent intent = context.registerReceiver(
@OkancanCosar
OkancanCosar / index.java
Created July 30, 2018 12:24
android get device infos
String details = "VERSION.RELEASE : " + Build.VERSION.RELEASE
+ "\nVERSION.INCREMENTAL : " + Build.VERSION.INCREMENTAL
+ "\nVERSION.SDK.NUMBER : " + Build.VERSION.SDK_INT
+ "\nBOARD : " + Build.BOARD
+ "\nBOOTLOADER : " + Build.BOOTLOADER
+ "\nBRAND : " + Build.BRAND
+ "\nCPU_ABI : " + Build.CPU_ABI
+ "\nCPU_ABI2 : " + Build.CPU_ABI2
+ "\nDISPLAY : " + Build.DISPLAY
+ "\nFINGERPRINT : " + Build.FINGERPRINT
@OkancanCosar
OkancanCosar / info.txt
Created December 28, 2018 13:32
all android screen dimensions...
res/values/dimens.xml(default)
res/values-ldpi/dimens.xml (240x320 and nearer resolution)
res/values-mdpi/dimens.xml (320x480 and nearer resolution)
res/values-hdpi/dimens.xml (480x800, 540x960 and nearer resolution)
res/values-xhdpi/dimens.xml (720x1280 - Samsung S3, Micromax Canvas HD, etc)
res/values-xxhdpi/dimens.xml (1080x1920 - Samsung S4, HTC one, etc)
res/values-large/dimens.xml (480x800)
res/values-large-mdpi/dimens.xml (600x1024)
res/values-sw600dp/dimens.xml (600x1024)
@OkancanCosar
OkancanCosar / OkanKeyboard.js
Last active October 1, 2019 07:38
dismis keyboard when click somewhere and scrool when keyboard open
import { PropTypes } from "prop-types";
import React, { Component } from "react";
import {
Animated,
Dimensions,
Keyboard,
StyleSheet,
TextInput,
UIManager,
TouchableWithoutFeedback
@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 August 12, 2022 11:22
React object list state manuplate
import {useState} from 'react';
const App = () => {
const initialState = [
{id: 1, country: 'Austria'},
{id: 2, country: 'Belgium'},
{id: 3, country: 'Canada'},
];
const [data, setData] = useState(initialState);
@OkancanCosar
OkancanCosar / index.js
Created January 18, 2024 13:05
percentage to hex color
const perc2color = (perc: number) => {
var r, g, b = 0;
if (perc < 50) {
r = 255;
g = Math.round(5.1 * perc);
}
else {
g = 255;
r = Math.round(510 - 5.10 * perc);
}
@OkancanCosar
OkancanCosar / App.tsx
Last active January 18, 2024 14:03
Download file button
import React, { useState } from 'react'
import { StyleSheet, TouchableOpacity, View, Text, Alert } from 'react-native'
import RNFS from 'react-native-fs'
const perc2color = (perc: number) => {
var r, g, b = 0
if (perc < 50) {
r = 255
g = Math.round(5.1 * perc)
}