Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Border does not appear in styling RectButton #477

Closed
yodaheis opened this issue Feb 26, 2019 · 14 comments · Fixed by #2798
Closed

Border does not appear in styling RectButton #477

yodaheis opened this issue Feb 26, 2019 · 14 comments · Fixed by #2798
Assignees
Labels
Bug BugBash 31.03 Important This seem to be a serious issue and we will need to take a deeper look into it some time soon Platform: Android This issue is specific to Android

Comments

@yodaheis
Copy link

@pcooney10 �I'm facing the issue of border not appearing on Android. It does work well on iOS though.
style props like borderRadius works, but borderWidth, borderColor does not work on Android

Originally posted by @yodaheis in #225 (comment)

I would like to bring to your attention border styling related issues on Android.
Border doesn't appear on Android while it works well on iOS.

Environment:
expo: 32.0.0

@vladkosinov
Copy link

Also there is no ability to apply borderTopStartRadius, borderTopEndRadius, borderBottomStartRadius, borderBottomEndRadius properties to RectButton

@kafkas
Copy link

kafkas commented Sep 11, 2019

I found that, for IOS, borderWidth works as expected but borderBottomWidth and borderTopWidth do not work. For Android, none of the three works.

@ribbit-rota
Copy link

Any update on this one?

@erickjth
Copy link

Same here

@leandrosouzaa
Copy link

Any update?

@guitexa
Copy link

guitexa commented Aug 16, 2020

not working on Android

@jakub-gonet
Copy link
Member

jakub-gonet commented Aug 25, 2020

<RectButton /> is based on native RNGestureHandlerButton component which does implement borderRadius in a way that prevents using individual corners (here's more info about that).

It also doesn't support setting borderWidth, nor borderWidth.

iOS implementation subclasses standard RCTViewManager class and supports every property that <View /> supports.

Hard to say if it will be fixed in the near future, but I'll keep it in my issues-that-should-be-fixed-sometime list 🙂

Code example showing this issue:

import React from 'react';
import { SafeAreaView, Text } from 'react-native';
import { RectButton } from 'react-native-gesture-handler';

const stylesToTest = {
  borderRadius: 20, // works
  borderWidth: 5, // doesn't work on android
  borderColor: 'lightblue', // doesn't work on android
};

export default () => {
  return (
    <SafeAreaView style={styles.container}>
      <RectButton style={[styles.rectangle, stylesToTest]}>
        <Text>Press me!</Text>
      </RectButton>
    </SafeAreaView>
  );
};

const styles = {
  container: { flex: 1, justifyContent: 'center', alignItems: 'center' },
  rectangle: {
    backgroundColor: 'pink',
    width: 100,
    height: 100,
    alignItems: 'center',
    justifyContent: 'center',
  },
};

@jakub-gonet jakub-gonet added Platform: Android This issue is specific to Android Bug Important This seem to be a serious issue and we will need to take a deeper look into it some time soon labels Aug 25, 2020
@jrihan
Copy link

jrihan commented Oct 21, 2020

same here

@leandrosouzaa
Copy link

same here

try add the rect button inside a view.

@pauloels
Copy link

pauloels commented Dec 9, 2020

same here

@Gitarcitano
Copy link

Any update? Having the same problem here!

@euthribeiro
Copy link

This is because RectButton preserves the native shape of each platform. To solve this you can wrap your RectButton inside a View and style the View

@a-eid
Copy link

a-eid commented Jan 17, 2022

I'm wondering if there is any update on this. @jakub-gonet

@DenisDov
Copy link

DenisDov commented Dec 12, 2023

i do that way:

<RectButton
  hitSlop={16}
  style={{
    borderRadius: 14,
    backgroundColor: "white",
  }}
>
  <View
    style={{
      width: 28,
      height: 28,
      borderRadius: 14,
      alignItems: "center",
      justifyContent: "center",
      borderWidth: 1,
      borderColor: "#EAEAEA",
    }}
  >
    <Text>+</Text>
  </View>
</RectButton>

j-piasecki added a commit that referenced this issue Mar 5, 2024
## Description
This PR is intended to allow the use of different border radius values
on the RectButton component. As mentioned in comments on #477 , it
doesn’t work on Android.
I tried to follow the same implementation pattern from `borderRadius`,
but using `setCornerRadii` method when informed at least one prop from
specific corner.
Also, it is possible to merge the values from `borderRadius` or from
specific corner.

<!--
Description and motivation for this PR.

Include 'Fixes #<number>' if this is fixing some issue.
-->

## Test plan

<!--
Describe how did you test this change here.
-->
I added a component (RectButtonBorders) on example app with some
variations of values to test the changes.

---------

Co-authored-by: Jakub Piasecki <[email protected]>
j-piasecki pushed a commit that referenced this issue Mar 11, 2024
## Description

This PR enables the use of `borderWidth`, `borderColor` and
`borderStyle` to style the `RectButton` component on Android.
It's a continuation of #2792 

Fixes #477 

## Test plan

Some examples were added to the `RectButtonBorders` screen in the
example app using the border styles changed in this PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug BugBash 31.03 Important This seem to be a serious issue and we will need to take a deeper look into it some time soon Platform: Android This issue is specific to Android
Projects
None yet
Development

Successfully merging a pull request may close this issue.