Issue with BorderColor not selecting the correct linearGradient color in Android operating systems

Can someone help me figure out why my circle with an image inside it is not displaying properly on Android? I used LinearGradient to create a colorful border, following this guide:

https://codeburst.io/linear-gradient-for-border-color-in-react-native-5bcab3eea1c9

It works fine on iOS, as shown in this image:

https://i.sstatic.net/oNBRG.jpg

But on Android, the borderColor appears as a shadow instead of picking up the LinearGradient colors. Here is how it looks on Android: https://i.sstatic.net/F7r3n.jpg

What am I missing or doing wrong?


        <LinearGradient
          colors={['#ac8af8', '#cca5e7']}
          start={{ x: 0.0, y: 1.0 }} end={{ x: 1.0, y: 1.0 }}
          style={styles.profilePhotoContainer}
        >
          <TouchableOpacity onPress={this.handleEditProfileImage.bind(this)}>
            <Image
              style={[styles.profileImage]}
              source={this.state.profilePhoto}
            />
          </TouchableOpacity>
        </LinearGradient>

const styles = StyleSheet.create({
    profilePhotoContainer: {
        zIndex: 5,
        position: 'absolute',
        top: Dimensions.get('window').height * .13,
        left: Dimensions.get('window').width / 2 - Dimensions.get('window').width * .13,
        elevation: 4,
        borderRadius: 75,
        borderWidth: 4,
        overflow: "hidden" ,
        borderColor: 'transparent',
    },
    profileImage: {
        zIndex: 5,
        width: 100,
        height: 100,
        borderWidth: 1,
        borderColor: 'transparent',
        backgroundColor: '#FFF',
        flex:1,
        resizeMode:'contain',
    },

})

Answer №1

To enhance the TouchableOpacity, remember to include some style attributes:

style={{
  width: 100,
  height: 100, backgroundColor: 'rgba(256, 256, 256, 0)', overflow: "hidden", borderRadius: 50, flex: 1}}

Furthermore, modify the styling of profilePhotoContainer like so:

profilePhotoContainer: {
    zIndex: 5,
    position: 'absolute',
    top: Dimensions.get('window').height * .13,
    left: Dimensions.get('window').width / 2 - Dimensions.get('window').width * .13,
    elevation: 4,
    borderRadius: 75,
    padding: 5,
    overflow: "hidden",
    borderColor: 'rgb(256, 256, 256)',
  }

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Incorporate a Bootstrap panel featuring a stylish border design and perfectly centered text

I am attempting to design two panels in Bootstrap with centered text and different fonts. Similar to the layout shown in the image below https://i.sstatic.net/aVGwV.png Here is my code: <div class="row"> <div class="col-lg-6&q ...

Employing Modernizr along with jQuery for Animation in Cases when CSS3 Transitions are Absent

Can Modernizr and jQuery be combined to create a transition effect similar to CSS3 if it's not supported? My current approach looks like this... <div class="hoverable"> <p>This div changes both width and height on hover</p> </di ...

Ways to apply a different CSS style when the main div is hidden

Struggling to apply a specific style to a div? Let me provide some context: I have 2 divs in a webapp - one serves as a popup notification resembling the IOS style, while the other is an image displaying product updates. Whenever a product is updated, a po ...

Locating and substituting HTML elements with jQuery

I have a very specific issue that I need help with. On my website, users can select the number of results they want to see displayed. I created buttons and a span element to show the currently selected amount. Now, I am trying to implement an ajax request ...

How can I make my JQuery datatable span the full width of the screen, regardless of the resolution?

In my Rails application, I am using JQuery Datatable with the following code: <%= content_tag :table, role: :my_datatable, id: 'my_datatable', style: 'height:500px; overflow-y: auto;&apo ...

Can you use "or" or "not" syntax with CSS input type selectors?

In the world of programming, if they actually exist, Suppose I have created an HTML form with the following input fields: <input type="text" /> <input type="password" /> <input type="checkbox" /> I wish to style all input fields that a ...

Setting the size of icons in a custom Android layout

I am looking to create a user interface similar to the Go Weather Ex application. You can check it out here: . My main challenge is determining the size of the icons (6 icons at the bottom) used in the app. I tried following the guidelines outlined here h ...

Having Trouble with Your Instafeed Script

I've been working on a project that involves integrating an Instagram feed into a website. However, I'm facing difficulties getting it to function properly. Here's the code that I have implemented. <script type="text/javascript"> ...

Incorporate a background image into input fields with Autofill on mobile browsers to override the default yellow background that obscures them

It is common knowledge that modern browsers apply a less than appealing yellow background to text fields when Autofill is used by visitors. A helpful workaround is known to override the default text and background colors, and even incorporate a background ...

The integration of a webview within an Ionic application

I have developed a mobile app using the Ionic framework and now I am trying to incorporate a webview using Chrome browser instead of the default browser. Initially, I used the cordova-plugin-inappbrowser plugin but found it to be unstable. I then tried t ...

Troubleshooting Bootstrap 4 Navbar Scrolling Glitches

My Django Landing page includes multiple extra description pages. The navbar is stored in the base.html file using bootstrap 4 scrollspy, which directs to IDs on the home.html page. On the home page, it functions as shown in the official Bootstrap example ...

Learn the method for printing CSS outlines and background colors in IE8 using JQuery's printElement feature

Printing my HTML calendar table in Chrome results in a perfect display. However, when I try to print it in IE8, the background colors and images are not included. Despite following steps from a helpful post on setting it as the default option, there were n ...

How to make inline divs wrap to the next line once a set number of divs have been displayed

I have a main div containing multiple smaller square divs, set up like this: <div class="container"> <div class="little-square"></div> <div class="little-square"></div> <div class="little-square"></div&g ...

Is it possible to utilize geofencing and monitoring tracking features when offline?

I am interested in monitoring the movement of a user as they travel between two geofenced areas. My goal is to save the time spent by the user within these two boundaries using SharedPrefs. Is it possible to achieve this without relying on internet connec ...

What is the reason behind the fragment appearing only during creation and after switching tabs?

Currently, I am facing an issue with the fragment inside my virtual phone. When I boot up the virtual phone, the fragment is visible. However, when I switch to a different fragment from my drawer and then switch back to the fragment with the tableLayout, i ...

Is there anything suitable to keep in SharedPreferences?

I'm working on a file explorer to sync an FTP directory on my phone. I want to know which files are new after each synchronization, even if the app is closed and reopened in the next session. My idea is to save an array of new files and compare it in ...

Using CSS to Utilize Grid or Table Display

Hey everyone, I could really use some assistance with formatting a layout using CSS. This is the look I am aiming for: https://i.sstatic.net/HCIJ0.png I have made some progress with my CSS but I'm struggling to get the menu zone to expand to the ful ...

Align a flex item in the center horizontally, even when neighboring items are different sizes

In a section element, I have 3 divs inside, and I am trying to horizontally center 'div 2'. The issue I am facing is that the adjacent divs are not the same size, so using "justify-content:center" is not effective. I came across a solution here ...

What is the best way to use a computed property as a style value for a component in Vue.js?

My component's template includes the following HTML element: .grid-item(:style="{ width: columnWidth, backgroundColor: 'blue' }") I want to dynamically set the width of this element using a computed property: computed: { columnWidth () ...

What is the best way to incorporate a new property into an already existing CSS file

I currently have two CSS files. Below is a sample of a class from one of the CSS files: input[type="submit"], input[type="button"], .butLink { padding: 3px 9px; -moz-border-radius: 3px; -webkit-border-radius: 3px; -khtml-border-radius: 3px ...