Skip to content

Instantly share code, notes, and snippets.

View erenkulaksiz's full-sized avatar
😉
Working from office

Eren Kulaksız erenkulaksiz

😉
Working from office
View GitHub Profile
@erenkulaksiz
erenkulaksiz / CustomTabBar.tsx
Last active August 7, 2024 20:06
CustomTabBar
import { View, TouchableOpacity } from "react-native";
import Animated, { FadeInDown, FadeOutDown } from "react-native-reanimated";
import cn from "@/utils/cn";
import type { CustomTabBarProps } from "./CustomTabBar.types";
export default function CustomTabBar({
state,
descriptors,
navigation,
containerClassName,
const YEAR_IN_SEC = 31536000;
const MONTH_IN_SEC = 2628000;
const DAY_IN_SEC = 86400;
const HOUR_IN_SEC = 3600;
const MINUTES_IN_SEC = 60;
export function getTimeAgo(value: string, locale: string = "tr") {
const now = new Date().getTime();
const entryTime = Date.parse(value);
import { useEffect, useRef, useState } from "react";
import { AdEventType, InterstitialAd } from "react-native-google-mobile-ads";
import analytics from "@react-native-firebase/analytics";
import adId from "@/utils/adId";
import { useAuthStore } from "@/stores/authStore";
import isPremium from "@/utils/isPremium";
interface IUseInterstitialAd {
onAdLoaded?: (showAd: () => void) => void;
onAdWatched?: () => void;
@erenkulaksiz
erenkulaksiz / withExtraAndroidManifest.js
Created April 22, 2024 07:13
took some time to figure this custom config out.
const defineConfig = (config) => {
const { withAndroidManifest } = require('@expo/config-plugins');
config = withAndroidManifest(config, (config) => {
let androidManifest = config.modResults.manifest;
androidManifest.application = androidManifest.application || [];
androidManifest.application[0]["meta-data"].push({
$: {
"android:name":
"com.dieam.reactnativepushnotification.notification_color",
@erenkulaksiz
erenkulaksiz / SubscriptionTypeEnums.php
Created March 19, 2024 18:16
Google Play Android Sub types
<?php
namespace App\Enums;
/**
* Class SubscriptionTypeEnums
* @package App\Enums
*/
final class SubscriptionTypeEnums
{
@erenkulaksiz
erenkulaksiz / View.tsx
Last active June 12, 2023 06:45
basic conditional render in react
import { Children } from "react";
import type { ViewProps, ViewIfElseProps } from "./View.types";
export default function View({ viewIf, div, children }: ViewProps) {
if (Children.count(children) > 2)
throw new Error(
"View component can only have 2 children, View.If and View.Else"
);
if (viewIf === true) return <>{Children.toArray(children)[0]}</>;
https://www.youtube.com/watch?v=dQw4w9WgXcQ
@erenkulaksiz
erenkulaksiz / localStorage.ts
Last active July 25, 2022 16:55
Localstorage implementation for NextJS used in Notal
import { isClient } from "@utils/isClient"; // check for Serverside rendering
interface DefaultSettingsTypes {
cookies: boolean;
installedVersion: string;
installedEnv: string;
navbarCollapsed: boolean;
}
const DefaultSettings: DefaultSettingsTypes = {
@erenkulaksiz
erenkulaksiz / buildComponent.ts
Last active June 16, 2022 18:36
typescript version of buildComponent.js used in Notal.
interface BuildComponentTypes {
name?: string;
defaultClasses?: string;
extraClasses?: string;
conditionalClasses?: Array<{
[key: string]: string | boolean | undefined;
}>;
selectedClasses?: Array<string | boolean | undefined>;
}
import {
createContext,
PropsWithChildren,
ReactNode,
useContext,
useEffect,
useState,
} from "react";
import { AnimateSharedLayout, motion } from "framer-motion";