microsoft / microsoft/react-native-windows

Array.prototype.flat() Method Breaks Application in Release Build

Open
#11,952 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area: JavaScript Engine bug workaround exists Workstream: Component Parity
Dominant language
C++
Stars
17.3k
Forks
1.2k
Avg merge
1d 13h
Merged PRs (30d)
33

Description

Problem Description

When calling Array.prototype.flat() in a react-native-windows project, the release build is broken, while the debug build runs smoothly.

Steps To Reproduce
  1. As a minimal reproducible example, a component such as the following may be created:
import React from "react";
import { StyleSheet, View } from "react-native";

export default function() {
    return (
        <View style={[...[styles.content].flat()]} />
    );
}

const styles = StyleSheet.create({
    content: {
        flex: 1,
    },
});

(Alternatively, as a more complete example, the DropDownPicker component from the library react-native-dropdown-picker may be used in a project. Internally, the library calls Array.prototype.flat() in multiple places.)

  1. A debug build from the project shall be created by running:
npx react-native run-windows

The expected behavior is that in the debug build, the application runs smoothly.

  1. A release build from the project shall be created by running:
npx react-native run-windows --release

In the release build, the app will show a blank screen.

Expected Results

The expected behavior is that the application will show a blank screen. This depends on when the element becomes active:

  • when the element is active on the initial screen, the app will start and show blank view immediately
  • when the element is switched active on user interaction while the app is already running, the app will become a blank view
CLI version

10.2.2

Environment
npx react-native -v: 10.2.2
npm ls react-native-windows: react-native-windows@0.71.11
npm -v: 9.5.0
node -v: v18.15.0
msbuild version: 17.6.33815.320
<UseHermes>false</UseHermes>
Target Platform Version

10.0.19041

Target Device(s)

Desktop

Visual Studio Version

Visual Studio 2022

Build Configuration

Release

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is identified. First reproduce the issue with the provided react-native-windows 0.71.11 commands, comparing debug and release behavior with Array.prototype.flat(); done means the release build no longer becomes a blank screen while the same example remains functional.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react-native
Domain
build-system, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.