facebook/react-native

ViewPropTypes will be removed from React Native

eharmshoagie opened this issue · 4 comments

Description

My app is not using ViewPropTypes, but our Datadog library is raising the error that something is using them, and we are getting the error that I've seen in the issue.

I've tried the https://www.npmjs.com/package/deprecated-react-native-prop-types, but the error still persists.

If I run

grep -r "ViewPropTypes" node_modules/

it gives me the attached output. I've tried replacing all the imports ie

import type {ViewProps} from '../Components/View/ViewPropTypes'

to

import type {ViewProps} from 'deprecated-react-native-prop-types'

and then running a patch-package, but I get a result that there are no differences

At this point Im a bit stumped on how to fix this error, it's not crashing the app but it's really annoying during development.

If someone could provide suggestions I would appreciate it.

Steps to reproduce

Please review logs in stacktrace

React Native Version

0.73.9

Affected Platforms

Runtime - iOS

Output of npx react-native info

System:
  OS: macOS 14.6.1
  CPU: (10) arm64 Apple M1 Pro
  Memory: 223.73 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.19.1
    path: ~/.nvm/versions/node/v18.19.1/bin/node
  Yarn:
    version: 1.22.22
    path: ~/.nvm/versions/node/v18.19.1/bin/yarn
  npm:
    version: 10.2.4
    path: ~/.nvm/versions/node/v18.19.1/bin/npm
  Watchman:
    version: 2024.07.15.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /Users/eh/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.2
      - iOS 17.2
      - macOS 14.2
      - tvOS 17.2
      - visionOS 1.0
      - watchOS 10.2
  Android SDK:
    API Levels:
      - "28"
      - "30"
      - "31"
      - "33"
      - "34"
    Build Tools:
      - 30.0.2
      - 30.0.3
      - 33.0.0
      - 33.0.1
      - 34.0.0
    System Images:
      - android-33 | Google APIs ARM 64 v8a
      - android-33 | Google Play ARM 64 v8a
      - android-34 | Google APIs ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2022.3 AI-223.8836.35.2231.10811636
  Xcode:
    version: 15.2/15C500b
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.10
    path: /Users/eh/.sdkman/candidates/java/current/bin/javac
  Ruby:
    version: 3.2.2
    path: /Users/eh/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.9
    wanted: 0.73.9
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Stacktrace or Logs

node_modules//@types/react-native/index.d.ts:export const ViewPropTypes: React.ValidationMap<ViewProps>;
node_modules//@types/react-native-htmlview/node_modules/react-native/types/index.d.ts:export * from '../Libraries/Components/View/ViewPropTypes';
node_modules//@types/react-native-htmlview/node_modules/react-native/Libraries/Image/ImageBackground.js:import type {ViewProps} from '../Components/View/ViewPropTypes';
native/Libraries/Modal/Modal.d.ts:import {ViewProps} from '../Components/View/ViewPropTypes';
node_modules//@types/react-native-htmlview/node_modules/react-native/Libraries/Modal/Modal.js:import type {ViewProps} from '../Components/View/ViewPropTypes';
.... more to follow but had to chop it off, there is a limit to characters

Reproducer

n/a

Screenshots and Videos

IMG_3C20BE5C618C-1__

Warning

Unsupported version: It looks like your issue or the example you provided uses an unsupported version of React Native.

Due to the number of issues we receive, we're currently only accepting new issues against one of the supported versions. Please upgrade to latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If you cannot upgrade, please open your issue on StackOverflow to get further community support.

Warning

Unsupported version: It looks like your issue or the example you provided uses an unsupported version of React Native.

Due to the number of issues we receive, we're currently only accepting new issues against one of the supported versions. Please upgrade to latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If you cannot upgrade, please open your issue on StackOverflow to get further community support.

Warning

Missing reproducer: We could not detect a reproducible example in your issue report. Please provide either:

Hey @eharmshoagie, the best advice is migrating to a type system like typescript.

The ViewPropTypes are depreciated.

You can read more about it here