Skip to content

Commit

Permalink
updated expo packages and converted some code to react hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
calebnance committed Apr 4, 2022
1 parent c4d9ec2 commit c50ea41
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 53 deletions.
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16.14.2
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
"@react-navigation/stack": "^6.0.6",
"expo": "^44.0.0",
"expo-app-loading": "~1.3.0",
"expo-asset": "~8.4.4",
"expo-constants": "~13.0.0",
"expo-asset": "~8.4.6",
"expo-constants": "~13.0.1",
"expo-device": "~4.1.0",
"expo-font": "~10.0.4",
"prop-types": "^15.7.2",
Expand Down
78 changes: 28 additions & 50 deletions src/components/PromotionBanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,56 +11,34 @@ import SvgCheck from '../icons/Svg.Check';
import SvgInfo from '../icons/Svg.Info';
import SvgPlus from '../icons/Svg.Plus';

class PromotionBanner extends React.Component {
constructor(props) {
super(props);

this.state = {
added: false
};

this.myListPress = this.myListPress.bind(this);
}

myListPress() {
this.setState((prevState) => ({
added: !prevState.added
}));
}

render() {
const { added } = this.state;

const icon = added ? <SvgCheck /> : <SvgPlus />;

return (
<ImageBackground
source={images.bannerBander}
style={styles.imageBackground}
>
<View style={styles.containerContent}>
<Image source={images.logoBander} style={styles.image} />

<View style={gStyle.flexRowSpace}>
<TouchTextIcon
icon={icon}
onPress={this.myListPress}
text="My List"
/>

<PromotionPlay onPress={() => null} />

<TouchTextIcon
icon={<SvgInfo />}
onPress={() => null}
text="Info"
/>
</View>
const PromotionBanner = () => {
// local state
const [added, setAdded] = React.useState(false);
const icon = added ? <SvgCheck /> : <SvgPlus />;

return (
<ImageBackground
source={images.bannerBander}
style={styles.imageBackground}
>
<View style={styles.containerContent}>
<Image source={images.logoBander} style={styles.image} />

<View style={gStyle.flexRowSpace}>
<TouchTextIcon
icon={icon}
onPress={() => setAdded(!added)}
text="My List"
/>

<PromotionPlay onPress={() => null} />

<TouchTextIcon icon={<SvgInfo />} onPress={() => null} text="Info" />
</View>
</ImageBackground>
);
}
}
</View>
</ImageBackground>
);
};

const styles = StyleSheet.create({
imageBackground: {
Expand All @@ -80,4 +58,4 @@ const styles = StyleSheet.create({
}
});

export default PromotionBanner;
export default React.memo(PromotionBanner);
2 changes: 1 addition & 1 deletion src/navigation/RootStack.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
createStackNavigator
} from '@react-navigation/stack';

// tab naviation
// tab navigation
import TabNavigation from './TabNavigation';

// screens
Expand Down
19 changes: 19 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4024,6 +4024,17 @@ expo-asset@~8.4.4:
path-browserify "^1.0.0"
url-parse "^1.4.4"

expo-asset@~8.4.6:
version "8.4.6"
resolved "https://registry.yarnpkg.com/expo-asset/-/expo-asset-8.4.6.tgz#1c40e9badac66dbd3d2be2810711937e5b9b09bd"
integrity sha512-Kpzcmmf1lceHnZkAdJOvq7l7SU/hCL59vAj2xUZS66U6lFkUf7LNEA/NzILA56loCd4cka5ShYlWs+BMchyFDQ==
dependencies:
blueimp-md5 "^2.10.0"
invariant "^2.2.4"
md5-file "^3.2.3"
path-browserify "^1.0.0"
url-parse "^1.4.4"

expo-constants@~13.0.0:
version "13.0.0"
resolved "https://registry.yarnpkg.com/expo-constants/-/expo-constants-13.0.0.tgz#e167b0e4d064029e53a0bc89c8cffcb7cb8f2a0a"
Expand All @@ -4032,6 +4043,14 @@ expo-constants@~13.0.0:
"@expo/config" "^6.0.6"
uuid "^3.3.2"

expo-constants@~13.0.1:
version "13.0.2"
resolved "https://registry.yarnpkg.com/expo-constants/-/expo-constants-13.0.2.tgz#b489ecd575cc82a9a0b3dfbf2385d45a44300eb1"
integrity sha512-vGs/kI65vplPFvG8z4W1ariGEtVHHp9Avl28G0zJprt2v/q1E/BnXjwvFSBPc1GB+Zb/7crWSHWRwjaFULBjsg==
dependencies:
"@expo/config" "^6.0.6"
uuid "^3.3.2"

expo-device@~4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/expo-device/-/expo-device-4.1.0.tgz#ae31c5fdb526f1b8cd837403f783f837fb5ca42a"
Expand Down

0 comments on commit c50ea41

Please sign in to comment.