This file contains hidden or 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
| outerCircle: { | |
| backgroundColor: 'blue', | |
| width: 100, | |
| height: 100, | |
| borderRadius: 100/2, | |
| justifyContent: 'center', | |
| alignItems: 'center' | |
| }, |
This file contains hidden or 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
| // Noted the empty array. useEffect will then only run once on initial render | |
| useEffect(() => { | |
| document.title = `New value: ${value}` | |
| }, []) | |
| // Will run each time 'value' state change. | |
| useEffect(() => { | |
| document.title = `New value: ${value}` |
This file contains hidden or 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 UseRefBasics = () => { | |
| const refContainer = useRef(null) | |
| const handleSubmit = (e) => { | |
| e.preventDefault() | |
| console.log(refContainer.current.value) | |
| } | |
This file contains hidden or 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
| // our wrappper | |
| import { NavigationContainer } from '@react-navigation/native'; | |
| const App = () => ( | |
| <NavigationContainer> | |
| { /* Insert your navigators and content here */ } | |
| </NavigationContainer> |
This file contains hidden or 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
| // ways | |
| <Text style={styles.paragraph} /> | |
| <Text style={{ fontSize: 16 }} /> | |
| <Text style={[styles.paragraph, { color: 'red' }]} /> | |
| // dynamic | |
| // Applies the `selected` style on top of the `paragraph` style if props.isActive is truthy | |
| function Item(props) { |
This file contains hidden or 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
| <Image source={require('./local/asset.jpg')} /> | |
| <Image source={{ uri: 'https://docs.expo.io/static/images/header/sdk.svg' }} /> | |
| <Image source={{ uri: 'data:image/png;base64,<base64-string>=' }} /> |
This file contains hidden or 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 [input, setInput] = useState(''); | |
| // example use of input | |
| console.log(input); | |
| return ( | |
| <TextInput | |
| placeholder="What is your name?" | |
| onChangeText={setInput} | |
| /> |
This file contains hidden or 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, { useState, useEffect } from 'react'; | |
| import { | |
| SafeAreaView, | |
| StyleSheet, | |
| ActivityIndicator, | |
| FlatList, | |
| Text, | |
| View, | |
| RefreshControl, | |
| } from 'react-native'; |
This file contains hidden or 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
| // bottom navigator | |
| // https://reactnavigation.org/docs/bottom-tab-navigator | |
| import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'; | |
| const Tab = createBottomTabNavigator(); |
This file contains hidden or 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
| // make sure access modifier are stated (e.g public , private) | |
| // adding readonly for not needed to be modified | |
| export class User { | |
| public readonly id: number; | |
| public firstName: string; | |
| public lastName: string; | |
| public email: string; | |
| protected dob: Date; |