Skip to content

Fix Reanimated v4 useAnimatedProps type error in AnimatedNumber#563

Merged
jamespepper81 merged 3 commits into
devfrom
copilot/npm-install-dependencies
Feb 23, 2026
Merged

Fix Reanimated v4 useAnimatedProps type error in AnimatedNumber#563
jamespepper81 merged 3 commits into
devfrom
copilot/npm-install-dependencies

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 23, 2026

CI TypeScript build was failing because Reanimated v4 tightened the animatedProps prop type — Partial<{ text: string }> is no longer assignable to Partial<AnimatedPropsProp<TextInputProps>> since text is a Reanimated-internal native prop absent from RN's TextInputProps.

Fix

Added defaultValue: text alongside text in the useAnimatedProps return — the same pattern used in Reanimated's own PerformanceMonitor.tsx. Since defaultValue is a standard TextInputProps field, TypeScript can now verify structural compatibility.

// Before
const animatedProps = useAnimatedProps(() => {
  const text = `${prefix}${format(animatedValue.value)}${suffix}`;
  return { text };
});

// After
const animatedProps = useAnimatedProps(() => {
  const text = `${prefix}${format(animatedValue.value)}${suffix}`;
  return { text, defaultValue: text };
});

defaultValue also correctly sets the initial displayed value before the first animation frame runs.

npm audit fix --force — not applied

Force-fixing the audit would have downgraded expo v54→v51, @expo/cli v54→v0.11, and pulled in a react-native version incompatible with React 19 — breaking the build worse than before. The 40 high-severity findings are all in the minimatch transitive chain through dev tooling, not production runtime code.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: jamespepper81 <84083764+jamespepper81@users.noreply.github.com>
Copilot AI changed the title [WIP] Add npm install command for project dependencies Run npm install to populate node_modules Feb 23, 2026
Copilot AI requested a review from jamespepper81 February 23, 2026 19:01
Copilot AI changed the title Run npm install to populate node_modules Run npm audit — document dependency vulnerabilities Feb 23, 2026
…s (Reanimated v4)

Co-authored-by: jamespepper81 <84083764+jamespepper81@users.noreply.github.com>
Copilot AI changed the title Run npm audit — document dependency vulnerabilities Fix Reanimated v4 useAnimatedProps type error in AnimatedNumber Feb 23, 2026
@jamespepper81 jamespepper81 marked this pull request as ready for review February 23, 2026 19:21
Copilot AI review requested due to automatic review settings February 23, 2026 19:21
@jamespepper81 jamespepper81 merged commit b6da4f8 into dev Feb 23, 2026
3 checks passed
@jamespepper81 jamespepper81 deleted the copilot/npm-install-dependencies branch February 23, 2026 19:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a TypeScript build failure caused by Reanimated v4's stricter type checking for useAnimatedProps. The issue arose because Reanimated v4 tightened the animatedProps prop type, making Partial<{ text: string }> no longer assignable to Partial<AnimatedPropsProp<TextInputProps>> since text is a Reanimated-internal native prop that doesn't exist in React Native's TextInputProps.

Changes:

  • Added defaultValue: text alongside text in useAnimatedProps return object in AnimatedNumber.tsx to satisfy TypeScript type checking
  • Package-lock.json updated with peer dependency flags on various packages (no version changes)

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.

File Description
components/AnimatedNumber.tsx Fixed Reanimated v4 type error by adding defaultValue: text to useAnimatedProps return, following the pattern from Reanimated's PerformanceMonitor
package-lock.json Automated dependency metadata updates (peer flags) with no actual version changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants