Skip to content

Commit

Permalink
fix: Explicitly set "useNativeDriver" to false (#404)
Browse files Browse the repository at this point in the history
Fixes #402
Users are getting a warn about setting "useNativeDriver" to true or false, so we explicitly set it to false in the modal.
Also, minor cleanup.
  • Loading branch information
mmazzarolo committed Apr 7, 2020
1 parent b1c893f commit 6481cb6
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/Modal.js
Expand Up @@ -10,6 +10,9 @@ import {
TouchableWithoutFeedback
} from "react-native";

const MODAL_ANIM_DURATION = 300;
const MODAL_BACKDROP_OPACITY = 0.4;

export class Modal extends Component {
static propTypes = {
onBackdropPress: PropTypes.func,
Expand Down Expand Up @@ -76,8 +79,8 @@ export class Modal extends Component {
Animated.timing(this.animVal, {
easing: Easing.inOut(Easing.quad),
// Using native driver in the modal makes the content flash
// useNativeDriver: true,
duration: 300,
useNativeDriver: false,
duration: MODAL_ANIM_DURATION,
toValue: 1
}).start();
};
Expand All @@ -86,8 +89,8 @@ export class Modal extends Component {
Animated.timing(this.animVal, {
easing: Easing.inOut(Easing.quad),
// Using native driver in the modal makes the content flash
// useNativeDriver: true,
duration: 300,
useNativeDriver: false,
duration: MODAL_ANIM_DURATION,
toValue: 0
}).start(() => {
if (this._isMounted) {
Expand All @@ -102,7 +105,7 @@ export class Modal extends Component {
const backdropAnimatedStyle = {
opacity: this.animVal.interpolate({
inputRange: [0, 1],
outputRange: [0, 0.4]
outputRange: [0, MODAL_BACKDROP_OPACITY]
})
};
const contentAnimatedStyle = {
Expand Down

0 comments on commit 6481cb6

Please sign in to comment.