-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #198 from VerusCoin/dev
v1.0.23
- Loading branch information
Showing
25 changed files
with
1,511 additions
and
99 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
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
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,207 @@ | ||
import React, { useState, useEffect, useRef } from "react"; | ||
import { Platform, SafeAreaView, View } from "react-native"; | ||
import { Text, Portal, Button, IconButton } from "react-native-paper"; | ||
import Colors from "../../globals/colors"; | ||
import SemiModal from "../SemiModal"; | ||
import { createMaterialTopTabNavigator } from '@react-navigation/material-top-tabs'; | ||
import { NavigationContainer } from "@react-navigation/native"; | ||
import { createStackNavigator } from "@react-navigation/stack"; | ||
import AnimatedActivityIndicatorBox from "../AnimatedActivityIndicatorBox"; | ||
|
||
import { useSelector } from "react-redux"; | ||
import { CONVERT_CARD_MODAL_MODES } from "../../utils/constants/convert"; | ||
import SearchableList from "../SearchableList"; | ||
|
||
const TopTabs = createMaterialTopTabNavigator(); | ||
const Root = createStackNavigator(); | ||
|
||
const ConvertCardModal = ({ | ||
onClose, | ||
visible, | ||
setVisible, | ||
totalBalances, | ||
mode, | ||
networks, | ||
converters, | ||
currencies, | ||
addresses, | ||
onSelectNetwork, | ||
onSelectAddress, | ||
onSelectCurrency, | ||
onSelectConverter, | ||
loading | ||
}) => { | ||
const [preventExit, setPreventExit] = useState(false); | ||
const [modalHeight, setModalHeight] = useState(600); // Adjust as needed | ||
|
||
const activeCoinsForUser = useSelector(state => state.coins.activeCoinsForUser); | ||
const [modalTitle, setModalTitle] = useState("Title"); | ||
|
||
useEffect(() => { | ||
// Handle side effects here if necessary | ||
}, []); | ||
|
||
const cancel = () => { | ||
if (!preventExit) { | ||
setVisible(false); | ||
if (onClose) { | ||
onClose(); | ||
} | ||
} | ||
}; | ||
|
||
const showHelpModal = () => { | ||
// Implement your help modal logic here | ||
}; | ||
|
||
return ( | ||
<Portal> | ||
<NavigationContainer> | ||
<SemiModal | ||
animationType="slide" | ||
transparent={true} | ||
visible={visible} | ||
onRequestClose={cancel} | ||
contentContainerStyle={{ | ||
height: modalHeight, | ||
flex: 0, | ||
backgroundColor: "white", | ||
}} | ||
> | ||
{loading ? <AnimatedActivityIndicatorBox /> : | ||
<SafeAreaView style={{ flex: 1 }}> | ||
<Root.Navigator | ||
screenOptions={{ | ||
header: () => ( | ||
<View style={{ | ||
flexDirection: 'row', | ||
alignItems: "center", | ||
justifyContent: "space-between", | ||
backgroundColor: Colors.secondaryColor | ||
}}> | ||
<IconButton icon="close" size={16} iconColor={Colors.verusDarkGray} /> | ||
<Text style={{ marginBottom: 16, fontSize: 16, textAlign: "center" }}> | ||
{modalTitle} | ||
</Text> | ||
</View> | ||
), | ||
headerStyle: { | ||
height: 52, | ||
}, | ||
}} | ||
> | ||
<Root.Screen name="ModalInner"> | ||
{() => ( | ||
<TopTabs.Navigator | ||
initialRouteName="SelectCurrency" | ||
backBehavior="none" | ||
tabBarPosition="bottom" | ||
screenOptions={{ | ||
swipeEnabled: false, | ||
tabBarPressColor: "transparent", | ||
tabBarPressOpacity: 1, | ||
tabBarLabelStyle: { | ||
fontSize: 12, | ||
}, | ||
lazy: true, | ||
lazyPlaceholder: () => <AnimatedActivityIndicatorBox />, | ||
}} | ||
> | ||
<TopTabs.Screen | ||
name="SelectCurrency" | ||
options={{ | ||
tabBarLabel: 'Currency', | ||
}} | ||
listeners={{ | ||
tabPress: e => { | ||
e.preventDefault(); | ||
}, | ||
}} | ||
> | ||
{tabProps => ( | ||
<SearchableList | ||
{...tabProps} | ||
items={currencies} | ||
setModalTitle={setModalTitle} | ||
onSelect={onSelectCurrency} | ||
nextScreen="SelectNetwork" | ||
/> | ||
)} | ||
</TopTabs.Screen> | ||
<TopTabs.Screen | ||
name="SelectNetwork" | ||
options={{ | ||
tabBarLabel: 'Network', | ||
}} | ||
listeners={{ | ||
tabPress: e => { | ||
e.preventDefault(); | ||
}, | ||
}} | ||
> | ||
{tabProps => ( | ||
<SearchableList | ||
{...tabProps} | ||
items={networks} | ||
setModalTitle={setModalTitle} | ||
onSelect={onSelectNetwork} | ||
nextScreen={mode === CONVERT_CARD_MODAL_MODES.SEND ? "SelectAddress" : "SelectConverter"} | ||
/> | ||
)} | ||
</TopTabs.Screen> | ||
{mode === CONVERT_CARD_MODAL_MODES.RECEIVE && ( | ||
<TopTabs.Screen | ||
name="SelectConverter" | ||
options={{ | ||
tabBarLabel: 'Via', | ||
}} | ||
listeners={{ | ||
tabPress: e => { | ||
e.preventDefault(); | ||
}, | ||
}} | ||
> | ||
{tabProps => ( | ||
<SearchableList | ||
{...tabProps} | ||
items={converters} | ||
setModalTitle={setModalTitle} | ||
onSelect={onSelectConverter} | ||
nextScreen="SelectAddress" | ||
/> | ||
)} | ||
</TopTabs.Screen> | ||
)} | ||
<TopTabs.Screen | ||
name="SelectAddress" | ||
options={{ | ||
tabBarLabel: mode === CONVERT_CARD_MODAL_MODES.SEND ? 'Source' : 'Dest', | ||
}} | ||
listeners={{ | ||
tabPress: e => { | ||
e.preventDefault(); | ||
}, | ||
}} | ||
> | ||
{tabProps => ( | ||
<SearchableList | ||
{...tabProps} | ||
items={addresses} | ||
setModalTitle={setModalTitle} | ||
onSelect={onSelectAddress} | ||
/> | ||
)} | ||
</TopTabs.Screen> | ||
</TopTabs.Navigator> | ||
)} | ||
</Root.Screen> | ||
</Root.Navigator> | ||
</SafeAreaView> | ||
} | ||
</SemiModal> | ||
</NavigationContainer> | ||
</Portal> | ||
); | ||
}; | ||
|
||
export default ConvertCardModal; |
Oops, something went wrong.