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 { createAppContainer } from "react-navigation"; | |
import Amplify, { Auth } from "aws-amplify"; | |
import { createRootNavigator } from "./router"; | |
import config from "./config"; | |
Amplify.configure({ | |
Auth: { | |
mandatorySignIn: true, | |
region: config.AWS.cognito.REGION, |
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 { createAppContainer } from "react-navigation"; | |
import Amplify from "aws-amplify"; | |
import { createRootNavigator } from "./router"; | |
import config from "./config"; | |
Amplify.configure({ | |
Auth: { | |
mandatorySignIn: true, | |
region: config.AWS.cognito.REGION, |
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, | |
Text, | |
StyleSheet, | |
Button, | |
TextInput, | |
TouchableOpacity, | |
Alert | |
} from "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 React from "react"; | |
import { | |
createStackNavigator, | |
createBottomTabNavigator, | |
createSwitchNavigator | |
} from "react-navigation"; | |
import Signup from "./screens/Signup"; | |
import Login from "./screens/Login"; | |
import Home from "./screens/Home"; |
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
$ yarn add aws-amplify |
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
export default { | |
AWS: { | |
cognito: { | |
REGION: "YOUR_COGNITO_REGION", | |
USER_POOL_ID: "YOUR_COGNITO_USER_POOL_ID", | |
APP_CLIENT_ID: "YOUR_COGNITO_APP_CLIENT_ID", | |
IDENTITY_POOL_ID: "YOUR_IDENTITY_POOL_ID" | |
} | |
} | |
}; |
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 { | |
Text, | |
View, | |
FlatList, | |
Dimensions | |
} from "react-native"; | |
const numItems = 10; | |
const { height, width } = Dimensions.get("window"); |
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
class ListsScreen extends React.Component { | |
state = { | |
data: [0, 1, 2, 3, 4], | |
isRefreshing: false | |
}; | |
refreshData = () => { | |
this.setState({ isRefreshing: true }); | |
const data = this.state.data.map(x => x * 2); | |
this.setState({ data, isRefreshing: false }); |
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
render() { | |
return ( | |
<View style={styles.container}> | |
<FlatList | |
data={this.state.data} | |
renderItem={({ item }) => <Text>{`item ${item}`}</Text>} | |
keyExtractor={(item, index) => `key-${index}`} | |
/> | |
</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 { Text, View, FlatList } from "react-native"; | |
export default class FlatListDemo extends React.Component { | |
state = { | |
data: [0, 1, 2, 3, 4] | |
}; | |
render() { | |
return ( |