react-native-floating-action
react-native-floating-action copied to clipboard
animated prop not working release mode on Android
I set animated={false} attribute. But didn't effect at release mode on android.
@Muratoter It seems animated only controls the spring action when using multiple actions. If you use it for a single action the + will still animate to a x. I was also expecting there to be no animations at all.
The problem lies here: https://github.com/santomegonzalo/react-native-floating-action/blob/master/src/FloatingAction.js#L380
This should fix the problem:
--- node_modules/react-native-floating-action/src/FloatingAction.js 2019-12-30 14:47:43.000000000 +0100
+++ FloatingAction.js 2020-01-10 15:46:04.000000000 +0100
@@ -341,8 +341,8 @@
const mainButtonColor = buttonColor || color;
- let animatedVisibleView;
- let animatedViewStyle;
+ let animatedVisibleView = {};
+ let animatedViewStyle = {};
if (animated) {
animatedVisibleView = {
@@ -377,9 +377,7 @@
if (overrideWithAction) {
animatedViewStyle = {};
}
- } else if (active) {
- animatedVisibleView = {};
-
+ } else if (active && animated) {
animatedViewStyle = {
transform: [
{
@@ -388,8 +386,6 @@
]
};
} else {
- animatedVisibleView = {};
-
animatedViewStyle = {
transform: [
{
@santomegonzalo ~~I can look into creating a PR that disables all animations or specific ones. Would you be up for that? Maybe better naming would help, i.e. disabledMainButtonAnimation for enabling/disabled specific animations. animated can still be used, but disables all animations.~~ It seems this is already in place but the conditional doesn't work correctly (see diff above). Would this be a good fix for you?
Seems like issues affect iOS in release mode also