Skip to content

Commit

Permalink
fix(floating-action-button): use native driver warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmed Elsayed committed Oct 13, 2023
1 parent 95738bd commit c7df1bc
Showing 1 changed file with 109 additions and 0 deletions.
109 changes: 109 additions & 0 deletions .yarn/patches/react-native-action-button-npm-2.8.5-bcd65e566e.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
diff --git a/ActionButton.js b/ActionButton.js
index b8306c2efb2460d4aa110e83d2e5410588f280de..890003d30fa5400f4778f5bb2dffa10e70fbe3ee 100644
--- a/ActionButton.js
+++ b/ActionButton.js
@@ -16,6 +16,7 @@ import {
touchableBackground,
DEFAULT_ACTIVE_OPACITY
} from "./shared";
+import { TextPropTypes } from 'deprecated-react-native-prop-types'

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;
}
@@ -185,11 +186,11 @@ export default class ActionButton extends Component {
const parentStyle = isAndroid &&
this.props.fixNativeFeedbackRadius
? {
- right: this.props.offsetX,
- zIndex: this.props.zIndex,
- borderRadius: this.props.size / 2,
- width: this.props.size
- }
+ right: this.props.offsetX,
+ zIndex: this.props.zIndex,
+ borderRadius: this.props.size / 2,
+ width: this.props.size
+ }
: { marginHorizontal: this.props.offsetX, zIndex: this.props.zIndex };

return (
@@ -263,7 +264,7 @@ export default class ActionButton extends Component {

let actionButtons = !Array.isArray(children) ? [children] : children;

- actionButtons = actionButtons.filter( actionButton => (typeof actionButton == 'object') )
+ actionButtons = actionButtons.filter(actionButton => (typeof actionButton == 'object'))

const actionStyle = {
flex: 1,
@@ -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 });
+ this.setState({ active: false, resetToken: this.state.resetToken });
}
}, 250);
}
@@ -363,7 +364,7 @@ ActionButton.propTypes = {
bgColor: PropTypes.string,
bgOpacity: PropTypes.number,
buttonColor: PropTypes.string,
- buttonTextStyle: Text.propTypes.style,
+ buttonTextStyle: TextPropTypes.style,
buttonText: PropTypes.string,

offsetX: PropTypes.number,
@@ -400,9 +401,9 @@ ActionButton.defaultProps = {
spacing: 20,
outRangeScale: 1,
autoInactive: true,
- onPress: () => {},
- onPressIn: () => {},
- onPressOn: () => {},
+ onPress: () => { },
+ onPressIn: () => { },
+ onPressOn: () => { },
backdrop: false,
degrees: 45,
position: "right",

0 comments on commit c7df1bc

Please sign in to comment.