Skip to content

Instantly share code, notes, and snippets.

View uguraktas's full-sized avatar

Uğur Aktaş uguraktas

View GitHub Profile
@uguraktas
uguraktas / NotificationService.js
Created January 24, 2024 22:52
Firebase NotificationService
import messaging from '@react-native-firebase/messaging';
export async function registerForPushNotifications(uid) {
// Check and request permissions
const authStatus = await messaging().requestPermission();
const enabled =
authStatus === messaging.AuthorizationStatus.AUTHORIZED ||
authStatus === messaging.AuthorizationStatus.PROVISIONAL;
if (enabled) {
$sizeSmall: 12,
column: {
flexDirection: 'row',
//Add full with
width: '100%',
//Important, After that screenover 12px, because add margin
margin:'$sizeSmall',
@uguraktas
uguraktas / npm-reset.bat
Last active July 16, 2019 07:26
for react-native reset bundle and npm modules
rm -rf $TMPDIR/metro-* && rm -rf $TMPDIR/haste-* && watchman watch-del-all && npm cache clean --force && npm cache verify && rm -rf ios/build && rm -rf node_modules/ && npm i
-if do you use pods
rm -rf pods && pod install
-for android gradle clean
./gradlew cleanBuildCache
@uguraktas
uguraktas / jspromises.js
Last active October 17, 2019 15:11
Javascript Callback, promise and await
//Dummy data
const data = [
{ title: "Title 1", description: "Title Content 1" },
{ title: "Title 2", description: "Title Content 2" }
]
//Example Callback
function getData() {
setTimeout(() => {
data.map((item, index) => {
console.log('getData', item, index)
@uguraktas
uguraktas / gist:58894765aeed9122fe2b6e25f1422e66
Created May 26, 2019 19:51
react-native-extended-stylesheet
/* component.js */
import EStyleSheet from 'react-native-extended-stylesheet';
// define extended styles
const styles = EStyleSheet.create({
column: {
width: '80%' // 80% of screen width
},
text: {
color: '$textColor', // global variable $textColor