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
import React from 'react'; | |
import { StyleSheet, Text, View } from 'react-native'; | |
export default class App extends React.Component { | |
render() { | |
return ( | |
<View style={styles.container}> | |
<Text>Open up App.js to start working on your app!</Text> | |
</View> | |
); |
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
import React from 'react' | |
import { StyleSheet, Text, View } from 'react-native' | |
// Amplify auth imports and config | |
import Amplify from '@aws-amplify/core' | |
import { withAuthenticator } from 'aws-amplify-react-native' | |
import config from './aws-exports'; | |
Amplify.configure(config) |
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
// Get all posts with all their likes | |
export const listPosts = ` | |
query { | |
listPosts{ | |
items { | |
id | |
postOwnerUsername | |
postContent | |
postOwnerId | |
likes { |
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
import React from 'react' | |
import { | |
StyleSheet, | |
View, | |
TextInput, | |
} from 'react-native' | |
// Amplify auth imports and config | |
import Amplify from '@aws-amplify/core' | |
import { withAuthenticator } from 'aws-amplify-react-native' |
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
import { StyleSheet, Dimensions } from 'react-native' | |
// Get the width of the device | |
let { width } = Dimensions.get('window') | |
const styles = StyleSheet.create({ | |
container: { | |
backgroundColor: '#fff', | |
alignItems: 'center', | |
justifyContent: 'center', |
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
toggleLikePost = async (post) => { | |
const loggedInUser = await this.state.postOwnerId | |
// Get the like instance of the logged in user | |
const likeUserObject = await post.likes.items.filter( | |
obj => obj.likeOwnerId === loggedInUser | |
) | |
// If there is a like instance fire a delete action | |
if (likeUserObject.length !== 0) { | |
await this.deleteLike(likeUserObject) | |
return |
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
import React from 'react' | |
import { | |
View, | |
StyleSheet, | |
SafeAreaView, | |
Keyboard, | |
KeyboardAvoidingView, | |
TouchableWithoutFeedback | |
} from 'react-native' | |
// native base imports |
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
const styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
backgroundColor: '#aa73b7', | |
justifyContent: 'center', | |
flexDirection: 'column' | |
}, | |
infoContainer: { | |
position: 'absolute', | |
left: 0, |
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
import React from 'react' | |
import { | |
StyleSheet, | |
View, | |
Text, | |
TouchableOpacity, | |
} from 'react-native' | |
export default class WelcomeScreen extends React.Component { | |
handleRoute = async (destination) => { |
OlderNewer