-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b1c9629
commit 885c95c
Showing
36 changed files
with
628 additions
and
175 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { AntDesign } from '@expo/vector-icons'; | ||
import { Touch } from './styles'; | ||
|
||
const Close = ({ onPress, size }: { onPress: () => Promise<void>; size: number }) => { | ||
return ( | ||
<Touch onPress={onPress}> | ||
<AntDesign name="closecircle" size={size} color="red" /> | ||
</Touch> | ||
); | ||
}; | ||
|
||
export default Close; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import styled from 'styled-components/native'; | ||
|
||
import T from '@components/common/Touch'; | ||
|
||
export const Touch = styled(T)``; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { useRef } from 'react'; | ||
import { ActivityIndicator, Modal, Text } from 'react-native'; | ||
import LottieView from 'lottie-react-native'; | ||
import { Container, ContainerBox } from './styles'; | ||
import Close from '@src/components/common/Close'; | ||
import useRemoteAsset from '@src/hooks/useRemoteAsset'; | ||
|
||
const NewChalk = ({ | ||
text, | ||
visible, | ||
toggleModal, | ||
}: { | ||
text: string; | ||
visible: boolean; | ||
toggleModal: () => void; | ||
}) => { | ||
const animation = useRef(null); | ||
const { data, loading } = useRemoteAsset( | ||
'https://firebasestorage.googleapis.com/v0/b/chatalk-96c5b.appspot.com/o/app-assets%2Flottiefiles%2Fradar.json?alt=media&token=4f377968-7661-4911-8868-4de72991e798' | ||
); | ||
|
||
if (loading) { | ||
return <ActivityIndicator />; | ||
} | ||
|
||
return ( | ||
<Modal transparent={true} animationType="slide" visible={visible}> | ||
<Container> | ||
<ContainerBox> | ||
{data ? ( | ||
<LottieView | ||
autoPlay | ||
ref={animation} | ||
style={{ | ||
width: 200, | ||
height: 200, | ||
backgroundColor: 'transparent', | ||
}} | ||
source={data} | ||
/> | ||
) : ( | ||
<Text>Error loading animation</Text> | ||
)} | ||
<Text>{text}</Text> | ||
<Close size={60} onPress={async () => toggleModal()} /> | ||
</ContainerBox> | ||
</Container> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default NewChalk; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import styled from 'styled-components/native'; | ||
|
||
export const Container = styled.View` | ||
flex: 1; | ||
justify-content: center; | ||
align-items: center; | ||
`; | ||
|
||
export const ContainerBox = styled.View` | ||
width: 50%; | ||
height: 50%; | ||
background-color: white; | ||
margin: 10px; | ||
justify-content: space-between; | ||
align-items: center; | ||
border-radius: 100000px; | ||
`; |
File renamed without changes.
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import MatchConfigType from '@src/types/matchConfig'; | ||
import { useCallback } from 'react'; | ||
import realmContext from '@contexts/realm'; | ||
import useUser from '../useUser'; | ||
import updateRealmMatchConfig from '@src/services/realm/update/matchConfig'; | ||
import { matchingConfig } from '@src/services/localStorage/defaults'; | ||
|
||
const useMatchConfig = () => { | ||
const realm = realmContext.useRealm(); | ||
const me = useUser(); | ||
|
||
const state = realmContext | ||
.useQuery<MatchConfigType>('MatchingConfig') | ||
.filtered(`id == '${me?.id}'`)[0]; | ||
|
||
const change = useCallback( | ||
(value: MatchConfigType) => { | ||
updateRealmMatchConfig(realm, { id: me.id, ...value }); | ||
}, | ||
[me] | ||
); | ||
|
||
return { matchConfig: state ?? matchingConfig, setMatchConfig: change }; | ||
}; | ||
|
||
export default useMatchConfig; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { useEffect, useState } from 'react'; | ||
import { Asset } from 'expo-asset'; | ||
|
||
const useRemoteAsset = (url: string) => { | ||
const [data, setData] = useState(null); | ||
const [loading, setLoading] = useState(true); | ||
|
||
useEffect(() => { | ||
const loadRemote = async () => { | ||
try { | ||
const asset = Asset.fromURI(url); | ||
await asset.downloadAsync(); | ||
const response = await fetch(asset.uri); | ||
const jsonData = await response.json(); | ||
setData(jsonData); | ||
} catch (error) { | ||
console.error('Error loading remote JSON asset:', error); | ||
} finally { | ||
setLoading(false); | ||
} | ||
}; | ||
|
||
loadRemote(); | ||
}, []); | ||
|
||
return { | ||
data, | ||
loading, | ||
}; | ||
}; | ||
|
||
export default useRemoteAsset; |
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
Oops, something went wrong.