Skip to content

Instantly share code, notes, and snippets.

View chanphiromsok's full-sized avatar
🎯
Focusing

Chanphirom Sok chanphiromsok

🎯
Focusing
  • Cambodia
  • 07:30 (UTC -12:00)
View GitHub Profile
const { withAndroidManifest, withDangerousMod } = require("@expo/config-plugins");
const { mergeContents } = require("@expo/config-plugins/build/utils/generateCode");
const fs = require("node:fs");
const path = require("node:path");
/**
* Config plugin to add border radius to Android popup menus
* @param {import('@expo/config-types').ExpoConfig} config - Expo config
* @param {Object} options - Plugin options
* @param {number} [options.radius=14] - Border radius in dp
@okaybeydanol
okaybeydanol / SwipeableReanimated.tsx
Created February 21, 2025 21:57
RN: Swipeable Item with Reanimated 3 - Lightweight & Performant List Item with Swipe Actions
import React, {
forwardRef,
PropsWithChildren,
useImperativeHandle,
memo,
useMemo,
useCallback,
} from 'react';
import {
Gesture,
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.AppOpsManager;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import java.lang.reflect.Method;
// MIUI. Redefining Android.
@esinanturan
esinanturan / README.md
Created March 29, 2022 21:27 — forked from cskeppstedt/README.md
Modify proguard rules in a managed expo project

Modify proguard rules in a managed expo project

If you ever need to modify the proguard rules for the Android-part of your Expo managed workflow, you can achieve this by using a config plugin.

  1. Make a folder for config-plugins called ./plugins in the project root folder.
  2. Place the withProguardRules.js and my-proguard-rules.pro in the folder
  3. Add the config plugin to the plugins array of your app.config.js (or app.json if you're using that instead).

NOTE: if you rename your .pro file, don't forget to change the two occurrences of my-proguard-rules in withProguardRules.js as well.

@intergalacticspacehighway
intergalacticspacehighway / viewability-tracker-flatlist.tsx
Last active January 21, 2025 14:01
Viewability tracker with shared values
import { createContext, forwardRef, useCallback, useMemo } from "react";
import { FlatList, FlatListProps, ViewToken } from "react-native";
import Animated, { useSharedValue } from "react-native-reanimated";
const MAX_VIEWABLE_ITEMS = 4;
type ViewabilityItemsContextType = string[];
export const ViewabilityItemsContext = createContext<
Animated.SharedValue<ViewabilityItemsContextType>
import { View, StyleSheet, TouchableWithoutFeedback } from 'react-native';
import React from 'react';
import Animated, { useSharedValue, withRepeat, useAnimatedStyle, withTiming } from 'react-native-reanimated'
const App: () => React$Node = () => {
const animation = useSharedValue(1)
const animationStyle = useAnimatedStyle(() => {
return {
transform: [
@dungkaka
dungkaka / picker
Last active September 4, 2024 08:57
Convert wheel picker to reanimated 2
import React from "react";
import { Dimensions, StyleSheet, Text, View } from "react-native";
import { PanGestureHandler } from "react-native-gesture-handler";
import Animated, {
Easing,
Extrapolate,
interpolate,
useAnimatedGestureHandler,
useAnimatedReaction,
useAnimatedStyle,
@marybnq
marybnq / KeyboardHeightDetector.swift
Last active March 10, 2025 06:21
Code to calculate height of current device's keyboard
struct ScreenSize {
static let width = UIScreen.main.bounds.size.width
static let height = UIScreen.main.bounds.size.height
static let maxLength = max(ScreenSize.width, ScreenSize.height) //Gets the Height
static let minLength = min(ScreenSize.width, ScreenSize.height) //Gets the Width
}
//Contains the dimensions of the devices
fileprivate struct KeybDimensions{
//iPod touch(7), iPhone 5, iPhone 5s, iPhone 5C, iPhone SE
@PierreThiollent
PierreThiollent / Readme.md
Last active February 6, 2025 10:24
iTerm2 and Oh-my-zsh config

Setup iTerm2 and oh-my-zsh

Enjoy ! 😄

Install iTerm 2

Download iTerm2 here.

@objcode
objcode / ConcurrencyHelpers.kt
Last active May 13, 2025 01:44
Helpers to control concurrency for one shot requests using Kotlin coroutines.
/* Copyright 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,