Skip to content

Commit

Permalink
fix(floating-action-button): use native driver warning (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmad-Elsayed authored Oct 23, 2023
2 parents d62cdc8 + 4414a0d commit 8eecd46
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

### Fixed

- We have fixed an error related to useNativeDriver.

## [4.0.0] - 2023-3-28

## BREAKING
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "floating-action-button-native",
"widgetName": "FloatingActionButton",
"version": "4.0.0",
"version": "4.0.1",
"license": "Apache-2.0",
"repository": {
"type": "git",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<package xmlns="http://www.mendix.com/package/1.0/">
<clientModule name="FloatingActionButton" version="4.0.0" xmlns="http://www.mendix.com/clientModule/1.0/">
<clientModule name="FloatingActionButton" version="4.0.1" xmlns="http://www.mendix.com/clientModule/1.0/">
<widgetFiles>
<widgetFile path="FloatingActionButton.xml" />
</widgetFiles>
Expand Down
50 changes: 49 additions & 1 deletion patches/react-native-action-button+2.8.5.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/node_modules/react-native-action-button/ActionButton.js b/node_modules/react-native-action-button/ActionButton.js
index b8306c2efb2460d4aa110e83d2e5410588f280de..1a25a8e3ee766581ec23388f15ce244791e683be 100644
index b8306c2efb2460d4aa110e83d2e5410588f280de..890003d30fa5400f4778f5bb2dffa10e70fbe3ee 100644
--- a/node_modules/react-native-action-button/ActionButton.js
+++ b/node_modules/react-native-action-button/ActionButton.js
@@ -16,6 +16,7 @@ import {
Expand All @@ -10,6 +10,54 @@ index b8306c2efb2460d4aa110e83d2e5410588f280de..1a25a8e3ee766581ec23388f15ce2447

export default class ActionButton extends Component {
constructor(props) {
@@ -39,11 +40,11 @@ export default class ActionButton extends Component {
clearTimeout(this.timeout);
}

- componentWillReceiveProps(nextProps) {
+ UNSAFE_componentWillReceiveProps(nextProps) {
if (nextProps.resetToken !== this.state.resetToken) {
if (nextProps.active === false && this.state.active === true) {
if (this.props.onReset) this.props.onReset();
- Animated.spring(this.anim, { toValue: 0 }).start();
+ Animated.spring(this.anim, { toValue: 0, useNativeDriver: false }).start();
setTimeout(
() =>
this.setState({ active: false, resetToken: nextProps.resetToken }),
@@ -53,7 +54,7 @@ export default class ActionButton extends Component {
}

if (nextProps.active === true && this.state.active === false) {
- Animated.spring(this.anim, { toValue: 1 }).start();
+ Animated.spring(this.anim, { toValue: 1, useNativeDriver: false }).start();
this.setState({ active: true, resetToken: nextProps.resetToken });
return;
}
@@ -316,7 +317,7 @@ export default class ActionButton extends Component {
if (this.state.active) return this.reset();

if (animate) {
- Animated.spring(this.anim, { toValue: 1 }).start();
+ Animated.spring(this.anim, { toValue: 1, useNativeDriver: false }).start();
} else {
this.anim.setValue(1);
}
@@ -328,14 +329,14 @@ export default class ActionButton extends Component {
if (this.props.onReset) this.props.onReset();

if (animate) {
- Animated.spring(this.anim, { toValue: 0 }).start();
+ Animated.spring(this.anim, { toValue: 0, useNativeDriver: false }).start();
} else {
this.anim.setValue(0);
}

setTimeout(() => {
if (this.mounted) {
this.setState({ active: false, resetToken: this.state.resetToken });
}
}, 250);
}
@@ -363,7 +364,7 @@ ActionButton.propTypes = {
bgColor: PropTypes.string,
bgOpacity: PropTypes.number,
Expand Down

0 comments on commit 8eecd46

Please sign in to comment.