Skip to content

Instantly share code, notes, and snippets.

@barthap
barthap / react-native+0.68.2.patch
Created July 18, 2022 16:39
RN 0.68 patch to have iOS 15 detents in <Modal> component
diff --git a/node_modules/react-native/Libraries/Modal/Modal.js b/node_modules/react-native/Libraries/Modal/Modal.js
index 9140a56..1a26c51 100644
--- a/node_modules/react-native/Libraries/Modal/Modal.js
+++ b/node_modules/react-native/Libraries/Modal/Modal.js
@@ -246,6 +246,7 @@ class Modal extends React.Component<Props> {
return (
<RCTModalHostView
+ modalSheetSize={this.props.modalSheetSize}
animationType={animationType}
import React, { useEffect } from "react";
import { SafeAreaView, View, TextInput } from "react-native";
import Svg, { Circle } from "react-native-svg";
import Animated, {
interpolateColor,
useAnimatedProps,
useDerivedValue,
useSharedValue,
withTiming,
} from "react-native-reanimated";
@intergalacticspacehighway
intergalacticspacehighway / viewability-tracker-flatlist.tsx
Last active January 23, 2024 03:38
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>
@velopert
velopert / CounterManager.m
Created April 25, 2021 11:26
React Native iOS Native Component with Swift
#import <React/RCTViewManager.h>
@interface RCT_EXTERN_MODULE(CounterManager, RCTViewManager)
RCT_EXPORT_VIEW_PROPERTY(value, NSNumber)
RCT_EXPORT_VIEW_PROPERTY(leftButtonText, NSString)
RCT_EXPORT_VIEW_PROPERTY(rightButtonText, NSString)
RCT_EXPORT_VIEW_PROPERTY(onPressLeftButton, RCTDirectEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onPressRightButton, RCTDirectEventBlock)
@tranquan
tranquan / xcode-keybindings-as-vscode.md
Last active May 16, 2024 12:27
Xcode KeyBindings as VSCode
@iAmrSalman
iAmrSalman / encodeVideo.swift
Last active June 12, 2023 19:10
[Convert MOV to MP4] function to convert MOV to MP4 video format#swift #avkit #avasset
// Don't forget to import AVKit
func encodeVideo(at videoURL: URL, completionHandler: ((URL?, Error?) -> Void)?) {
let avAsset = AVURLAsset(url: videoURL, options: nil)
let startDate = Date()
//Create Export session
guard let exportSession = AVAssetExportSession(asset: avAsset, presetName: AVAssetExportPresetPassthrough) else {
completionHandler?(nil, nil)
return
@mkjiau
mkjiau / axios-interceptors-refresh-token.js
Last active March 13, 2024 10:59
Axios interceptors for token refreshing and more than 2 async requests available
let isRefreshing = false;
let refreshSubscribers = [];
const instance = axios.create({
baseURL: Config.API_URL,
});
instance.interceptors.response.use(response => {
return response;
}, error => {
@jacks205
jacks205 / RNMultipleTargetsInstructions.md
Last active February 6, 2024 19:30
Settings up multiple app targets in React-Native
@chourobin
chourobin / 0-bridging-react-native-cheatsheet.md
Last active May 4, 2024 14:06
React Native Bridging Cheatsheet
@JoshuaSullivan
JoshuaSullivan / ColorCubeHelper-swift2.swift
Last active April 17, 2024 10:48
Here are the Swift 2.3 and Swift 3.0 versions of the ColorCubeHelper class.
//
// ColorCubeHelper.swift
//
// Created by Joshua Sullivan on 10/01/16.
// Copyright © 2016 Joshua Sullivan. All rights reserved.
//
import UIKit
import Accelerate