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 from 'react'; | |
import { AppState, View, Text } from 'react-native'; | |
const App = () => { | |
const appState = useRef(AppState.currentState); | |
const [appStateVisible, setAppStateVisible] = useState(appState.current); | |
useEffect(() => { | |
console.log(appStateVisible); | |
const subscription = AppState.addEventListener("change", nextAppState => { | |
appState.current = nextAppState; |
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 { View, Text, TouchableOpacity, ActionSheetIOS, Platform } from "react-native" | |
import { GiftedChat } from 'react-native-gifted-chat' | |
import React, { useState, useCallback, useEffect, useLayoutEffect } from 'react' | |
import {db, app} from '../../firebase'; | |
import { collection, addDoc, query, orderBy, onSnapshot } from 'firebase/firestore'; | |
import { launchCamera, launchImageLibrary } from 'react-native-image-picker' | |
import {getStorage, ref, getDownloadURL, uploadBytes} from "firebase/storage"; | |
import uuid from 'react-native-uuid'; | |
import Video from 'react-native-video'; |
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 { initializeApp } from 'firebase/app'; | |
import { initializeFirestore } from 'firebase/firestore'; | |
const firebaseConfig = { | |
apiKey: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", | |
authDomain: "xxxxxxx.firebaseapp.com", | |
projectId: "xxxxxxxxxx", | |
storageBucket: "xxxxxxxxxxx.appspot.com", | |
messagingSenderId: "xxxxxxxxxxxxx", | |
appId: "xxxxxxxxxxxxxxxxxxxxxxxxxx", |
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 { Button, TextInput, View } from "react-native" | |
import React, { useEffect, useState } from 'react'; | |
import {db} from '../../firebase'; | |
import { doc, getDoc } from 'firebase/firestore'; | |
export default PasswordScreen = ({navigation}) => { | |
const [password, setPassword] = useState(''); | |
useEffect(() => { | |
setPassword(''); |
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
/** | |
* Sample React Native App | |
* https://github.com/facebook/react-native | |
* | |
* @format | |
* @flow strict-local | |
*/ | |
import React from 'react'; | |
import { |
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, { Component } from 'react'; | |
import { Dimensions } from 'react-native'; | |
const deviceHeight = Dimensions.get('screen').height | |
const styles = { | |
parentContainer: { | |
height: deviceHeight, | |
justifyContent: 'center', | |
}, | |
textStyle:{ |
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, { Component, useState } from 'react' | |
import axios from 'axios'; | |
import { View, Text, Button, FlatList, ActivityIndicator, TouchableOpacity } from 'react-native'; | |
import styles from './ApiStyles'; | |
export default ApiContainer = () => { | |
const [loading, setLoading] = useState(false) | |
const [fromFetch, setFromFetch] = useState(false) | |
const [fromAxios, setFromAxios] = useState(false) | |
const [dataSource, setDataSource] = useState([]) |
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 goForAxios = () => { | |
setFromFetch(false); | |
setLoading(true); | |
axios.get("https://jsonplaceholder.typicode.com/users") | |
.then(response => { | |
console.log('getting data from axios', response.data); | |
setTimeout(() => { | |
setLoading(false); | |
setAxiosData(response.data); |
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 goForFetch = () => { | |
setFromFetch(true); | |
setLoading(true); | |
fetch("https://jsonplaceholder.typicode.com/users") | |
.then(response => response.json()) | |
.then((responseJson) => { | |
console.log('getting data from fetch', responseJson) | |
setTimeout(() => { | |
setLoading(false); | |
setDataSource(responseJson) |
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 from 'react'; | |
import ApiContainer from './App/Screens/ApiContainer'; | |
const App = () => { | |
return ( | |
<> | |
<ApiContainer /> | |
</> | |
); |