react-native-navigation icon indicating copy to clipboard operation
react-native-navigation copied to clipboard

[V3] Android topBar rightButtons component not centered

Open MakhouT opened this issue 7 years ago • 13 comments

Issue Description

I have a rightButton component in my topbar. On iOS it's works and looks as expected. The issue is on android, that it is not centering

iOS image

Android image

Some snippets of code: The bottomTab Option to create the rightButton in the topBar

              topBar: {
                title: {
                  text: tab.title,
                },
                rightButtons: rightButtonAvatar(tab.name),
              },
const rightButtonAvatar = tabId => [
  {
    id: CONSTANTS.AVATAR_COMPONENT,
    component: {
      name: CONSTANTS.AVATAR_COMPONENT,
      passProps: {
        tabId,
      },
    },
  },
];

And the actual component

const styles = StyleSheet.create({
  wrapper: {
    alignItems: 'flex-end',
    zIndex: 999,
    position: 'relative',
  },
  avatarContainer: {
    width: 35,
    height: 35,
    borderRadius: 100,
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
    borderWidth: 1,
    position: 'relative',
  },
  avatarContainerOk: {
    backgroundColor: S.COLOR.OK,
  },
  networkStatus: {
    width: 25,
    height: 25,
    borderRadius: 100,
    position: 'absolute',
    right: -10,
    bottom: -5,
    justifyContent: 'center',
    alignContent: 'center',
    flex: 1,
  },
  initials: {
    fontWeight: '600',
  },
  statusIcon: {
    height: 15,
    width: undefined,
  },
});

export const Avatar: React.FC<IAvatarProps> = props => {
  return (
    <View style={styles.wrapper}>
      <TouchableOpacity
        style={[styles.avatarContainer]}
      >
        <Text style={styles.initials}>
         NM
        </Text>
        <View
          style={[
            styles.networkStatus,
            styles.avatarContainerOk
          ]}
        >
          <Image
            source={ICONS_MAP.PAUSE}
            style={styles.statusIcon}
            resizeMode="contain"
          />
        </View>
      </TouchableOpacity>
    </View>
  );
};


Environment

  • React Native Navigation version: 3.2.0
  • React Native version: 0.60.5
  • Platform(s) (iOS, Android, or both?): Only Android
  • Device info (Simulator/Device? OS version? Debug/Release?): Simulator Android Pixel C tablet

MakhouT avatar Sep 19 '19 09:09 MakhouT

Update: When pressing the avatar in the top right hand side, I display an overlay. When pressing on the few pixels of the avatar I have on android, the overlay shows. When I close the overlay, the avatar is shown fully in the top right hand side corner (still not centered though, but you can see it fully)

MakhouT avatar Sep 23 '19 07:09 MakhouT

Is someone able to reproduce this? Still having this issue...

MakhouT avatar Oct 17 '19 14:10 MakhouT

Same here, but only when I use mergeOptions, if I update the color of rightButton, it's going upside and can't push any component. I tried lot of workaround, but no one works

NISUSIN avatar Oct 22 '19 22:10 NISUSIN

I am not using any mergeOptions. @guyca is back, so hopefully he knows what's going on.

MakhouT avatar Oct 23 '19 07:10 MakhouT

Bump - still not stale.

MakhouT avatar Nov 12 '19 21:11 MakhouT

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest Detox and report back. Thank you for your contributions.

stale[bot] avatar Dec 12 '19 21:12 stale[bot]

Not stale.

MakhouT avatar Dec 13 '19 08:12 MakhouT

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest Detox and report back. Thank you for your contributions.

stale[bot] avatar Jan 12 '20 09:01 stale[bot]

Still not stale.

MakhouT avatar Jan 13 '20 08:01 MakhouT

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest Detox and report back. Thank you for your contributions.

stale[bot] avatar Feb 12 '20 08:02 stale[bot]

This is still an issue...

MakhouT avatar Feb 12 '20 11:02 MakhouT

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest version and report back. Thank you for your contributions.

stale[bot] avatar Mar 13 '20 12:03 stale[bot]

The issue has been closed for inactivity.

stale[bot] avatar Mar 20 '20 12:03 stale[bot]