Skip to content

Commit

Permalink
Workaround for TypeScript picking up incorrect type for setTimeout
Browse files Browse the repository at this point in the history
  • Loading branch information
SjaakSchilperoort committed Feb 12, 2024
1 parent 8d606e3 commit 80c0bf9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@observation.org/react-native-components",
"version": "1.21.0",
"version": "1.22.0",
"main": "src/index.ts",
"repository": "[email protected]:observation/react-native-components.git",
"author": "Observation.org",
Expand Down
5 changes: 4 additions & 1 deletion src/hooks/useShowBlurView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import { useFocusEffect } from '@react-navigation/native'

const isIOSDevice = Platform.OS === 'ios'

// Fix for TypeScript picking up the incorrect typing (node instead of react-native) for setTimeout
type Timeout = ReturnType<typeof setTimeout>

/**
* On Android devices the BlurView should wait for all interactions to finish.
* This is because it sometimes displays the wrong stack-components in the transparent background if it is displayed immediately.
Expand All @@ -17,7 +20,7 @@ const useShowBlurView = () => {

useFocusEffect(
React.useCallback(() => {
let timer: NodeJS.Timer
let timer: Timeout
const timeout = isIOSDevice ? 0 : 200
const task = InteractionManager.runAfterInteractions(() => {
timer = setTimeout(() => {
Expand Down

0 comments on commit 80c0bf9

Please sign in to comment.