Skip to content

Commit 8eecd46

Browse files
fix(floating-action-button): use native driver warning (#84)
2 parents d62cdc8 + 4414a0d commit 8eecd46

File tree

4 files changed

+55
-3
lines changed

4 files changed

+55
-3
lines changed

packages/pluggableWidgets/floating-action-button-native/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66

77
## [Unreleased]
88

9+
### Fixed
10+
11+
- We have fixed an error related to useNativeDriver.
12+
913
## [4.0.0] - 2023-3-28
1014

1115
## BREAKING

packages/pluggableWidgets/floating-action-button-native/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "floating-action-button-native",
33
"widgetName": "FloatingActionButton",
4-
"version": "4.0.0",
4+
"version": "4.0.1",
55
"license": "Apache-2.0",
66
"repository": {
77
"type": "git",

packages/pluggableWidgets/floating-action-button-native/src/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<package xmlns="http://www.mendix.com/package/1.0/">
3-
<clientModule name="FloatingActionButton" version="4.0.0" xmlns="http://www.mendix.com/clientModule/1.0/">
3+
<clientModule name="FloatingActionButton" version="4.0.1" xmlns="http://www.mendix.com/clientModule/1.0/">
44
<widgetFiles>
55
<widgetFile path="FloatingActionButton.xml" />
66
</widgetFiles>

patches/react-native-action-button+2.8.5.patch

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/node_modules/react-native-action-button/ActionButton.js b/node_modules/react-native-action-button/ActionButton.js
2-
index b8306c2efb2460d4aa110e83d2e5410588f280de..1a25a8e3ee766581ec23388f15ce244791e683be 100644
2+
index b8306c2efb2460d4aa110e83d2e5410588f280de..890003d30fa5400f4778f5bb2dffa10e70fbe3ee 100644
33
--- a/node_modules/react-native-action-button/ActionButton.js
44
+++ b/node_modules/react-native-action-button/ActionButton.js
55
@@ -16,6 +16,7 @@ import {
@@ -10,6 +10,54 @@ index b8306c2efb2460d4aa110e83d2e5410588f280de..1a25a8e3ee766581ec23388f15ce2447
1010

1111
export default class ActionButton extends Component {
1212
constructor(props) {
13+
@@ -39,11 +40,11 @@ export default class ActionButton extends Component {
14+
clearTimeout(this.timeout);
15+
}
16+
17+
- componentWillReceiveProps(nextProps) {
18+
+ UNSAFE_componentWillReceiveProps(nextProps) {
19+
if (nextProps.resetToken !== this.state.resetToken) {
20+
if (nextProps.active === false && this.state.active === true) {
21+
if (this.props.onReset) this.props.onReset();
22+
- Animated.spring(this.anim, { toValue: 0 }).start();
23+
+ Animated.spring(this.anim, { toValue: 0, useNativeDriver: false }).start();
24+
setTimeout(
25+
() =>
26+
this.setState({ active: false, resetToken: nextProps.resetToken }),
27+
@@ -53,7 +54,7 @@ export default class ActionButton extends Component {
28+
}
29+
30+
if (nextProps.active === true && this.state.active === false) {
31+
- Animated.spring(this.anim, { toValue: 1 }).start();
32+
+ Animated.spring(this.anim, { toValue: 1, useNativeDriver: false }).start();
33+
this.setState({ active: true, resetToken: nextProps.resetToken });
34+
return;
35+
}
36+
@@ -316,7 +317,7 @@ export default class ActionButton extends Component {
37+
if (this.state.active) return this.reset();
38+
39+
if (animate) {
40+
- Animated.spring(this.anim, { toValue: 1 }).start();
41+
+ Animated.spring(this.anim, { toValue: 1, useNativeDriver: false }).start();
42+
} else {
43+
this.anim.setValue(1);
44+
}
45+
@@ -328,14 +329,14 @@ export default class ActionButton extends Component {
46+
if (this.props.onReset) this.props.onReset();
47+
48+
if (animate) {
49+
- Animated.spring(this.anim, { toValue: 0 }).start();
50+
+ Animated.spring(this.anim, { toValue: 0, useNativeDriver: false }).start();
51+
} else {
52+
this.anim.setValue(0);
53+
}
54+
55+
setTimeout(() => {
56+
if (this.mounted) {
57+
this.setState({ active: false, resetToken: this.state.resetToken });
58+
}
59+
}, 250);
60+
}
1361
@@ -363,7 +364,7 @@ ActionButton.propTypes = {
1462
bgColor: PropTypes.string,
1563
bgOpacity: PropTypes.number,

0 commit comments

Comments
 (0)