facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
119.49k stars 24.37k forks source link

[Bug] 0.76 with new arch off - border-radius with non-integer values causes faded bottom padding #47235

Open ospfranco opened 1 month ago

ospfranco commented 1 month ago

Description

I have just updated to RN 0.76 and seeing some weird behavior with non integer values when applying corner radius. It creates a bottom padding that has a faded color.

Steps to reproduce

Create a simple view and apply the following values:

  return (
    <View className="h-full bg-indigo-900 p-4">
      <View
        style={{
          marginVertical: 400,
          borderTopLeftRadius: 10,
          borderTopRightRadius: 10,
          backgroundColor: 'white',
          padding: 14,
        }}
      />
    </View>

The output should look like this:

OSP 000480

But instead it looks like this:

OSP 000479

React Native Version

0.76.0

Affected Platforms

Runtime - iOS

Output of npx react-native info

System:
  OS: macOS 15.0.1
  CPU: (11) arm64 Apple M3 Pro
  Memory: 223.63 MB / 36.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.13.1
    path: ~/.local/share/mise/installs/node/20/bin/node
  Yarn:
    version: 4.5.1
    path: ~/.local/share/mise/installs/node/20/bin/yarn
  npm:
    version: 10.5.2
    path: ~/.local/share/mise/installs/node/20/bin/npm
  Watchman:
    version: 2024.10.21.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /Users/osp/.local/share/mise/installs/ruby/3/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.0
      - iOS 18.0
      - macOS 15.0
      - tvOS 18.0
      - visionOS 2.0
      - watchOS 11.0
  Android SDK:
    API Levels:
      - "33"
      - "34"
      - "35"
    Build Tools:
      - 30.0.3
      - 33.0.0
      - 33.0.1
      - 34.0.0
      - 35.0.0
      - 35.0.0
    System Images:
      - android-33 | Google Play ARM 64 v8a
    Android NDK: 26.1.10909125
IDEs:
  Android Studio: 2024.2 AI-242.23339.11.2421.12483815
  Xcode:
    version: 16.0/16A242d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 21.0.3
    path: /usr/bin/javac
  Ruby:
    version: 3.3.1
    path: /Users/osp/.local/share/mise/installs/ruby/3/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.0
    wanted: ^15.0.0
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.0
    wanted: 0.76.0
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: false
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Stacktrace or Logs

*

Reproducer

https://github.com/ospfranco/border-radius-bug

Screenshots and Videos

No response

react-native-bot commented 1 month ago
:warning: Missing Reproducible Example
:information_source: We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.
react-native-bot commented 1 month ago
:warning: Missing Reproducible Example
:information_source: We could not detect a reproducible example in your issue report. Please provide either:
ospfranco commented 1 month ago

Managed to reproduce it, it's only happening when new arch is turned off

https://github.com/ospfranco/border-radius-bug

xuqianjin commented 2 weeks ago

same issue

SkrChowdhury commented 2 weeks ago

same issue for API Level 34

MobinAkhter commented 2 weeks ago

Hi, I'm going to try and come up with a solution for this issue. Can you please assign it to me?

MobinAkhter commented 1 week ago

Hi @ospfranco. I don't get the same issue, it works fine for me, with the following code:

import React from 'react';
import {View, StyleSheet} from 'react-native';

const App = () => {
  return (
    <View style={styles.container}>
      <View
        style={{
          marginVertical: 400,
          borderTopLeftRadius: 10,
          borderTopRightRadius: 10,
          backgroundColor: 'white',
          padding: 14,
        }}
      />
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#4F46E5',
    padding: 16,
  },
});

export default App;

I tested this on React Native 0.76.2 and React 18.3.1 on iOS 18.0 simultor. The app renders as expected without any faded bottom padding. I noticed that you're using Tailwind css in your code 'className="h-full bg-indigo-900 p-4"'. It's possible that the issue might be related to how Tailwind integrates with React Native in your setup. Could you please share your package.json and any relevant Tailwind configurations?

Thanks

ospfranco commented 1 week ago

You need to turn off the new arch. Did you run the reproduction I posted?

MobinAkhter commented 5 days ago

Thanks for pointing me into the right direction. I was able to replicate it. Let me see if I can come up with a solution for this.