Skip to content

Instantly share code, notes, and snippets.

@bizz84
bizz84 / privacy-manifest-list.txt
Created March 27, 2024 12:18
Bash script to check if the Podfile.lock contains any SDKs that should be declared in the privacy manifest file
Abseil
AFNetworking
Alamofire
AppAuth
BoringSSL / openssl_grpc
Capacitor
Charts
connectivity_plus
Cordova
device_info_plus
@Hawaii66
Hawaii66 / useEnv.ts
Created July 6, 2022 19:45
useEnv() | Custom Hook | React
import { useEffect, useState } from "react";
export enum EnvVariable {
enviorment,
serverEndPoint,
website
}
type EnvVariables = {[key in keyof typeof EnvVariable]:string}

SOLUTION: Inspector doesn't work in React Native React DevTools

Follow the steps below if your dev menu "show inspector" option is not working correctly with React DevTools. These steps fixed both the standalone react-devtools and the embedded react-devtools inside react-native-debugger for me.

Step 1: Fix the "Unsupported DevTools Backend Version" error message

Unsupported DevTools Backend Version

First, follow these instructions to ensure your project's react-devtools-core package is compatible with the package used by either your standalone react-devtools or the

@jacques-blom
jacques-blom / Canvas.tsx
Last active May 4, 2023 14:37
Atom Families
import {createContext, useState} from 'react'
import {Element, Rectangle} from './components/Rectangle/Rectangle'
import {PageContainer} from './PageContainer'
import {Toolbar} from './Toolbar'
type ElementsContextType = {
elements: Element[]
addElement: () => void
setElement: SetElement
}
@emeraldsanto
emeraldsanto / ErrorBoundary.tsx
Last active March 15, 2023 20:26
Custom error boundary with Firebase Crashlytics reporting and HOC
import React, { Component, ComponentType, ReactNode } from "react";
import crashlytics from "@react-native-firebase/crashlytics";
export interface ErrorBoundaryProps {
fallback: () => ReactNode;
}
/**
* Wraps the provided component in an ErrorBoundary, with the provided fallback.
* This should be used on components whose parent is not easy to control, such as
@teimurjan
teimurjan / replaceImports.js
Created March 30, 2020 08:07
Replace relative JS imports
var fs = require("fs");
var path = require("path");
const replaceImports = (pathToDir, replace) =>
fs.readdir(pathToDir, function(err, files) {
if (err) {
console.error("Could not list the directory.", err);
process.exit(1);
}
@ianldgs
ianldgs / dayjs-zoned.d.ts
Last active October 6, 2022 09:21
DayJS Zoned
import { Dayjs, PluginFunc, ConfigType } from 'dayjs';
declare const plugin: PluginFunc;
export = plugin;
declare module 'dayjs' {
/** Similar to date-fns/utcToZonedTime */
function utcToZoned(config: ConfigType, timezone?: string): Dayjs;
/** Similar to date-fns/zonedTimeToUtc */
@prescottprue
prescottprue / snapshotResolver.js
Created November 26, 2018 21:54
Jest snapshot resolver for snapshots at top level of repo when tests are in component folders.
const path = require('path')
const rootDir = path.resolve(__dirname, '..')
module.exports = {
/** resolves from test to snapshot path */
resolveSnapshotPath: (testPath, snapshotExtension) => {
return testPath.replace('src/', '__snapshots__/') + snapshotExtension
},
@spemer
spemer / customize-scrollbar.css
Last active July 18, 2024 13:41
✨ Customize website's scrollbar like Mac OS. Not supports in Firefox and IE.
/* Customize website's scrollbar like Mac OS
Not supports in Firefox and IE */
/* total width */
body::-webkit-scrollbar {
background-color: #fff;
width: 16px;
}
/* background of the scrollbar except button or resizer */
@ZainaliSyed
ZainaliSyed / VisualStudioSetting.md
Last active January 16, 2020 08:22
`Visual Studio Code` settings for `React Native`

Visual Studio Code settings for React Native

Extensions

  • React Native Tools by Visual Studio Mobile Tools
  • Auto Close Tag by Jun Han
  • Auto Complete Tag by Jun Han
  • Auto Rename Tag by Jun Han
  • Babel ES6/ES7 by dzannotti
  • Code Spellcheker by Street Side Software
  • Color Highlight by Sergii Naumov