This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// credit to https://gist.github.com/ianmartorell/32bb7df95e5eff0a5ee2b2f55095e6a6 | |
// this file was repurosed from there | |
// via this issue https://gist.github.com/necolas/1c494e44e23eb7f8c5864a2fac66299a | |
// because RNW's pressable doesn't bubble events to parent pressables: https://github.com/necolas/react-native-web/issues/1875 | |
/* eslint-disable no-inner-declarations */ | |
import { canUseDOM } from 'fbjs/lib/ExecutionEnvironment' | |
let isEnabled = false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Expo SDK41 | |
// expo-blur: ~9.0.3 | |
import React, { useRef } from 'react'; | |
import { | |
Animated, | |
Image, | |
ImageBackground, | |
ScrollView, | |
StatusBar, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Returns a reversed copy of the given Array | |
*/ | |
export function fastReverse<T>(arr: T[]): T[] { | |
const result = new Array<T>(arr.length); | |
for (let i = 0; i < arr.length; i++) { | |
result[i] = arr[arr.length - 1 - i]; | |
} | |
return result; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Expo SDK40 | |
// expo-blur: ~8.2.2 | |
// expo-haptics: ~8.4.0 | |
// react-native-gesture-handler: ~1.8.0 | |
// react-native-reanimated: ^2.0.0-rc.0 | |
// react-native-safe-area-context: 3.1.9 | |
import React, { useState } from 'react'; | |
import { | |
Image, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { useMutation, useQuery, useQueryClient } from 'react-query' | |
const toggleLikeTweet = async (tweetId) => { | |
// Send a request to API | |
} | |
function LikeTweet({ tweetId, isLiked }) { | |
const queryClient = useQueryClient() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { DependencyList, useMemo } from "react"; | |
import { | |
ImageStyle, | |
RegisteredStyle, | |
StyleProp, | |
StyleSheet, | |
TextStyle, | |
ViewStyle, | |
} from "react-native"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {useEffect, useState} from 'react'; | |
const ON = 'on'; | |
const OFF = 'off'; | |
const defaultTimerValue = 3; | |
const defaultTimerInterval= 1000; | |
const defaultTimeOutCallback = ()=>{alert('Time Over)}; | |
function useCountDownTimer({ | |
initialValue = defaultTimerValue, | |
interval = defaultTimerInterval, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// pages/_app.js | |
import ReactNativeNextJsScrollRestore from '../react-native-next-scroll-restore' | |
import { useEffect } from 'react' | |
function MyApp({ Component, pageProps }) { | |
useEffect(() => { | |
const unsubscribe = ReactNativeNextJsScrollRestore.initialize() | |
return () => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/node_modules/react-native/React/Views/RCTModalHostView.h b/node_modules/react-native/React/Views/RCTModalHostView.h | |
index 4e61886..2b8b6c0 100644 | |
--- a/node_modules/react-native/React/Views/RCTModalHostView.h | |
+++ b/node_modules/react-native/React/Views/RCTModalHostView.h | |
@@ -17,7 +17,7 @@ | |
@protocol RCTModalHostViewInteractor; | |
-@interface RCTModalHostView : UIView <RCTInvalidating> | |
+@interface RCTModalHostView : UIView <RCTInvalidating, UIAdaptivePresentationControllerDelegate> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useCallback, useState } from 'react'; | |
import { LayoutChangeEvent } from 'react-native'; | |
export const useSize = (): [ | |
{ | |
height: number; | |
width: number; | |
}, | |
(event: LayoutChangeEvent) => void | |
] => { |