Skip to content

Fix View style payloads that Props 2.0 sends wrong or drops (#59078) - #59078

Open
bartlomiejbloniarz wants to merge 2 commits into
mainfrom
bartlomiejbloniarz/props2-view-style-payloads
Open

bartlomiejbloniarz wants to merge 2 commits into
mainfrom
bartlomiejbloniarz/props2-view-style-payloads

Conversation

@bartlomiejbloniarz

@bartlomiejbloniarz bartlomiejbloniarz commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary:
With Props 2.0 on Android (enableExclusivePropsUpdateAndroid and the related flags), ReactViewManager receives the payload from HostPlatformViewProps::getDiffProps. Some style props come out wrong:

  • backgroundSize, backgroundPosition, backgroundRepeat: never sent, so a tiled gradient fills the whole view.
  • A perspective transform: sent as perspectiveX, which Android ignores.
  • A removed side border width: sent as 0 instead of falling back to borderWidth.
  • boxShadow or drop-shadow without a color: transparent instead of black.
  • A removed shadowColor: sent as 0, so the elevation shadow disappears.
  • A gradient color hint, as in linear-gradient(red, 20%, blue): drawn as a transparent stop.

This PR sends each of them the way the Java side reads them. Nothing changes with the flags off, except that the animation backend shares the transform code and now also sends perspective.

Changelog:

[ANDROID] [FIXED] - Fix View background, perspective, border width, shadow and gradient props with Props 2.0

Test Plan:

  • New ViewPropsDiffTest, using the payload helper from Fix Image payloads that Props 2.0 sends wrong or drops (#59077) #59077. Each test fails on main. Built with the NDK and run on an Android emulator (there is no open-source gtest target).
  • RNTester on an Android emulator with the Props 2.0 flags forced on: the BackgroundImage example and the Playground screen below.

Gradient with Background Repeat

BeforeAfter
c3-before-props2.mp4
c3-after-props2.mp4

Flip a card with perspective: 400

BeforeAfter
c8-before-props2.mp4
c8-after-props2.mp4

Remove borderLeftWidth (borderWidth: 8)

BeforeAfter
c9-before-props2.mp4
c9-after-props2.mp4

boxShadow and drop-shadow without a color

BeforeAfter
shadows-before-props2.mp4
shadows-after-props2.mp4

Remove shadowColor (elevation: 24)

BeforeAfter
shadowcolor-before-props2.mp4
shadowcolor-after-props2.mp4

Add a 20% color hint

BeforeAfter
gradient-before-props2.mp4
gradient-after-props2.mp4
RNTesterPlayground.js: paste into packages/rn-tester/js/examples/Playground/RNTesterPlayground.js and open Playground.
/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * flow strict-local
 * format
 */

import type {RNTesterModuleExample} from '../../types/RNTesterTypes';

import * as React from 'react';
import {useState} from 'react';
import {Button, StyleSheet, Text, View} from 'react-native';

function Perspective() {
  const [on, setOn] = useState(false);
  return (
    <View>
      <Button
        testID="toggle"
        title={on ? 'Flip back' : 'Flip card'}
        onPress={() => setOn(v => !v)}
      />
      <Text testID="state">
        transform: perspective 400, rotateY {on ? '60deg' : '0deg'}
      </Text>
      <View style={styles.row}>
        <View
          style={[
            styles.card,
            {transform: [{perspective: 400}, {rotateY: on ? '60deg' : '0deg'}]},
          ]}>
          <Text style={styles.cardText}>CARD</Text>
        </View>
      </View>
    </View>
  );
}

function Border() {
  const [on, setOn] = useState(true);
  return (
    <View>
      <Button
        testID="toggle"
        title={on ? 'Remove borderLeftWidth' : 'Set borderLeftWidth'}
        onPress={() => setOn(v => !v)}
      />
      <Text testID="state">
        borderWidth 8{on ? ', borderLeftWidth 32' : ''}
      </Text>
      <View style={styles.row}>
        <View style={[styles.bordered, on && {borderLeftWidth: 32}]} />
      </View>
    </View>
  );
}

function Shadows() {
  const [on, setOn] = useState(true);
  return (
    <View>
      <Button
        testID="toggle"
        title={on ? 'Remove shadows' : 'Set shadows'}
        onPress={() => setOn(v => !v)}
      />
      <Text testID="state">
        {on ? 'boxShadow, drop-shadow: no color' : 'no shadows'}
      </Text>
      <View style={styles.row}>
        <View style={[styles.box, on && {boxShadow: '0 12px 16px'}]}>
          <Text>boxShadow</Text>
        </View>
        <View style={[styles.box, on && {filter: 'drop-shadow(0 12px 6px)'}]}>
          <Text>drop-shadow</Text>
        </View>
      </View>
    </View>
  );
}

function ShadowColor() {
  const [on, setOn] = useState(true);
  return (
    <View>
      <Button
        testID="toggle"
        title={on ? 'Remove shadowColor' : 'Set shadowColor'}
        onPress={() => setOn(v => !v)}
      />
      <Text testID="state">
        elevation 24, shadowColor {on ? 'red' : 'unset'}
      </Text>
      <View style={styles.row}>
        <View style={[styles.box, styles.elevated, on && {shadowColor: 'red'}]}>
          <Text>elevation</Text>
        </View>
      </View>
    </View>
  );
}

function Gradient() {
  const [hint, setHint] = useState(false);
  return (
    <View>
      <Button
        testID="toggle"
        title={hint ? 'Remove the 20% hint' : 'Add a 20% hint'}
        onPress={() => setHint(v => !v)}
      />
      <Text testID="state">
        linear-gradient(red, {hint ? '20%, ' : ''}blue)
      </Text>
      <View style={styles.row}>
        <View
          style={[
            styles.gradient,
            {
              backgroundImage: hint
                ? 'linear-gradient(red, 20%, blue)'
                : 'linear-gradient(red, blue)',
            },
          ]}
        />
      </View>
    </View>
  );
}

const demos = {
  perspective: Perspective,
  border: Border,
  shadows: Shadows,
  shadowColor: ShadowColor,
  gradient: Gradient,
};

function Playground() {
  const [demo, setDemo] = useState<$Keys<typeof demos>>('perspective');
  const Demo = demos[demo];
  return (
    <View style={styles.container}>
      <View style={styles.tabs}>
        {Object.keys(demos).map(name => (
          <Button
            key={name}
            testID={'tab-' + name}
            title={name}
            onPress={() => setDemo(name)}
          />
        ))}
      </View>
      <Demo key={demo} />
    </View>
  );
}

const styles = StyleSheet.create({
  bordered: {
    backgroundColor: '#ffd54f',
    borderColor: '#1a237e',
    borderWidth: 8,
    height: 120,
    width: 200,
  },
  box: {
    alignItems: 'center',
    backgroundColor: 'white',
    borderRadius: 12,
    height: 120,
    justifyContent: 'center',
    margin: 16,
    width: 140,
  },
  card: {
    alignItems: 'center',
    backgroundColor: '#1e88e5',
    height: 140,
    justifyContent: 'center',
    width: 200,
  },
  cardText: {color: 'white', fontSize: 28, fontWeight: 'bold'},
  container: {padding: 10},
  elevated: {elevation: 24},
  gradient: {height: 160, width: 240},
  row: {
    alignItems: 'center',
    flexDirection: 'row',
    flexWrap: 'wrap',
    justifyContent: 'center',
    marginTop: 24,
  },
  tabs: {flexDirection: 'row', flexWrap: 'wrap', gap: 6, marginBottom: 12},
});

export default {
  title: 'Playground',
  name: 'playground',
  description: 'Test out new features and ideas.',
  render: (): React.Node => <Playground />,
} as RNTesterModuleExample;

Differential Revision: D125438461

Pulled By: bartlomiejbloniarz

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 14, 2026
@facebook-github-tools facebook-github-tools Bot added p: Software Mansion Partner: Software Mansion Partner p: Facebook Partner: Facebook labels Oct 14, 2026
@bartlomiejbloniarz
bartlomiejbloniarz force-pushed the bartlomiejbloniarz/props2-view-style-payloads branch from e0530d9 to e507bbc Compare October 14, 2026 17:38
@meta-codesync

meta-codesync Bot commented Oct 15, 2026

Copy link
Copy Markdown

@bartlomiejbloniarz has imported this pull request. If you are a Meta employee, you can view this in D125438461.

Summary:
With Props 2.0 on Android (`enableExclusivePropsUpdateAndroid` and the related flags), `ReactImageManager` receives the payload from `ImageProps::getDiffProps`. Some Image props come out wrong:

- Several sources or `srcSet`: crash with `NoSuchKeyException: width`, because each source's size is nested under `size`.
- `headers`: never sent, and not cleared when the new source has none.
- A source with the same URI but different headers, cache, size or scale: not sent.
- A removed `tintColor`: sent as `0`, so the image disappears.

This PR sends each of them the way the Java side reads them. Nothing changes with the flags off.

## Changelog:

[ANDROID] [FIXED] - Fix Image sources, headers and a removed tintColor with Props 2.0

Pull Request resolved: #59077

Test Plan:
- New `ImagePropsDiffTest`. It uses a small helper, `PropsPayloads.h`, that checks each Props 2.0 payload against what Props 1.5 sends for the same prop updates. Each test fails on main. Built with the NDK and run on an Android emulator (there is no open-source gtest target).
- RNTester on an Android emulator with the Props 2.0 flags forced on.

**Image example: `srcSet` and several sources**

<table>
<tr><th>Before</th><th>After</th></tr>
<tr>
<td>

https://github.com/user-attachments/assets/483306f2-f308-401e-8f4c-809337ec2292

</td>
<td>

https://github.com/user-attachments/assets/cf978447-071e-4537-8d3f-31e663f42bc0

</td>
</tr>
</table>

**Remove `tintColor` (Playground screen below)**

<table>
<tr><th>Before</th><th>After</th></tr>
<tr>
<td>

https://github.com/user-attachments/assets/349be881-8de6-4731-b01b-362fabd0278f

</td>
<td>

https://github.com/user-attachments/assets/04a7e35a-a64a-4317-8d91-cc30a7534b0d

</td>
</tr>
</table>

<details><summary><code>RNTesterPlayground.js</code>: paste into <code>packages/rn-tester/js/examples/Playground/RNTesterPlayground.js</code> and open Playground.</summary>

```js
/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * flow strict-local
 * format
 */

import type {RNTesterModuleExample} from '../../types/RNTesterTypes';

import * as React from 'react';
import {useState} from 'react';
import {Button, Image, StyleSheet, Text, View} from 'react-native';

function Tint() {
  const [on, setOn] = useState(true);
  return (
    <View>
      <Button
        testID="toggle"
        title={on ? 'Remove tintColor' : 'Set tintColor'}
        onPress={() => setOn(v => !v)}
      />
      <Text testID="state">tintColor: {on ? 'purple' : 'unset'}</Text>
      <View style={styles.row}>
        <Image
          source={require('../../assets/bunny.png')}
          style={[styles.image, on && {tintColor: 'purple'}]}
        />
      </View>
    </View>
  );
}

function Playground() {
  return (
    <View style={styles.container}>
      <Tint />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {padding: 10},
  image: {backgroundColor: '#e0e0e0', height: 160, width: 160},
  row: {
    alignItems: 'center',
    flexDirection: 'row',
    flexWrap: 'wrap',
    justifyContent: 'center',
    marginTop: 24,
  },
});

export default {
  title: 'Playground',
  name: 'playground',
  description: 'Test out new features and ideas.',
  render: (): React.Node => <Playground />,
} as RNTesterModuleExample;
```

</details>

Differential Revision: D125438476

Pulled By: bartlomiejbloniarz
meta-codesync Bot pushed a commit that referenced this pull request Oct 15, 2026
Summary:
With Props 2.0 on Android (`enableExclusivePropsUpdateAndroid` and the related flags), `ReactViewManager` receives the payload from `HostPlatformViewProps::getDiffProps`. Some style props come out wrong:

- `backgroundSize`, `backgroundPosition`, `backgroundRepeat`: never sent, so a tiled gradient fills the whole view.
- A `perspective` transform: sent as `perspectiveX`, which Android ignores.
- A removed side border width: sent as `0` instead of falling back to `borderWidth`.
- `boxShadow` or `drop-shadow` without a color: transparent instead of black.
- A removed `shadowColor`: sent as `0`, so the elevation shadow disappears.
- A gradient color hint, as in `linear-gradient(red, 20%, blue)`: drawn as a transparent stop.

This PR sends each of them the way the Java side reads them. Nothing changes with the flags off, except that the animation backend shares the transform code and now also sends `perspective`.

## Changelog:

[ANDROID] [FIXED] - Fix View background, perspective, border width, shadow and gradient props with Props 2.0

Pull Request resolved: #59078

Test Plan:
- New `ViewPropsDiffTest`, using the payload helper from #59077. Each test fails on main. Built with the NDK and run on an Android emulator (there is no open-source gtest target).
- RNTester on an Android emulator with the Props 2.0 flags forced on: the BackgroundImage example and the Playground screen below.

**Gradient with Background Repeat**

<table>
<tr><th>Before</th><th>After</th></tr>
<tr>
<td>

https://github.com/user-attachments/assets/6e337636-608d-4c06-996f-914ff005528d

</td>
<td>

https://github.com/user-attachments/assets/6d346094-eff6-4b20-a1aa-693988c47048

</td>
</tr>
</table>

**Flip a card with `perspective: 400`**

<table>
<tr><th>Before</th><th>After</th></tr>
<tr>
<td>

https://github.com/user-attachments/assets/9fcdcbc0-ec94-43be-aa95-31e8d5b813c3

</td>
<td>

https://github.com/user-attachments/assets/7942a58c-f7c1-4292-aa02-edadb31924d3

</td>
</tr>
</table>

**Remove `borderLeftWidth` (`borderWidth: 8`)**

<table>
<tr><th>Before</th><th>After</th></tr>
<tr>
<td>

https://github.com/user-attachments/assets/5098d21a-2686-4d01-9120-07247832579e

</td>
<td>

https://github.com/user-attachments/assets/758dc39e-230e-45ec-81d5-098f601183d6

</td>
</tr>
</table>

**`boxShadow` and `drop-shadow` without a color**

<table>
<tr><th>Before</th><th>After</th></tr>
<tr>
<td>

https://github.com/user-attachments/assets/20fa2a78-240f-4e62-afa9-b0f687b1493c

</td>
<td>

https://github.com/user-attachments/assets/2c6257f5-e978-4710-b0b9-b1fdb34f1052

</td>
</tr>
</table>

**Remove `shadowColor` (`elevation: 24`)**

<table>
<tr><th>Before</th><th>After</th></tr>
<tr>
<td>

https://github.com/user-attachments/assets/e74d27b5-6c1c-45f2-be88-a27b6a5fb0cd

</td>
<td>

https://github.com/user-attachments/assets/55593913-96ea-46e5-91b8-c1fd3cf53c43

</td>
</tr>
</table>

**Add a 20% color hint**

<table>
<tr><th>Before</th><th>After</th></tr>
<tr>
<td>

https://github.com/user-attachments/assets/9f2c2b2a-8b39-4e0d-9ca6-5c972c5abf75

</td>
<td>

https://github.com/user-attachments/assets/b4ab4fa6-7d92-4705-af76-bae13b091bc4

</td>
</tr>
</table>

<details><summary><code>RNTesterPlayground.js</code>: paste into <code>packages/rn-tester/js/examples/Playground/RNTesterPlayground.js</code> and open Playground.</summary>

```js
/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * flow strict-local
 * format
 */

import type {RNTesterModuleExample} from '../../types/RNTesterTypes';

import * as React from 'react';
import {useState} from 'react';
import {Button, StyleSheet, Text, View} from 'react-native';

function Perspective() {
  const [on, setOn] = useState(false);
  return (
    <View>
      <Button
        testID="toggle"
        title={on ? 'Flip back' : 'Flip card'}
        onPress={() => setOn(v => !v)}
      />
      <Text testID="state">
        transform: perspective 400, rotateY {on ? '60deg' : '0deg'}
      </Text>
      <View style={styles.row}>
        <View
          style={[
            styles.card,
            {transform: [{perspective: 400}, {rotateY: on ? '60deg' : '0deg'}]},
          ]}>
          <Text style={styles.cardText}>CARD</Text>
        </View>
      </View>
    </View>
  );
}

function Border() {
  const [on, setOn] = useState(true);
  return (
    <View>
      <Button
        testID="toggle"
        title={on ? 'Remove borderLeftWidth' : 'Set borderLeftWidth'}
        onPress={() => setOn(v => !v)}
      />
      <Text testID="state">
        borderWidth 8{on ? ', borderLeftWidth 32' : ''}
      </Text>
      <View style={styles.row}>
        <View style={[styles.bordered, on && {borderLeftWidth: 32}]} />
      </View>
    </View>
  );
}

function Shadows() {
  const [on, setOn] = useState(true);
  return (
    <View>
      <Button
        testID="toggle"
        title={on ? 'Remove shadows' : 'Set shadows'}
        onPress={() => setOn(v => !v)}
      />
      <Text testID="state">
        {on ? 'boxShadow, drop-shadow: no color' : 'no shadows'}
      </Text>
      <View style={styles.row}>
        <View style={[styles.box, on && {boxShadow: '0 12px 16px'}]}>
          <Text>boxShadow</Text>
        </View>
        <View style={[styles.box, on && {filter: 'drop-shadow(0 12px 6px)'}]}>
          <Text>drop-shadow</Text>
        </View>
      </View>
    </View>
  );
}

function ShadowColor() {
  const [on, setOn] = useState(true);
  return (
    <View>
      <Button
        testID="toggle"
        title={on ? 'Remove shadowColor' : 'Set shadowColor'}
        onPress={() => setOn(v => !v)}
      />
      <Text testID="state">
        elevation 24, shadowColor {on ? 'red' : 'unset'}
      </Text>
      <View style={styles.row}>
        <View style={[styles.box, styles.elevated, on && {shadowColor: 'red'}]}>
          <Text>elevation</Text>
        </View>
      </View>
    </View>
  );
}

function Gradient() {
  const [hint, setHint] = useState(false);
  return (
    <View>
      <Button
        testID="toggle"
        title={hint ? 'Remove the 20% hint' : 'Add a 20% hint'}
        onPress={() => setHint(v => !v)}
      />
      <Text testID="state">
        linear-gradient(red, {hint ? '20%, ' : ''}blue)
      </Text>
      <View style={styles.row}>
        <View
          style={[
            styles.gradient,
            {
              backgroundImage: hint
                ? 'linear-gradient(red, 20%, blue)'
                : 'linear-gradient(red, blue)',
            },
          ]}
        />
      </View>
    </View>
  );
}

const demos = {
  perspective: Perspective,
  border: Border,
  shadows: Shadows,
  shadowColor: ShadowColor,
  gradient: Gradient,
};

function Playground() {
  const [demo, setDemo] = useState<$Keys<typeof demos>>('perspective');
  const Demo = demos[demo];
  return (
    <View style={styles.container}>
      <View style={styles.tabs}>
        {Object.keys(demos).map(name => (
          <Button
            key={name}
            testID={'tab-' + name}
            title={name}
            onPress={() => setDemo(name)}
          />
        ))}
      </View>
      <Demo key={demo} />
    </View>
  );
}

const styles = StyleSheet.create({
  bordered: {
    backgroundColor: '#ffd54f',
    borderColor: '#1a237e',
    borderWidth: 8,
    height: 120,
    width: 200,
  },
  box: {
    alignItems: 'center',
    backgroundColor: 'white',
    borderRadius: 12,
    height: 120,
    justifyContent: 'center',
    margin: 16,
    width: 140,
  },
  card: {
    alignItems: 'center',
    backgroundColor: '#1e88e5',
    height: 140,
    justifyContent: 'center',
    width: 200,
  },
  cardText: {color: 'white', fontSize: 28, fontWeight: 'bold'},
  container: {padding: 10},
  elevated: {elevation: 24},
  gradient: {height: 160, width: 240},
  row: {
    alignItems: 'center',
    flexDirection: 'row',
    flexWrap: 'wrap',
    justifyContent: 'center',
    marginTop: 24,
  },
  tabs: {flexDirection: 'row', flexWrap: 'wrap', gap: 6, marginBottom: 12},
});

export default {
  title: 'Playground',
  name: 'playground',
  description: 'Test out new features and ideas.',
  render: (): React.Node => <Playground />,
} as RNTesterModuleExample;
```

</details>

Differential Revision: D125438461

Pulled By: bartlomiejbloniarz
Summary:
With Props 2.0 on Android (`enableExclusivePropsUpdateAndroid` and the related flags), `ReactViewManager` receives the payload from `HostPlatformViewProps::getDiffProps`. Some style props come out wrong:

- `backgroundSize`, `backgroundPosition`, `backgroundRepeat`: never sent, so a tiled gradient fills the whole view.
- A `perspective` transform: sent as `perspectiveX`, which Android ignores.
- A removed side border width: sent as `0` instead of falling back to `borderWidth`.
- `boxShadow` or `drop-shadow` without a color: transparent instead of black.
- A removed `shadowColor`: sent as `0`, so the elevation shadow disappears.
- A gradient color hint, as in `linear-gradient(red, 20%, blue)`: drawn as a transparent stop.

This PR sends each of them the way the Java side reads them. Nothing changes with the flags off, except that the animation backend shares the transform code and now also sends `perspective`.

## Changelog:

[ANDROID] [FIXED] - Fix View background, perspective, border width, shadow and gradient props with Props 2.0

Pull Request resolved: #59078

Test Plan:
- New `ViewPropsDiffTest`, using the payload helper from #59077. Each test fails on main. Built with the NDK and run on an Android emulator (there is no open-source gtest target).
- RNTester on an Android emulator with the Props 2.0 flags forced on: the BackgroundImage example and the Playground screen below.

**Gradient with Background Repeat**

<table>
<tr><th>Before</th><th>After</th></tr>
<tr>
<td>

https://github.com/user-attachments/assets/6e337636-608d-4c06-996f-914ff005528d

</td>
<td>

https://github.com/user-attachments/assets/6d346094-eff6-4b20-a1aa-693988c47048

</td>
</tr>
</table>

**Flip a card with `perspective: 400`**

<table>
<tr><th>Before</th><th>After</th></tr>
<tr>
<td>

https://github.com/user-attachments/assets/9fcdcbc0-ec94-43be-aa95-31e8d5b813c3

</td>
<td>

https://github.com/user-attachments/assets/7942a58c-f7c1-4292-aa02-edadb31924d3

</td>
</tr>
</table>

**Remove `borderLeftWidth` (`borderWidth: 8`)**

<table>
<tr><th>Before</th><th>After</th></tr>
<tr>
<td>

https://github.com/user-attachments/assets/5098d21a-2686-4d01-9120-07247832579e

</td>
<td>

https://github.com/user-attachments/assets/758dc39e-230e-45ec-81d5-098f601183d6

</td>
</tr>
</table>

**`boxShadow` and `drop-shadow` without a color**

<table>
<tr><th>Before</th><th>After</th></tr>
<tr>
<td>

https://github.com/user-attachments/assets/20fa2a78-240f-4e62-afa9-b0f687b1493c

</td>
<td>

https://github.com/user-attachments/assets/2c6257f5-e978-4710-b0b9-b1fdb34f1052

</td>
</tr>
</table>

**Remove `shadowColor` (`elevation: 24`)**

<table>
<tr><th>Before</th><th>After</th></tr>
<tr>
<td>

https://github.com/user-attachments/assets/e74d27b5-6c1c-45f2-be88-a27b6a5fb0cd

</td>
<td>

https://github.com/user-attachments/assets/55593913-96ea-46e5-91b8-c1fd3cf53c43

</td>
</tr>
</table>

**Add a 20% color hint**

<table>
<tr><th>Before</th><th>After</th></tr>
<tr>
<td>

https://github.com/user-attachments/assets/9f2c2b2a-8b39-4e0d-9ca6-5c972c5abf75

</td>
<td>

https://github.com/user-attachments/assets/b4ab4fa6-7d92-4705-af76-bae13b091bc4

</td>
</tr>
</table>

<details><summary><code>RNTesterPlayground.js</code>: paste into <code>packages/rn-tester/js/examples/Playground/RNTesterPlayground.js</code> and open Playground.</summary>

```js
/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * flow strict-local
 * format
 */

import type {RNTesterModuleExample} from '../../types/RNTesterTypes';

import * as React from 'react';
import {useState} from 'react';
import {Button, StyleSheet, Text, View} from 'react-native';

function Perspective() {
  const [on, setOn] = useState(false);
  return (
    <View>
      <Button
        testID="toggle"
        title={on ? 'Flip back' : 'Flip card'}
        onPress={() => setOn(v => !v)}
      />
      <Text testID="state">
        transform: perspective 400, rotateY {on ? '60deg' : '0deg'}
      </Text>
      <View style={styles.row}>
        <View
          style={[
            styles.card,
            {transform: [{perspective: 400}, {rotateY: on ? '60deg' : '0deg'}]},
          ]}>
          <Text style={styles.cardText}>CARD</Text>
        </View>
      </View>
    </View>
  );
}

function Border() {
  const [on, setOn] = useState(true);
  return (
    <View>
      <Button
        testID="toggle"
        title={on ? 'Remove borderLeftWidth' : 'Set borderLeftWidth'}
        onPress={() => setOn(v => !v)}
      />
      <Text testID="state">
        borderWidth 8{on ? ', borderLeftWidth 32' : ''}
      </Text>
      <View style={styles.row}>
        <View style={[styles.bordered, on && {borderLeftWidth: 32}]} />
      </View>
    </View>
  );
}

function Shadows() {
  const [on, setOn] = useState(true);
  return (
    <View>
      <Button
        testID="toggle"
        title={on ? 'Remove shadows' : 'Set shadows'}
        onPress={() => setOn(v => !v)}
      />
      <Text testID="state">
        {on ? 'boxShadow, drop-shadow: no color' : 'no shadows'}
      </Text>
      <View style={styles.row}>
        <View style={[styles.box, on && {boxShadow: '0 12px 16px'}]}>
          <Text>boxShadow</Text>
        </View>
        <View style={[styles.box, on && {filter: 'drop-shadow(0 12px 6px)'}]}>
          <Text>drop-shadow</Text>
        </View>
      </View>
    </View>
  );
}

function ShadowColor() {
  const [on, setOn] = useState(true);
  return (
    <View>
      <Button
        testID="toggle"
        title={on ? 'Remove shadowColor' : 'Set shadowColor'}
        onPress={() => setOn(v => !v)}
      />
      <Text testID="state">
        elevation 24, shadowColor {on ? 'red' : 'unset'}
      </Text>
      <View style={styles.row}>
        <View style={[styles.box, styles.elevated, on && {shadowColor: 'red'}]}>
          <Text>elevation</Text>
        </View>
      </View>
    </View>
  );
}

function Gradient() {
  const [hint, setHint] = useState(false);
  return (
    <View>
      <Button
        testID="toggle"
        title={hint ? 'Remove the 20% hint' : 'Add a 20% hint'}
        onPress={() => setHint(v => !v)}
      />
      <Text testID="state">
        linear-gradient(red, {hint ? '20%, ' : ''}blue)
      </Text>
      <View style={styles.row}>
        <View
          style={[
            styles.gradient,
            {
              backgroundImage: hint
                ? 'linear-gradient(red, 20%, blue)'
                : 'linear-gradient(red, blue)',
            },
          ]}
        />
      </View>
    </View>
  );
}

const demos = {
  perspective: Perspective,
  border: Border,
  shadows: Shadows,
  shadowColor: ShadowColor,
  gradient: Gradient,
};

function Playground() {
  const [demo, setDemo] = useState<$Keys<typeof demos>>('perspective');
  const Demo = demos[demo];
  return (
    <View style={styles.container}>
      <View style={styles.tabs}>
        {Object.keys(demos).map(name => (
          <Button
            key={name}
            testID={'tab-' + name}
            title={name}
            onPress={() => setDemo(name)}
          />
        ))}
      </View>
      <Demo key={demo} />
    </View>
  );
}

const styles = StyleSheet.create({
  bordered: {
    backgroundColor: '#ffd54f',
    borderColor: '#1a237e',
    borderWidth: 8,
    height: 120,
    width: 200,
  },
  box: {
    alignItems: 'center',
    backgroundColor: 'white',
    borderRadius: 12,
    height: 120,
    justifyContent: 'center',
    margin: 16,
    width: 140,
  },
  card: {
    alignItems: 'center',
    backgroundColor: '#1e88e5',
    height: 140,
    justifyContent: 'center',
    width: 200,
  },
  cardText: {color: 'white', fontSize: 28, fontWeight: 'bold'},
  container: {padding: 10},
  elevated: {elevation: 24},
  gradient: {height: 160, width: 240},
  row: {
    alignItems: 'center',
    flexDirection: 'row',
    flexWrap: 'wrap',
    justifyContent: 'center',
    marginTop: 24,
  },
  tabs: {flexDirection: 'row', flexWrap: 'wrap', gap: 6, marginBottom: 12},
});

export default {
  title: 'Playground',
  name: 'playground',
  description: 'Test out new features and ideas.',
  render: (): React.Node => <Playground />,
} as RNTesterModuleExample;
```

</details>

Differential Revision: D125438461

Pulled By: bartlomiejbloniarz
@meta-codesync
meta-codesync Bot force-pushed the bartlomiejbloniarz/props2-view-style-payloads branch from e507bbc to 2a81f9f Compare October 15, 2026 12:03
@meta-codesync meta-codesync Bot changed the title [Android] Fix View style payloads that Props 2.0 sends wrong or drops Fix View style payloads that Props 2.0 sends wrong or drops (#59078) Oct 15, 2026
@meta-codesync

meta-codesync Bot commented Oct 15, 2026

Copy link
Copy Markdown

@bartlomiejbloniarz has exported this pull request. If you are a Meta employee, you can view the originating Diff in D125438461.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported p: Facebook Partner: Facebook p: Software Mansion Partner: Software Mansion Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant