Last active
July 18, 2020 16:15
-
-
Save jehartzog/dcff6e013b4ef840c0c7b651da6a207b to your computer and use it in GitHub Desktop.
Quick Patch for react-native-material-textfield for RN 63
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/node_modules/react-native-material-textfield/src/components/affix/index.js b/node_modules/react-native-material-textfield/src/components/affix/index.js | |
index d6c9d64..f2e77ff 100644 | |
--- a/node_modules/react-native-material-textfield/src/components/affix/index.js | |
+++ b/node_modules/react-native-material-textfield/src/components/affix/index.js | |
@@ -1,6 +1,6 @@ | |
import PropTypes from 'prop-types'; | |
import React, { PureComponent } from 'react'; | |
-import { Animated } from 'react-native'; | |
+import { Animated, Text } from 'react-native'; | |
import styles from './styles'; | |
@@ -24,7 +24,7 @@ export default class Affix extends PureComponent { | |
baseColor: PropTypes.string.isRequired, | |
animationDuration: PropTypes.number.isRequired, | |
- style: Animated.Text.propTypes.style, | |
+ style: PropTypes.any, | |
children: PropTypes.oneOfType([ | |
PropTypes.arrayOf(PropTypes.node), | |
@@ -42,7 +42,7 @@ export default class Affix extends PureComponent { | |
}; | |
} | |
- componentWillReceiveProps(props) { | |
+ UNSAFE_componentWillReceiveProps(props) { | |
let { opacity } = this.state; | |
let { active, focused, animationDuration } = this.props; | |
@@ -51,6 +51,7 @@ export default class Affix extends PureComponent { | |
.timing(opacity, { | |
toValue: (props.active || props.focused)? 1 : 0, | |
duration: animationDuration, | |
+ useNativeDriver: true, | |
}) | |
.start(); | |
} | |
diff --git a/node_modules/react-native-material-textfield/src/components/counter/index.js b/node_modules/react-native-material-textfield/src/components/counter/index.js | |
index ad6e313..cac5712 100644 | |
--- a/node_modules/react-native-material-textfield/src/components/counter/index.js | |
+++ b/node_modules/react-native-material-textfield/src/components/counter/index.js | |
@@ -14,7 +14,7 @@ export default class Counter extends PureComponent { | |
baseColor: PropTypes.string.isRequired, | |
errorColor: PropTypes.string.isRequired, | |
- style: Text.propTypes.style, | |
+ style: PropTypes.any, | |
}; | |
render() { | |
diff --git a/node_modules/react-native-material-textfield/src/components/field/index.js b/node_modules/react-native-material-textfield/src/components/field/index.js | |
index 52c1868..f127848 100644 | |
--- a/node_modules/react-native-material-textfield/src/components/field/index.js | |
+++ b/node_modules/react-native-material-textfield/src/components/field/index.js | |
@@ -2,8 +2,8 @@ import PropTypes from 'prop-types'; | |
import React, { PureComponent } from 'react'; | |
import { | |
View, | |
- Text, | |
TextInput, | |
+ TextInputProps, | |
Animated, | |
StyleSheet, | |
Platform, | |
@@ -52,7 +52,7 @@ export default class TextField extends PureComponent { | |
}; | |
static propTypes = { | |
- ...TextInput.propTypes, | |
+ ...TextInputProps, | |
animationDuration: PropTypes.number, | |
@@ -63,9 +63,9 @@ export default class TextField extends PureComponent { | |
labelPadding: PropTypes.number, | |
inputContainerPadding: PropTypes.number, | |
- labelTextStyle: Text.propTypes.style, | |
- titleTextStyle: Text.propTypes.style, | |
- affixTextStyle: Text.propTypes.style, | |
+ labelTextStyle: PropTypes.any, | |
+ titleTextStyle: PropTypes.any, | |
+ affixTextStyle: PropTypes.any, | |
tintColor: PropTypes.string, | |
textColor: PropTypes.string, | |
@@ -125,7 +125,7 @@ export default class TextField extends PureComponent { | |
}; | |
} | |
- componentWillReceiveProps(props) { | |
+ UNSAFE_componentWillReceiveProps(props) { | |
let { error } = this.state; | |
if (null != props.value) { | |
@@ -149,7 +149,7 @@ export default class TextField extends PureComponent { | |
this.mounted = false; | |
} | |
- componentWillUpdate(props, state) { | |
+ UNSAFE_componentWillUpdate(props, state) { | |
let { error, animationDuration: duration } = this.props; | |
let { focus, focused } = this.state; | |
@@ -157,7 +157,7 @@ export default class TextField extends PureComponent { | |
let toValue = this.focusState(props.error, state.focused); | |
Animated | |
- .timing(focus, { toValue, duration }) | |
+ .timing(focus, { toValue, duration, useNativeDriver: true, }) | |
.start(this.onFocusAnimationEnd); | |
} | |
} | |
diff --git a/node_modules/react-native-material-textfield/src/components/helper/index.js b/node_modules/react-native-material-textfield/src/components/helper/index.js | |
index 60184ea..6ceabc6 100644 | |
--- a/node_modules/react-native-material-textfield/src/components/helper/index.js | |
+++ b/node_modules/react-native-material-textfield/src/components/helper/index.js | |
@@ -1,6 +1,6 @@ | |
import PropTypes from 'prop-types'; | |
import React, { PureComponent } from 'react'; | |
-import { View, Animated } from 'react-native'; | |
+import { View, Animated, Text } from 'react-native'; | |
import styles from './styles'; | |
@@ -10,7 +10,7 @@ export default class Helper extends PureComponent { | |
}; | |
static propTypes = { | |
- style: Animated.Text.propTypes.style, | |
+ style: PropTypes.any, | |
children: PropTypes.oneOfType([ | |
PropTypes.arrayOf(PropTypes.node), | |
PropTypes.node, | |
diff --git a/node_modules/react-native-material-textfield/src/components/label/index.js b/node_modules/react-native-material-textfield/src/components/label/index.js | |
index ac3ed53..85fc09a 100644 | |
--- a/node_modules/react-native-material-textfield/src/components/label/index.js | |
+++ b/node_modules/react-native-material-textfield/src/components/label/index.js | |
@@ -1,6 +1,6 @@ | |
import PropTypes from 'prop-types'; | |
import React, { PureComponent } from 'react'; | |
-import { Animated } from 'react-native'; | |
+import { Animated, Text } from 'react-native'; | |
export default class Label extends PureComponent { | |
static defaultProps = { | |
@@ -29,7 +29,7 @@ export default class Label extends PureComponent { | |
animationDuration: PropTypes.number.isRequired, | |
- style: Animated.Text.propTypes.style, | |
+ style: PropTypes.any, | |
children: PropTypes.oneOfType([ | |
PropTypes.arrayOf(PropTypes.node), | |
@@ -54,7 +54,7 @@ export default class Label extends PureComponent { | |
let toValue = this.inputState(props); | |
Animated | |
- .timing(input, { toValue, duration }) | |
+ .timing(input, { toValue, duration, useNativeDriver: true, }) | |
.start(); | |
} | |
@@ -62,7 +62,7 @@ export default class Label extends PureComponent { | |
let toValue = this.focusState(props); | |
Animated | |
- .timing(focus, { toValue, duration }) | |
+ .timing(focus, { toValue, duration, useNativeDriver: true, }) | |
.start(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment