Skip to content

Support React-Native Response object#572

Merged
AlexandrHoroshih merged 3 commits intomasterfrom
fix-react-native-body
Jan 21, 2026
Merged

Support React-Native Response object#572
AlexandrHoroshih merged 3 commits intomasterfrom
fix-react-native-body

Conversation

@AlexandrHoroshih
Copy link
Member

React-Native Response object implementation never has a response.body and correspoding streams
=> we need to fallback the createJson* implementation according to that

@netlify
Copy link

netlify bot commented Jan 20, 2026

Deploy Preview for farfetched ready!

Name Link
🔨 Latest commit f64389b
🔍 Latest deploy log https://app.netlify.com/projects/farfetched/deploys/696f6498b29bba00088f6f5a
😎 Deploy Preview https://deploy-preview-572--farfetched.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 project configuration.

Copy link

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 adds support for React Native's Response object implementation, which doesn't include the Streams API. React Native responses have response.body set to null/undefined and lack the tee() method.

Changes:

  • Modified response handling to detect Streams API availability and fallback to response.clone() for React Native
  • Updated the drain function to check for WritableStream availability and use stream.cancel() as a fallback
  • Added comprehensive test coverage for React Native compatibility scenarios

Reviewed changes

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

Show a summary per file
File Description
packages/core/src/libs/lohyphen/drain.ts Added WritableStream availability check with fallback to stream.cancel() for React Native
packages/core/src/libs/lohyphen/__tests__/drain.test.ts Added comprehensive tests for drain function including React Native environment simulation
packages/core/src/fetch/json.ts Modified checkEmptyResponse to detect Streams API and use response.clone() fallback for React Native
packages/core/src/fetch/api.ts Updated response cloning logic to handle both Streams API and React Native environments
packages/core/src/fetch/__tests__/react_native_compat.test.ts Added comprehensive test suite for React Native compatibility using a proxy-based Response mock
.changeset/tricky-balloons-swim.md Added changeset entry for the patch

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

Copy link
Member

@igorkamyshev igorkamyshev left a comment

Choose a reason for hiding this comment

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

Безумие!

@AlexandrHoroshih AlexandrHoroshih merged commit e309d0b into master Jan 21, 2026
16 checks passed
@AlexandrHoroshih AlexandrHoroshih deleted the fix-react-native-body branch January 21, 2026 16:35
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