react-native-website icon indicating copy to clipboard operation
react-native-website copied to clipboard

Fixed TypeScript error with `UIManager.MyViewManager.Commands.create` in MyView.tsx Android Native UI Components #4172

Open muhammadashfaq opened this issue 1 year ago • 3 comments

PR Title:

Fixed TypeScript error with UIManager.MyViewManager.Commands.create in MyView.tsx

Description:

This PR addresses a TypeScript error that occurs when accessing UIManager.MyViewManager.Commands.create.toString() in MyView.tsx. The direct reference to UIManager.MyViewManager.Commands may not be available or initialized properly, especially in some environments, which causes issues when working with custom native view managers.

Changes:

  • Replaced UIManager.MyViewManager.Commands.create.toString() with the more reliable UIManager.getViewManagerConfig('MyViewManager').Commands.create.toString() to ensure that the view manager configuration is correctly fetched and initialized before using the command.

This fix ensures compatibility and prevents errors when working with custom native components on both Android.

Closes issue #4172.

Testing:

  • Verified that the new approach resolves the TypeScript error.
  • Tested on Android to ensure the UIManager configurations are fetched correctly.

muhammadashfaq avatar Oct 08 '24 10:10 muhammadashfaq

Deploy Preview for react-native ready!

Name Link
Latest commit 96d1601fc7ba8babf4430f0ce468625b43112631
Latest deploy log https://app.netlify.com/sites/react-native/deploys/67050f5eafaece000889fa08
Deploy Preview https://deploy-preview-4253--react-native.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Oct 08 '24 10:10 netlify[bot]

@cortinico

muhammadashfaq avatar Oct 08 '24 10:10 muhammadashfaq

Let's make sure the CI is green 👍

@cortinico CI is green 👍

muhammadashfaq avatar Oct 08 '24 11:10 muhammadashfaq