New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@codeleap/hooks

Package Overview
Dependencies
Maintainers
2
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@codeleap/hooks - npm Package Compare versions

Comparing version
6.2.3
to
6.3.0
+8
-8
package.json
{
"name": "@codeleap/hooks",
"version": "6.2.3",
"version": "6.3.0",
"main": "src/index.ts",

@@ -12,6 +12,6 @@ "license": "UNLICENSED",

"devDependencies": {
"@codeleap/config": "6.2.3",
"@codeleap/types": "6.2.3",
"@codeleap/utils": "6.2.3",
"@codeleap/logger": "6.2.3",
"@codeleap/config": "6.3.0",
"@codeleap/types": "6.3.0",
"@codeleap/utils": "6.3.0",
"@codeleap/logger": "6.3.0",
"ts-node-dev": "1.1.8"

@@ -23,5 +23,5 @@ },

"peerDependencies": {
"@codeleap/types": "6.2.3",
"@codeleap/utils": "6.2.3",
"@codeleap/logger": "6.2.3",
"@codeleap/types": "6.3.0",
"@codeleap/utils": "6.3.0",
"@codeleap/logger": "6.3.0",
"axios": "^1.7.9",

@@ -28,0 +28,0 @@ "typescript": "5.5.2",

@@ -35,3 +35,2 @@ import {

export * from './useId'
export * from './useAnimatedState'
export * from './useDebounceCallback'

@@ -38,0 +37,0 @@ export * from './useDerivedRef'

import { useState, useCallback } from 'react'
import { SharedValue, useSharedValue, useDerivedValue, runOnJS, isSharedValue } from 'react-native-reanimated'
/**
* Hook that synchronizes a React state with a Reanimated SharedValue.
*
* @example
* const [value, setValue, sharedValue] = useAnimatedState(0)
* setValue(10) // Updates both React state and SharedValue
*/
export function useAnimatedState<T>(initialValue: SharedValue<T> | T) {
const sharedValue = isSharedValue(initialValue)
? initialValue
: useSharedValue<T>(initialValue)
const [value, _setValue] = useState<T>(
isSharedValue(initialValue) ? initialValue.value : initialValue,
)
useDerivedValue(() => {
runOnJS(_setValue)(sharedValue.value)
})
const setValue = useCallback((newValue: T) => {
sharedValue.value = newValue
if (isSharedValue(initialValue)) initialValue.value = newValue
_setValue(newValue)
}, [])
return [value, setValue, sharedValue] as const
}
/**
* Hook that extracts and synchronizes the value from a SharedValue.
*
* @example
* const value = useAnimatedValue(sharedValue)
*/
export function useAnimatedValue<T>(initialValue: SharedValue<T> | T): T {
const [value] = useAnimatedState(initialValue)
return value
}

Sorry, the diff of this file is not supported yet