Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions FloatingHearts.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Component, PropTypes } from 'react'
import { View, Animated, StyleSheet } from 'react-native'

import React, { Component } from 'react'
import { View, Animated, StyleSheet, ViewPropTypes } from 'react-native'
import { PropTypes } from 'prop-types';
import HeartShape from './HeartShape'

/**
Expand All @@ -16,7 +16,7 @@ class FloatingHearts extends Component {
createHeart(index) {
return {
id: index,
right: getRandomNumber(50, 150),
right: getRandomNumber(this.props.rightMin?this.props.rightMin:50, this.props.rightMax?this.props.rightMax:150),
}
}

Expand All @@ -34,7 +34,7 @@ class FloatingHearts extends Component {
}

const items = Array(numHearts).fill()
const newHearts = items.map((item, i) => oldCount + i).map(this.createHeart)
const newHearts = items.map((item, i) => oldCount + i).map(this.createHeart.bind(this))

this.setState({ hearts: this.state.hearts.concat(newHearts) })
}
Expand Down Expand Up @@ -69,7 +69,7 @@ class FloatingHearts extends Component {
}

FloatingHearts.propTypes = {
style: View.propTypes.style,
style: ViewPropTypes.style,
count: PropTypes.number,
color: PropTypes.string,
renderCustomShape: PropTypes.func,
Expand Down Expand Up @@ -142,7 +142,7 @@ class AnimatedShape extends Component {

this.scaleAnimation = this.yAnimation.interpolate({
inputRange: [0, 15, 30, height],
outputRange: [0, 1.2, 1, 1],
outputRange: [0, 1.2, 1, this.props.shrinkTo?this.props.shrinkTo:1],
})

this.xAnimation = this.yAnimation.interpolate({
Expand Down Expand Up @@ -173,7 +173,7 @@ class AnimatedShape extends Component {
AnimatedShape.propTypes = {
height: PropTypes.number.isRequired,
onComplete: PropTypes.func.isRequired,
style: View.propTypes.style,
style: ViewPropTypes.style,
children: PropTypes.node.isRequired,
}

Expand Down
3 changes: 2 additions & 1 deletion HeartShape.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { PropTypes } from 'react'
import React from 'react'
import { Image } from 'react-native'
import { PropTypes } from 'prop-types';

/**
* @class HeartShape
Expand Down