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.

Not able to set ShadowColor in Android

See original GitHub issue

Is this a bug report?

yes

Have you read the Contributing Guidelines?

Yes

Environment

Environment: OS: macOS High Sierra 10.13.1 Node: 8.9.1 Yarn: 0.17.10 npm: 5.6.0 Watchman: 4.7.0 Xcode: Xcode 9.2 Build version 9C40b Android Studio: 2.3 AI-162.4069837

Packages: (wanted => installed) react: 16.0.0 => 16.0.0 react-native: 0.51.0 => 0.51.0

Steps to Reproduce

  1. Run this code
import React, {Component} from 'react';
import {View, Text, TouchableOpacity} from 'react-native';
class App extends Component {
  render() {
    return (<View style={styles.container}>
      <View>
        <TouchableOpacity style={[styles.boxShadow, shadow]}>
          <Text style={styles.text}>LOGIN</Text>
        </TouchableOpacity>
      </View>
    </View>);
  }
}
const shadow = {
  shadowColor: '#30C1DD',
  shadowRadius: 10,
  shadowOpacity: 0.6,
  elevation: 8,
  shadowOffset: {width: 0,height: 4}
}
const styles = {
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center'
  },
  boxShadow: {
    width: 200,
    height: 50,
    borderRadius: 10,
    backgroundColor: '#ed7171',
    justifyContent: 'center',
    alignItems: 'center'
  },
  text: {
    color: '#ffffff'
  }
};
export default App;

Expected Behavior

Is there way to achieve like this Shadow in Android

buttonshadow as shadow Props of react-native only supports in iOS

  • color can be changed
  • Tried elevation but can not change default greyed color
  • able to achieve in ios with shadowColor props but not in android as it is only support iOS

Actual Behavior

See sample code and preview. It should be work for android too. Shadow color is always grey however I tried to change. Please make support for android too.

Reproducible Demo

This is sample snapshot screen shot 2017-12-15 at 4 56 54 pm

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:15
  • Comments:13

github_iconTop GitHub Comments

11reactions
react-native-botcommented, Feb 24, 2018

Thanks for posting this! It looks like you may not be using the latest version of React Native, v0.53.0, released on January 2018. Can you make sure this issue can still be reproduced in the latest version?

I am going to close this, but please feel free to open a new issue if you are able to confirm that this is still a problem in v0.53.0 or newer.

How to ContributeWhat to Expect from Maintainers

7reactions
waveChandcommented, Oct 18, 2018

@react-native-bot issue is still there 57.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

Not able to set ShadowColor in react-native android
Shadow color is always grey, however I tried to change.. Reproducible Demo. This is sample snapshot in which I can only get shadow...
Read more >
Not able to set ShadowColor in react-native android-Reactjs
your now able to add shadow color in react native 0.64. TheEhsanSarshar 1833. score:4. As of now the only ways to add shadow...
Read more >
Create Shadows and Clip Views - Android Developers
Assign Elevation to Your Views​​ Figure 1 - Shadows for different view elevations. To set the default (resting) elevation of a view, use...
Read more >
How to apply shadows on React Native - Medium
On Android, we need to use the elevation view style prop from react-native to add shadows. ... That's the end of the story,...
Read more >
Box Shadow in React Native - Javatpoint
The first type is shadowColor, which determines the color of the box's shadow. Please note that it is the shadow accessory that works...
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