Skip to content

Android: Setting top border radius breakes visibility of side borders #36569

@ar-clue

Description

@ar-clue

Description

Left or right border visibility is broken when accordingly borderTopLeftRadius or borderTopRightRadius style property is applied.

Tested on fresh React Native 0.71.0 project with Pixel 3XL emulator and Redmi Note 7 real device.

Screenshot 2023-03-22 at 12 21 28

React Native Version

0.71.0

Output of npx react-native info

System:
OS: macOS 12.0.1
CPU: (8) x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
Memory: 80.16 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 19.7.0 - /usr/local/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 9.5.0 - /usr/local/bin/npm
Watchman: 2023.02.20.00 - /usr/local/bin/watchman
Managers:
CocoaPods: Not Found
SDKs:
iOS SDK:
Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
Android SDK: Not Found
IDEs:
Android Studio: 2022.1 AI-221.6008.13.2211.9514443
Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild
Languages:
Java: 11.0.18 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.2.0 => 18.2.0
react-native: 0.71.0 => 0.71.0
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Steps to reproduce

  1. Start fresh React Native project version 0.71.0 and apply styles from code example

Snack, code example, screenshot, or link to a repository

import React from 'react';
import type {PropsWithChildren} from 'react';
import {
  SafeAreaView,
  ScrollView,
  StatusBar,
  StyleSheet,
  Text,
  useColorScheme,
  View,
} from 'react-native';

import {Colors, Header} from 'react-native/Libraries/NewAppScreen';

type SectionProps = PropsWithChildren<{
  title: string;
}>;

function Section({children, title}: SectionProps): JSX.Element {
  const isDarkMode = useColorScheme() === 'dark';
  return (
    <View style={styles.sectionContainer}>
      <Text
        style={[
          styles.sectionTitle,
          {
            color: isDarkMode ? Colors.white : Colors.black,
          },
        ]}>
        {title}
      </Text>
      <Text
        style={[
          styles.sectionDescription,
          {
            color: isDarkMode ? Colors.light : Colors.dark,
          },
        ]}>
        {children}
      </Text>
    </View>
  );
}

function App(): JSX.Element {
  const isDarkMode = useColorScheme() === 'dark';

  const backgroundStyle = {
    backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
  };

  return (
    <SafeAreaView style={backgroundStyle}>
      <StatusBar
        barStyle={isDarkMode ? 'light-content' : 'dark-content'}
        backgroundColor={backgroundStyle.backgroundColor}
      />
      <ScrollView
        contentInsetAdjustmentBehavior="automatic"
        style={backgroundStyle}>
        <Header />
        <View
          style={{
            backgroundColor: isDarkMode ? Colors.black : Colors.white,
          }}>
          <Section title="Top border radius bug" />
          <View style={styles.bordersContainer}>
            <View style={styles.blackTopBorder} />
            <View style={styles.redTopBorder} />
          </View>
          <Section title="Working bottom borders radius" />
          <View style={styles.bordersContainer}>
            <View style={styles.blackBottomBorder} />
            <View style={styles.redBottomBorder} />
          </View>
          <View />
        </View>
      </ScrollView>
    </SafeAreaView>
  );
}

const styles = StyleSheet.create({
  sectionContainer: {
    marginTop: 32,
    paddingHorizontal: 24,
  },
  sectionTitle: {
    fontSize: 24,
    fontWeight: '600',
  },
  sectionDescription: {
    marginTop: 8,
    fontSize: 18,
    fontWeight: '400',
  },
  highlight: {
    fontWeight: '700',
  },
  redTopBorder: {
    width: 50,
    height: 50,
    borderColor: 'red',
    borderTopWidth: 4,
    borderRightWidth: 4,
    borderTopRightRadius: 10,
    margin: 10,
  },
  blackTopBorder: {
    width: 50,
    height: 50,
    borderColor: 'black',
    borderTopWidth: 4,
    borderLeftWidth: 4,
    borderTopLeftRadius: 10,
    margin: 10,
  },
  redBottomBorder: {
    width: 50,
    height: 50,
    borderColor: 'red',
    borderBottomWidth: 4,
    borderRightWidth: 4,
    borderBottomRightRadius: 10,
    margin: 10,
  },
  blackBottomBorder: {
    width: 50,
    height: 50,
    borderColor: 'black',
    borderBottomWidth: 4,
    borderLeftWidth: 4,
    borderBottomLeftRadius: 10,
    margin: 10,
  },
  bordersContainer: {
    flexDirection: 'row',
    marginLeft: 30,
  },
});

export default App;

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions