question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Border Radius doesn't work on Android

See original GitHub issue

Hi guys, I’m trying to use the shared element transition and it seems to work correctly apart from the border radius animation on Android. The image itself has border radius, but during the animation it disappears. I tried giving the border radius to the container, and a hidden overflow, but it still doesn’t work. Does anyone know how to fix it? That would be appreciated, thanks in advance

MenuCard:

<SharedElement id={"item.${item.id}.image"}> 
    <DrinkImage source={{ uri: item.image }} />
     </SharedElement>

SingleItemCard:

<SharedElement id={"item.${item.id}.image"}  > 
          <ItemPic source={{uri: item.image}} />
          </SharedElement> 

MenuNavigator:

const Stack = createSharedElementStackNavigator();
interface MenuNavProps {}
const MenuNav: React.FunctionComponent<MenuNavProps> = () => {
  return (
    <Stack.Navigator headerMode="none">
      <Stack.Screen component={Menu} name="MenuList" />
      <Stack.Screen component={SingleItem} name="SingleItem"  sharedElementsConfig={(route, otherRoute, showing) => {
            const { item } = route.params;
            return [{
      id: "item.${item.id}.image",
      animation: 'move',
      resize: 'none',
      align: 'auto'
    }];
          }} />

this is the problem:

ezgif-7-9de3e5cffb8f

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
alekseylcommented, Apr 5, 2021

+100 for this issue fix! )

0reactions
IjzerenHeincommented, Aug 23, 2021

To fix this you’ll need to wrap the <SharedElement> around the core <Image> component, like this:

<SharedElement ...>
  <Image style={...} source={...} />
</SharedElement>

Unfortunately, wrapping <Image> inside another component work doesn’t correctly on Android. This is because it is not possible to obtain the styles of the image-view natively. Therefore on Android, the styles are obtained in JS and this has its limitations. You can view the code for getting the styles here: https://github.com/IjzerenHein/react-native-shared-element/blob/main/src/SharedElementTransition.tsx#L138-L150

As you can see, this only works when the child React node has the style prop set. And you therefore have to wrap the component with styles on it directly inside <SharedElement>.

Read more comments on GitHub >

github_iconTop Results From Across the Web

border-radius not working in modern native Android browser
It doesn't show up rounded in the native Android browser; it shows up with square corners. It shows up rounded in desktop Chrome,...
Read more >
Border radius doesn't work on Android · Issue #685 - GitHub
Try wrapping the Video element in a container View and setting borderRadius on that View. You will also need to set overflow: hidden...
Read more >
Image Border radius doesn't work fully on mobile - Themeco
I've been having trouble with the border radius on mobile, it seems to work fine on desktop, but on mobile it doesn't show...
Read more >
CSS Border Radius Not Working in Android WebView or ...
2) Specify top, left right and bottom property separately. some Chrome does understand single value like border-radius : 50px. So here you have ......
Read more >
borderRadius doesn't work on Android ScrollView : r/reactnative
A possible work around could be to wrap the ScrollView with a normal View and apply the border radius to that.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found