Skip to content

[Android] border radius is not set for views that initially has a transparent background color and transitions to an opaque color #52415

Description

@itsramiel

Description

On Android, if the background color of a view with border radius is toggled between a transparent and opaque color, the border radius is lost when transitioning from transparent to opaque.

Steps to reproduce

  1. create a view with border radius
  2. conditionally switch its background color from transparent to an opaque color

React Native Version

0.80.1

Affected Platforms

Runtime - Android

Output of npx @react-native-community/cli info

bash
info Fetching system and libraries information...
System:
  OS: macOS 15.5
  CPU: (14) arm64 Apple M3 Max
  Memory: 1.64 GB / 36.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 22.14.0
    path: ~/.nvm/versions/node/v22.14.0/bin/node
  Yarn:
    version: 1.22.22
    path: ~/.nvm/versions/node/v22.14.0/bin/yarn
  npm:
    version: 10.9.2
    path: ~/.nvm/versions/node/v22.14.0/bin/npm
  Watchman:
    version: 2025.04.14.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /Users/itsramiel/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.5
      - iOS 18.5
      - macOS 15.5
      - tvOS 18.5
      - visionOS 2.5
      - watchOS 11.5
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.3 AI-243.24978.46.2431.13363775
  Xcode:
    version: 16.4/16F6
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.10
    path: /usr/bin/javac
  Ruby:
    version: 3.4.3
    path: /Users/itsramiel/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 19.0.0
    wanted: 19.0.0
  react:
    installed: 19.1.0
    wanted: 19.1.0
  react-native:
    installed: 0.80.1
    wanted: 0.80.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

Stacktrace or Logs

There is no crash or failure to provide

MANDATORY Reproducer

https://github.com/itsramiel/BorderRadiusAndroid

Screenshots and Videos

Given the following app(same as reproducer):

Example App
import { useState } from 'react';
import { Pressable, StyleSheet, View } from 'react-native';

function App() {
  const [isToggled, setIsToggled] = useState(false);

  return (
    <View style={styles.container}>
      <Pressable
        onPress={() => setIsToggled(!isToggled)}
        style={{ backgroundColor: 'blue' }}
      >
        <View
          style={{
            width: 50,
            height: 50,
            borderRadius: 25,
            backgroundColor: isToggled ? 'red' : 'transparent',
          }}
        />
      </Pressable>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
  },
});

export default App;

If I press on the blue container, it will switch a state value which toggles the background color from transparent to red. Notice that on Android the red container is square even though border radius is set:

Recording

iOS(Works ✅) Android(Buggy ❌)
Screen.Recording.2025-07-04.at.9.04.08.AM.mov
Screen.Recording.2025-07-04.at.9.03.45.AM.mov

Activity

  1. devanshsaini11 commented on Jul 7, 2025

    @devanshsaini11
    Collaborator

    @itsramiel Thanks for raising this, I was able to reproduce this locally.

  2. devanshsaini11 commented on Sep 2, 2025

    @devanshsaini11
    Collaborator

    Hi @cortinico can you assign this issue to me? I am looking into it

  3. sregg commented on Oct 9, 2025

    @sregg

    Has anyone found a workaround for this? It seems that forcing re-render by setting a different key based on the state (e.g. <View key={isToggled}) does the trick but we don't want to do that for all buttons.

  4. sregg commented on Oct 11, 2025

    @sregg

    There's another very hacky workaround: set a white color with 99% transparency.

  5. yongming-ytl commented on Oct 13, 2025

    @yongming-ytl

    I can reproduce similar issue on my end. When applying a conditional backgroundColor prop to the dot style, the borderRadius property is not working.

    dot: {
            width: 4,
            height: 4,
            borderRadius: 999,
            borderCurve: 'continuous',
    },
    

    My temporary solution is to set a base backgroundColor on the dot to match my screen backgroundColor in order to make it seems invisible. With that, applying conditional backgroundColor will display the dot in perfect circle.

    Not sure if this behaviour is intentional, but it’d be great if this could be fixed or clarified.

  6. added a commit that references this issue on May 6, 2026
  7. andrei-micuda commented on Sep 28, 2026

    @andrei-micuda

    Still reproduces on 0.81.5 (Expo SDK 54, new architecture, Android emulator).

    Narrowed on device, 60×60 View with borderRadius: 30, background switched on after mount:

    • undefined or transparent → colour: square
    • colour → another colour: round
    • background and borderRadius changing in the same render: round
    • background present from mount: round

    Two more workarounds besides the key and near-transparent ones mentioned above, both keep the radius without remounting:

    • overflow: 'hidden' on the View
    • a border of any width, even borderWidth: 1, borderColor: 'transparent'
  8. gigobyte commented on Oct 10, 2026

    @gigobyte

    Still reproduces on 0.86.3

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

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions