Skip to content

fix(#555): drop removed View.propTypes spread that breaks RN 0.63 plus#793

Open
jim-daf wants to merge 1 commit into
blackuy:masterfrom
jim-daf:fix/issue-555-remove-view-proptypes-spread
Open

fix(#555): drop removed View.propTypes spread that breaks RN 0.63 plus#793
jim-daf wants to merge 1 commit into
blackuy:masterfrom
jim-daf:fix/issue-555-remove-view-proptypes-spread

Conversation

@jim-daf

@jim-daf jim-daf commented Apr 26, 2026

Copy link
Copy Markdown

Closes #555.

Why the call sometimes failed

Both TwilioVideo components copy the host View prop list with ...View.propTypes so consumers can pass through native view props. That field was removed from React Native in version 0.63 and now resolves to undefined. Spreading it into an object literal is silent at runtime, but as soon as a downstream consumer or a PropTypes-aware helper reaches for the resulting list it goes through Babel's _toConsumableArray, which throws the exact error reported in the issue.

[TypeError: Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.]

Fix

Remove the dead spread from both the Android and iOS components and drop the now-unused View import on Android.

// src/TwilioVideo.android.js
const propTypes = {
  /** Callback that is called when camera source changes */
  onCameraSwitched: PropTypes.func,
// src/TwilioVideo.ios.js
    autoInitializeCamera: PropTypes.bool,
  };

The remaining explicit PropTypes.func, PropTypes.bool, PropTypes.string entries fully describe the public API, so consumers keep the same prop validation behaviour they had on RN 0.62 and earlier.

@jim-daf jim-daf marked this pull request as ready for review April 26, 2026 11:11
Copilot AI review requested due to automatic review settings April 26, 2026 11:11

Copilot AI left a comment

Copy link
Copy Markdown

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 React Native 0.63+ compatibility issue by removing use of View.propTypes, which was removed from RN and can trigger runtime errors when downstream tooling inspects/spreads the resulting PropTypes objects.

Changes:

  • Removed ...View.propTypes from iOS TwilioVideo component PropTypes.
  • Removed View import and ...View.propTypes spread from Android component PropTypes.

Reviewed changes

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

File Description
src/TwilioVideo.ios.js Drops ...View.propTypes from static propTypes to prevent RN 0.63+ failures.
src/TwilioVideo.android.js Removes View import and ...View.propTypes spread from PropTypes to avoid referencing removed RN API.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/TwilioVideo.ios.js
Comment on lines 154 to 155
autoInitializeCamera: PropTypes.bool,
...View.propTypes,
};

Copilot AI Apr 26, 2026

Copy link

Choose a reason for hiding this comment

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

Now that ...View.propTypes has been removed, View is no longer referenced anywhere in this file. Please drop View from the react-native import to avoid leaving an unused dependency (and potential lint/tooling warnings in downstream projects).

Copilot uses AI. Check for mistakes.
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.

video not connected

2 participants