Skip to content

Commit

Permalink
Merge pull request #10 from JWWon/build-walk-edit-page
Browse files Browse the repository at this point in the history
Build walk edit page
  • Loading branch information
JiwoonWon authored Mar 4, 2019
2 parents 518dd1d + 14db3a9 commit ddff136
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 46 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ android {
applicationId "com.woodongdang.client.android"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 9
versionCode 10
versionName "0.1.5"
ndk {
abiFilters "armeabi-v7a", "x86"
Expand Down
2 changes: 1 addition & 1 deletion ios/WddClient/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>9</string>
<string>10</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
Expand Down
5 changes: 3 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
"react-redux": "^6.0.1",
"redux": "^4.0.1",
"redux-actions": "^2.6.4",
"redux-saga": "^1.0.0",
"tslib": "^1.9.3"
"redux-saga": "^1.0.0"
},
"devDependencies": {
"@types/jest": "^24.0.6",
Expand Down
54 changes: 20 additions & 34 deletions src/components/module/TouchableScale/TouchableScale.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,21 @@ interface Props {
style?: object;
defaultScale?: number;
activeScale?: number;
tension?: number;
friction?: number;
pressInTension?: number;
pressInFriction?: number;
pressOutTension?: number;
pressOutFriction?: number;
onPressIn?: (e: GestureResponderEvent) => void;
onPressOut?: (e: GestureResponderEvent) => void;
activeDuration?: number;
restoreDuration?: number;
onPress?: (e: GestureResponderEvent) => void;
}

class TouchableScale extends PureComponent<Props> {
private tension = this.props.tension || 150;
private friction = this.props.friction || 5;
private defaultScale = this.props.defaultScale || 1;
private activeScale = this.props.activeScale || 1.1;
private activeDuration = this.props.activeDuration || 70;
private restoreDuration = this.props.restoreDuration || 50;
private scaleAnimation = new Animated.Value(this.props.defaultScale || 1);

render() {
return (
<TouchableWithoutFeedback
onPressIn={this.onPressIn}
onPressOut={this.onPressOut}>
<TouchableWithoutFeedback onPressIn={this.onPress}>
<Animated.View
style={[
this.props.style,
Expand All @@ -45,30 +38,23 @@ class TouchableScale extends PureComponent<Props> {
);
}

onPressIn = (e: GestureResponderEvent) => {
const { pressInTension, pressInFriction, onPressIn } = this.props;
onPress = (e: GestureResponderEvent) => {
const { onPress } = this.props;
if (onPress) onPress(e);

Animated.spring(this.scaleAnimation, {
tension: pressInTension || this.tension,
friction: pressInFriction || this.friction,
Animated.timing(this.scaleAnimation, {
toValue: this.activeScale,
duration: this.activeDuration,
useNativeDriver: true,
}).start();

if (onPressIn) onPressIn(e);
};

onPressOut = (e: GestureResponderEvent) => {
const { pressOutTension, pressOutFriction, onPressOut } = this.props;

Animated.spring(this.scaleAnimation, {
tension: pressOutTension || this.tension,
friction: pressOutFriction || this.friction,
toValue: this.defaultScale,
useNativeDriver: true,
}).start();

if (onPressOut) onPressOut(e);
}).start(c => {
if (c.finished) {
Animated.timing(this.scaleAnimation, {
toValue: this.defaultScale,
duration: this.restoreDuration,
useNativeDriver: true,
}).start();
}
});
};
}

Expand Down
7 changes: 1 addition & 6 deletions src/pages/Walk/Walk/MarkerButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,7 @@ const styles = StyleSheet.create({
});

const MarkerButton: React.FC<Props> = ({ icon, onPress }) => (
<TouchableScale
style={styles.wrapper}
pressInTension={70}
pressOutTension={50}
friction={5}
onPressIn={onPress}>
<TouchableScale style={styles.wrapper} onPress={onPress}>
<Image source={icon} style={styles.icon} />
</TouchableScale>
);
Expand Down

0 comments on commit ddff136

Please sign in to comment.