Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/multicurrency' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Asherda committed Dec 9, 2023
2 parents 773f543 + 85afb7b commit a9e76a5
Show file tree
Hide file tree
Showing 13 changed files with 532 additions and 321 deletions.
9 changes: 9 additions & 0 deletions src/actions/actionCreators.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
SET_COIN_LIST,
SET_USER_COINS,
SET_BALANCES,
SET_BALANCE_SHOW,
SET_ONE_BALANCE,
SET_TRANSACTIONS,
//SET_INTERVAL_ID,
Expand Down Expand Up @@ -246,6 +247,14 @@ export const setBalances = (balances) => {
}
}


//Reducer name: coins
export const setBalanceShow = () => {
return {
type: SET_BALANCE_SHOW
}
}

//Reducer name: ledger
export const setOneBalance = (coinId, balance) => {
return {
Expand Down
93 changes: 47 additions & 46 deletions src/components/Alert.js
Original file line number Diff line number Diff line change
@@ -1,72 +1,73 @@
import * as React from 'react';
import { SafeAreaView, ScrollView } from 'react-native';
import { SafeAreaView, ScrollView, Dimensions } from 'react-native';
import { Button, Dialog, Portal, Text } from 'react-native-paper';
import { connect } from 'react-redux';
import Colors from '../globals/colors';

const AlertModal = (props) => {
const [modalShown, setModalShown] = React.useState(false);
const [modalToBeShown, setModalToBeShown] = React.useState(false)
const [modalToBeShown, setModalToBeShown] = React.useState(false);
const visible = props.activeAlert != null;

if (visible && !modalToBeShown) {
setModalToBeShown(true)

setTimeout(() => setModalShown(true), 100)
setModalToBeShown(true);
setTimeout(() => setModalShown(true), 100);
} else if (!visible && modalToBeShown) {
setModalToBeShown(false)
setModalShown(false)
setModalToBeShown(false);
setModalShown(false);
return null;
} else if (!visible) return null;

return null
} else if (!visible) return null
const { height } = Dimensions.get('window');
const dialogContentMaxHeight = height * 0.6; // Adjust this value as needed

const title = props.activeAlert.title;
const description = props.activeAlert.message;
const buttons = props.activeAlert.buttons;
const cancelable =
props.activeAlert.options != null && props.activeAlert.cancelable;
const disabled =
props.activeAlert.options != null && props.activeAlert.disabled;
const cancelable = props.activeAlert.options != null && props.activeAlert.cancelable;
const disabled = props.activeAlert.options != null && props.activeAlert.disabled;

return (
<Portal>
<Dialog
dismissable={(!disabled && cancelable) === true}
visible={modalShown}
onDismiss={cancelable ? cancel : () => {}}
style={{maxHeight: "100%", marginBottom: 36}}
>
<Dialog.Title>{title}</Dialog.Title>
<Dialog.Content style={{maxHeight: "80%"}}>
<ScrollView>
<Text>{description}</Text>
</ScrollView>
</Dialog.Content>
<Dialog.Actions>
{buttons != null
? buttons.map((button, index) => {
return (
<Button
disabled={button.disabled || disabled}
onPress={button.onPress}
color={Colors.primaryColor}
key={index}
>
{button.text}
</Button>
);
})
: null}
</Dialog.Actions>
</Dialog>
</Portal>
<SafeAreaView>
<Portal>
<Dialog
dismissable={(!disabled && cancelable) === true}
visible={modalShown}
onDismiss={cancelable ? cancel : () => {}}
style={{ maxHeight: '100%', marginBottom: 36 }}
>
<Dialog.Title>{title}</Dialog.Title>
<Dialog.Content style={{ maxHeight: dialogContentMaxHeight }}>
<ScrollView>
<Text>{description}</Text>
</ScrollView>
</Dialog.Content>
<Dialog.Actions>
<ScrollView horizontal>
{buttons != null
? buttons.map((button, index) => (
<Button
disabled={button.disabled || disabled}
onPress={button.onPress}
color={Colors.primaryColor}
key={index}
>
{button.text}
</Button>
))
: null}
</ScrollView>
</Dialog.Actions>
</Dialog>
</Portal>
</SafeAreaView>
);
};

const mapStateToProps = (state) => {
return {
activeAlert: state.alert.active
}
activeAlert: state.alert.active,
};
};

export default connect(mapStateToProps)(AlertModal);
7 changes: 7 additions & 0 deletions src/components/SendModal/SendModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
ADD_ERC20_TOKEN_MODAL,
} from "../../utils/constants/sendModal";
import { SendModalRender } from "./SendModal.render"
import { DEVICE_WINDOW_HEIGHT } from "../../utils/constants/constants";

class SendModal extends Component {
constructor(props) {
Expand All @@ -38,6 +39,12 @@ class SendModal extends Component {
[CONVERT_OR_CROSS_CHAIN_SEND_MODAL]: 696
};

for (const key in this.DEFAULT_MODAL_HEIGHTS) {
if (this.DEFAULT_MODAL_HEIGHTS[key] > DEVICE_WINDOW_HEIGHT - 24) {
this.DEFAULT_MODAL_HEIGHTS[key] = DEVICE_WINDOW_HEIGHT - 24
}
}

this.state = {
persistFormDataOnClose: false,
loading: false,
Expand Down
Loading

0 comments on commit a9e76a5

Please sign in to comment.