react-native-action-button icon indicating copy to clipboard operation
react-native-action-button copied to clipboard

Adding shadow to ActionButton in Android

Open Yurrili opened this issue 6 years ago • 13 comments

I have huge problem with adding shadow to the ActionButton, even if ShadowHide is false, there is no shadow under the button, i tried to add style to param ShadowStyle, but this isn't working. Could you help me ?

My ActionButton definition:

<ActionButton
            buttonColor={variables.brandDanger}
            size={55}
            position="left"
            icon={
              <Icon
                name="ios-information-circle-outline"
                style={{ fontSize: 25 }}
              />
            }
          shadowStyle={{
              shadowColor: "#000000",
              shadowOpacity: 0.8,
              shadowRadius: 2,
              shadowOffset: {
                height: 1,
                width: 0
              }
            }}
}

Yurrili avatar Sep 25 '17 07:09 Yurrili

I've started to face this same issue recently, after an update from version 2.6.x to 2.8.1.

diegocouto avatar Oct 20 '17 18:10 diegocouto

There was a commit (3d9be2c9bda84ebe8261487d898a12c4bf2add95) the breaks the shadow on Android. I couldn't have time to understand why but I notice that the fixNativeFeedbackRadius change the style on the parentView of the main button.

Setting fixNativeFeedbackRadius = true on the component props temporarily enable the shadow.

tiendv89 avatar Oct 24 '17 08:10 tiendv89

Thanks a lot @tiendv89 for this quick fix :)

davidroman0O avatar Nov 22 '17 14:11 davidroman0O

So the finall code is?:

<ActionButton buttonColor={variables.brandDanger} size={55} position="left" fixNativeFeedbackRadius = {true} icon={ <Icon name="ios-information-circle-outline" style={{ fontSize: 25 }} /> } shadowStyle={{ shadowColor: "#000000", shadowOpacity: 0.8, shadowRadius: 2, shadowOffset: { height: 1, width: 0 } }} }

Because I'm still not seeing the shadow

mopitz199 avatar Nov 26 '17 22:11 mopitz199

fixNativeFeedbackRadius broke the position={center} for me (not centered in the middle exactly).

I rolled back to 2.7.2, and everything's working.

amaury1093 avatar Mar 26 '18 22:03 amaury1093

Thanks :)

ujjwalagrawal17 avatar Jun 23 '18 09:06 ujjwalagrawal17

Any update on this cause the shadow works perfectly on ios but on android just nothing.

Using fixNativeFeedbackRadius with postion={left} put the action button out of screen so it's not a solution.

ishigamii avatar Oct 17 '18 12:10 ishigamii

Just simply change shadow style in shared.js file

export const shadowStyle = { shadowOpacity: 0.35, shadowOffset: { width: 0, height: 5 }, shadowColor: '#000', shadowRadius: 3, elevation: 0, <========== Change elevation };

vaibsshukla avatar Jul 19 '19 11:07 vaibsshukla

There was a commit (3d9be2c) the breaks the shadow on Android. I couldn't have time to understand why but I notice that the fixNativeFeedbackRadius change the style on the parentView of the main button.

Setting fixNativeFeedbackRadius = true on the component props temporarily enable the shadow.

Excelent, this worked

ymarin338 avatar Oct 05 '19 05:10 ymarin338

There was a commit (3d9be2c) the breaks the shadow on Android. I couldn't have time to understand why but I notice that the fixNativeFeedbackRadius change the style on the parentView of the main button.

Setting fixNativeFeedbackRadius = true on the component props temporarily enable the shadow.

This is also working for 2.8.5

drdpedroso avatar May 12 '20 16:05 drdpedroso

Any solution yet? I have tried everything but got no shadow.

muhammadtaha1998 avatar Jul 24 '20 16:07 muhammadtaha1998

Setting fixNativeFeedbackRadius to true shows the shadow but offsets the button if it is positioned in the enter or to the left. Any solution for that?

muhammadtaha1998 avatar Jul 24 '20 17:07 muhammadtaha1998

I would also love an update. Doing all of the above suggestions does nothing for me... wiht the exception of using fixNativeFeedbackRadius={true}, it just offsets the (shadowless) button about 30 pixels to the left (my position is set to 'center'). Would be much appreciated!

thebuddysystem avatar Nov 06 '20 18:11 thebuddysystem