Skip to content

[TypeScript] Properties missing in ImageStyle and TextStyle type #52957

Description

@MatiPl01

Description

While adding a filter property example in Reanimated example app, we noticed that the filter property doesn't exist in the ImageStyle type, whilst this property is most commonly used with image components. The filter prop is specified only in the ViewStyle type.

The same issue applies to other properties like: boxShadow (which works for Image and Text components but is specified only for the View component), mixBlendMode specified in the ViewStyle but working with the Image component, borderTopStartRadius, outlineColor and likely more other properties which are listed only under the ViewStyle type.

Steps to reproduce

Just create the Image (or Text) component and pass one of mentioned properties in the style object to see the TypeScript error.

React Native Version

0.80.0

Affected Platforms

Build - Linux, Build - Windows, Build - MacOS, Runtime - Desktop, Runtime - Web, Runtime - iOS, Runtime - Android

Output of npx @react-native-community/cli info

System:
  OS: macOS 15.5
  CPU: (11) arm64 Apple M3 Pro
  Memory: 269.23 MB / 18.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.10.0
    path: ~/.nvm/versions/node/v20.10.0/bin/node
  Yarn:
    version: 4.1.1
    path: ~/.nvm/versions/node/v20.10.0/bin/yarn
  npm:
    version: 10.2.3
    path: ~/.nvm/versions/node/v20.10.0/bin/npm
  Watchman:
    version: 2025.06.30.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.14.3
    path: /Users/mateu/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.5
      - iOS 18.5
      - macOS 15.5
      - tvOS 18.5
      - visionOS 2.5
      - watchOS 11.5
  Android SDK:
    API Levels:
      - "30"
      - "33"
      - "34"
      - "35"
      - "36"
    Build Tools:
      - 30.0.3
      - 33.0.1
      - 34.0.0
      - 35.0.0
      - 36.0.0
    System Images:
      - android-34 | Android TV ARM 64 v8a
      - android-35 | Google Play ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2025.1 AI-251.25410.109.2511.13752376
  Xcode:
    version: 16.4/16F6
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.15
    path: /opt/homebrew/opt/openjdk@17/bin/javac
  Ruby:
    version: 3.2.2
    path: /Users/mateu/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react: Not Found
  react-native: Not Found
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

Stacktrace or Logs

No stack trace

MANDATORY Reproducer

https://snack.expo.dev/@matipl01/missing-style-prop-types

Screenshots and Videos

View

Image

Image

Image

Activity

  1. react-native-bot commented on Aug 1, 2025

    @react-native-bot
    Collaborator

    Warning

    Could not parse version: We could not find or parse the version number of React Native in your issue report. Please use the template, and report your version including major, minor, and patch numbers - e.g. 0.76.2.

  2. react-native-bot commented on Aug 1, 2025

    @react-native-bot
    Collaborator

    Warning

    Could not parse version: We could not find or parse the version number of React Native in your issue report. Please use the template, and report your version including major, minor, and patch numbers - e.g. 0.76.2.

  3. MatiPl01 commented on Aug 1, 2025

    @MatiPl01
    Author

    This issue is RN version independent

  4. changed the title [-]Properties missing in ImageStyle and TextStyle[/-] [+][TypeScript] Properties missing in ImageStyle and TextStyle type[/+] on Aug 1, 2025
  5. migueldaipre commented on Aug 1, 2025

    @migueldaipre
    Collaborator

    Hi @MatiPl01, thank you for reporting this issue.

    @j-piasecki could this be related to the Strict Typescript API migrations?

  6. j-piasecki commented on Aug 1, 2025

    @j-piasecki
    Contributor

    @migueldaipre

    I believe not - Strict API is opt-in, and without enabling it with react-native-strict-api in tsconfig it shouldn't affect the project at all. Also, the snack is based on Expo SDK 53, which is based on React Native 0.79, while the TS Strict API was introduced in 0.80.

  7. MatiPl01 commented on Aug 1, 2025

    @MatiPl01
    Author

    @migueldaipre

    I had these type issues without react-native-strict-api enabled. After enabling react-native-strict-api, types seem to be correct and TS no longer complains, at least not about these 4 properties that I included in the expo snack.

    @j-piasecki

    I believe not - Strict API is opt-in, and without enabling it with react-native-strict-api in tsconfig it shouldn't affect the project at all.

    Yeah, I din't use the new react-native-strict-api.

    Also, the snack is based on Expo SDK 53, which is based on React Native 0.79, while the TS Strict API was introduced in 0.80.

    I added a snack without looking at the RN version in the snack itself but I tested types in our example app that uses RN 0.80.

  8. cortinico commented on Aug 5, 2025

    @cortinico
    Contributor

    cc @huntie could you look into this one?

  9. huntie commented on Aug 5, 2025

    @huntie
    Collaborator

    Hey all 👋🏻 Yeah looks like a bug in these type definitions.

    Bug in manual types

    Specifically here, where these style props are only defined on ViewStyle, but not (for instance) the base FlexStyle type that might be shared with <Text> and <Image>.

    https://github.com/facebook/react-native/blob/6b354155edd809971264dc652dc9b28e611bbff4/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.d.ts#L436-L438

    By contrast, in Flow these are part of the common ____ViewStyle_InternalBase.

    https://github.com/facebook/react-native/blob/6b354155edd809971264dc652dc9b28e611bbff4/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js#L853-L854

    Fixed with Strict API

    This also means that under the react-native-strict-api opt-in (i.e. types generated directly from Flow), you should expect not to see this bug :)


    cc @jorge-cab @lunaleaps — Could someone look at aligning StyleSheetTypes.d.ts with what we expect the native components to implement? (could be fiddly) 🙏🏻

  10. jorge-cab commented on Aug 11, 2025

    @jorge-cab
    Contributor

    I'll take a look!

  11. ramya-2196 commented on Oct 7, 2026

    @ramya-2196
    Contributor

    A fix is up in #58907: the legacy ImageStyle type now extends ViewStyle, so filter, boxShadow, mixBlendMode, borderTopStartRadius, outlineColor and the other ViewStyle props are accepted on <Image> styles. Legacy TextStyle already inherits these from ViewStyle, and the opt-in Strict TypeScript API never had the gap.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions