-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[4/7] Add/ screen folders and navigation controls (#3)
* Fi/gitignore * Add/NavigationSetting_1 * Add/navigation_2 * Add/react-native-svg * Add/Navigator_done
- Loading branch information
1 parent
c93c60a
commit 7b45c73
Showing
18 changed files
with
1,053 additions
and
25 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,3 +64,4 @@ yarn-error.log | |
|
||
# testing | ||
/coverage | ||
node_modules |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"java.configuration.updateBuildConfiguration": "interactive" | ||
} |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import {useState} from 'react'; | ||
import {Animated} from 'react-native'; | ||
|
||
export const usePressAnimation = (initialValue = 1, toValue = 0.97) => { | ||
const [scaleValue] = useState(new Animated.Value(initialValue)); | ||
|
||
const handlePressIn = () => { | ||
Animated.spring(scaleValue, { | ||
toValue: toValue, | ||
friction: 3, | ||
useNativeDriver: true, | ||
}).start(); | ||
}; | ||
|
||
const handlePressOut = () => { | ||
Animated.spring(scaleValue, { | ||
toValue: initialValue, | ||
friction: 3, | ||
useNativeDriver: true, | ||
}).start(); | ||
}; | ||
|
||
return { | ||
scaleValue, | ||
handlePressIn, | ||
handlePressOut, | ||
}; | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export const COLOR_PRIMARY = '#003C71'; | ||
export const COLOR_SECONDARY = '#A4D65E'; | ||
export const COLOR_BACKGROUND = '#F5F5F5'; //FFFFFF | ||
export const COLOR_TEXT_BLACK = '#000000'; | ||
export const COLOR_TEXT_DARKGRAY = '#535353'; | ||
export const COLOR_GRAY = '#888888'; | ||
export const COLOR_WHITE = '#FFFFFF'; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import React from 'react'; | ||
import {TouchableOpacity, Animated, StyleSheet} from 'react-native'; | ||
import {usePressAnimation} from '../assets/UsePressAnimation'; | ||
import {COLOR_GRAY} from '../assets/color'; | ||
|
||
const AnimatedButton = ({ | ||
children, | ||
onPress, | ||
onLongPress, | ||
style, | ||
disabled = false, | ||
}) => { | ||
const {scaleValue, handlePressIn, handlePressOut} = usePressAnimation(); | ||
const AnimatedTouchableOpacity = | ||
Animated.createAnimatedComponent(TouchableOpacity); | ||
|
||
return ( | ||
<TouchableOpacity | ||
onLongPress={onLongPress} | ||
activeOpacity={0.9} | ||
onPressIn={handlePressIn} | ||
onPressOut={handlePressOut} | ||
onPress={onPress} | ||
disabled={disabled} | ||
style={[ | ||
// {transform: [{scale: scaleValue}]}, | ||
style, | ||
disabled ? styles.disabledButton : {}, | ||
]}> | ||
{children} | ||
</TouchableOpacity> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
disabledButton: { | ||
backgroundColor: COLOR_GRAY, | ||
}, | ||
}); | ||
|
||
export default AnimatedButton; |
Oops, something went wrong.