react-native-gesture-handler icon indicating copy to clipboard operation
react-native-gesture-handler copied to clipboard

Border does not appear in styling RectButton

Open yodaheis opened this issue 5 years ago • 14 comments

@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 https://github.com/kmagiera/react-native-gesture-handler/issues/225#issuecomment-467333032

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

yodaheis avatar Feb 26 '19 07:02 yodaheis

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

vladkosinov avatar Mar 18 '19 14:03 vladkosinov

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

kafkas avatar Sep 11 '19 11:09 kafkas

Any update on this one?

ribbit-rota avatar Mar 17 '20 01:03 ribbit-rota

Same here

erickjth avatar Apr 16 '20 17:04 erickjth

Any update?

leandrosouzaa avatar Jun 10 '20 14:06 leandrosouzaa

not working on Android

guitexa avatar Aug 16 '20 03:08 guitexa

<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 avatar Aug 25 '20 13:08 jakub-gonet

same here

jrihan avatar Oct 21 '20 15:10 jrihan

same here

try add the rect button inside a view.

leandrosouzaa avatar Nov 09 '20 23:11 leandrosouzaa

same here

pauloels avatar Dec 09 '20 14:12 pauloels

Any update? Having the same problem here!

Gitarcitano avatar Apr 29 '21 17:04 Gitarcitano

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

euthribeiro avatar Jun 03 '21 17:06 euthribeiro

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

a-eid avatar Jan 17 '22 07:01 a-eid

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>

DenisDov avatar Dec 12 '23 13:12 DenisDov