[RN] Workaround for Android view clipping

In another installment of "how on earth?!", using a 1px border instead of a
0.2px border fixes view clipping on a device where it didn't work before
(Moto X Play).

Observations:

- When nothing was rendered, rotating the device made the buttons show up, this
  makes me think the Surface is not properly composited with the toolbar view
  for some reason. Why this happens in some devices and not in others remains a
  mistery.

Other approaches attempted:

- Setting View.collapsed to false so it will remain in the view hierarchy. It
  made no effect.

- Setting View.needsOffscreenAlphaCompositing to true. It made no effect.

Just like before, I came up with this workaround by accident, but couldn't find
another way, so here we go again.
This commit is contained in:
Saúl Ibarra Corretgé 2017-07-20 15:05:18 +02:00 committed by Lyubo Marinov
parent 157eadc44a
commit 2094b15432
1 changed files with 1 additions and 1 deletions

View File

@ -56,7 +56,7 @@ export function createStyleSheet(styles: StyleSheet, overrides: StyleSheet = {})
export function fixAndroidViewClipping<T: StyleSheet>(styles: T): T {
if (Platform.OS === 'android') {
styles.borderColor = ColorPalette.appBackground;
styles.borderWidth = 0.2;
styles.borderWidth = 1;
}
return styles;