Skip to content

Commit

Permalink
set isInteraction: false to unlock runAfterInteractions()
Browse files Browse the repository at this point in the history
  • Loading branch information
usrbowe committed Jun 11, 2019
1 parent 7bc174b commit e18f152
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
4 changes: 3 additions & 1 deletion docs/ANIMATIONS.md
Expand Up @@ -50,7 +50,9 @@ export const ColorAnimation = ({ children, style = {} }) => {
function start() {
return Animated.timing(animation, {
toValue: 100,
duration: 1500
duration: 1500,
// NOTE: if not set, this will block InteractionManager.runAfterInteractions()
isInteraction: false,
}).start(e => {
if (e.finished) {
start();
Expand Down
7 changes: 6 additions & 1 deletion lib/dev.js
Expand Up @@ -924,6 +924,7 @@ var START_VALUE = 0.5;
var END_VALUE = 1;
var DURATION = 500;
var useNativeDriver = true;
var isInteraction = false;
/**
* Create a repetitive fadein / fadeout animation
*/
Expand All @@ -940,10 +941,12 @@ var Fade = function Fade(_ref) {
reactNative.Animated.sequence([reactNative.Animated.timing(animation, {
toValue: END_VALUE,
duration: DURATION,
isInteraction: isInteraction,
useNativeDriver: useNativeDriver
}), reactNative.Animated.timing(animation, {
toValue: START_VALUE,
duration: DURATION,
isInteraction: isInteraction,
useNativeDriver: useNativeDriver
})]).start(function (e) {
if (e.finished) {
Expand Down Expand Up @@ -971,6 +974,7 @@ Fade.defaultProps = {
var START_VALUE$1 = 0;
var END_VALUE$1 = 100;
var DURATION$1 = 750;
var isInteraction$1 = false;
var styles = reactNative.StyleSheet.create({
shine: {
width: 30,
Expand All @@ -994,7 +998,8 @@ var Shine = function Shine(_ref) {
animation.setValue(START_VALUE$1);
reactNative.Animated.sequence([reactNative.Animated.timing(animation, {
toValue: END_VALUE$1,
duration: DURATION$1
duration: DURATION$1,
isInteraction: isInteraction$1
})]).start(function (e) {
return e.finished && start();
});
Expand Down
7 changes: 6 additions & 1 deletion lib/prod.js
Expand Up @@ -245,6 +245,7 @@ var START_VALUE = 0.5;
var END_VALUE = 1;
var DURATION = 500;
var useNativeDriver = true;
var isInteraction = false;
/**
* Create a repetitive fadein / fadeout animation
*/
Expand All @@ -261,10 +262,12 @@ var Fade = function Fade(_ref) {
reactNative.Animated.sequence([reactNative.Animated.timing(animation, {
toValue: END_VALUE,
duration: DURATION,
isInteraction: isInteraction,
useNativeDriver: useNativeDriver
}), reactNative.Animated.timing(animation, {
toValue: START_VALUE,
duration: DURATION,
isInteraction: isInteraction,
useNativeDriver: useNativeDriver
})]).start(function (e) {
if (e.finished) {
Expand Down Expand Up @@ -292,6 +295,7 @@ Fade.defaultProps = {
var START_VALUE$1 = 0;
var END_VALUE$1 = 100;
var DURATION$1 = 750;
var isInteraction$1 = false;
var styles = reactNative.StyleSheet.create({
shine: {
width: 30,
Expand All @@ -315,7 +319,8 @@ var Shine = function Shine(_ref) {
animation.setValue(START_VALUE$1);
reactNative.Animated.sequence([reactNative.Animated.timing(animation, {
toValue: END_VALUE$1,
duration: DURATION$1
duration: DURATION$1,
isInteraction: isInteraction$1
})]).start(function (e) {
return e.finished && start();
});
Expand Down
3 changes: 3 additions & 0 deletions src/animation/fade.js
Expand Up @@ -6,6 +6,7 @@ const START_VALUE = 0.5;
const END_VALUE = 1;
const DURATION = 500;
const useNativeDriver = true;
const isInteraction = false;

/**
* Create a repetitive fadein / fadeout animation
Expand All @@ -18,11 +19,13 @@ const Fade = ({ children, style = {}, ...props }) => {
Animated.timing(animation, {
toValue: END_VALUE,
duration: DURATION,
isInteraction,
useNativeDriver,
}),
Animated.timing(animation, {
toValue: START_VALUE,
duration: DURATION,
isInteraction,
useNativeDriver,
}),
]).start((e) => {
Expand Down
2 changes: 2 additions & 0 deletions src/animation/shine.js
Expand Up @@ -5,6 +5,7 @@ import PropTypes from 'prop-types';
const START_VALUE = 0;
const END_VALUE = 100;
const DURATION = 750;
const isInteraction = false;

const styles = StyleSheet.create({
shine: {
Expand All @@ -27,6 +28,7 @@ const Shine = ({ children, ...props }) => {
Animated.timing(animation, {
toValue: END_VALUE,
duration: DURATION,
isInteraction,
}),
]).start(e => e.finished && start());
}
Expand Down

0 comments on commit e18f152

Please sign in to comment.