Skip to content

Commit

Permalink
Fix modal scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
ugur-eren committed Jul 24, 2024
1 parent f1ca1b8 commit ba5bb44
Showing 1 changed file with 89 additions and 92 deletions.
181 changes: 89 additions & 92 deletions JoyboyCommunity/src/modules/TipModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {NDKEvent} from '@nostr-dev-kit/ndk';
import {useAccount} from '@starknet-react/core';
import {forwardRef, useState} from 'react';
import {View} from 'react-native';
import {SafeAreaView} from 'react-native-safe-area-context';
import {CallData, uint256} from 'starknet';

import {Avatar, Button, Input, Modalize, Picker, Text} from '../../components';
Expand Down Expand Up @@ -115,111 +114,109 @@ export const TipModal = forwardRef<Modalize, TipModalProps>(
};

return (
<Modalize title="Tip" ref={ref} modalStyle={styles.modal}>
<SafeAreaView edges={['bottom', 'left', 'right']}>
<View style={styles.card}>
<View style={styles.cardHeader}>
<View style={styles.cardContent}>
<Avatar size={48} source={require('../../assets/joyboy-logo.png')} />

<View style={styles.cardInfo}>
<Text
fontSize={15}
color="text"
weight="bold"
numberOfLines={1}
ellipsizeMode="middle"
>
{profile?.displayName ?? profile?.name ?? event?.pubkey}
</Text>
<Modalize title="Tip" ref={ref} disableScrollIfPossible={false} modalStyle={styles.modal}>
<View style={styles.card}>
<View style={styles.cardHeader}>
<View style={styles.cardContent}>
<Avatar size={48} source={require('../../assets/joyboy-logo.png')} />

<View style={styles.cardInfo}>
<Text
fontSize={15}
color="text"
weight="bold"
numberOfLines={1}
ellipsizeMode="middle"
>
{profile?.displayName ?? profile?.name ?? event?.pubkey}
</Text>

{profile?.nip05 && (
<Text fontSize={11} color="textLight" weight="regular">
@{profile?.nip05}
</Text>
)}
</View>
{profile?.nip05 && (
<Text fontSize={11} color="textLight" weight="regular">
@{profile?.nip05}
</Text>
)}
</View>
</View>

<Text
fontSize={13}
weight="medium"
color="text"
numberOfLines={1}
ellipsizeMode="tail"
style={styles.cardContentText}
>
{event?.content}
</Text>
</View>

<View style={styles.pickerContainer}>
<View>
<Picker
label="Please select a token"
selectedValue={token}
onValueChange={(itemValue) => setToken(itemValue as TokenSymbol)}
>
{Object.values(TOKENS).map((tkn) => (
<Picker.Item
key={tkn[CHAIN_ID].symbol}
label={tkn[CHAIN_ID].name}
value={tkn[CHAIN_ID].symbol}
/>
))}
</Picker>
</View>

<Input value={amount} onChangeText={setAmount} placeholder="Amount" />
<Text
fontSize={13}
weight="medium"
color="text"
numberOfLines={1}
ellipsizeMode="tail"
style={styles.cardContentText}
>
{event?.content}
</Text>
</View>

<View style={styles.pickerContainer}>
<View>
<Picker
label="Please select a token"
selectedValue={token}
onValueChange={(itemValue) => setToken(itemValue as TokenSymbol)}
>
{Object.values(TOKENS).map((tkn) => (
<Picker.Item
key={tkn[CHAIN_ID].symbol}
label={tkn[CHAIN_ID].name}
value={tkn[CHAIN_ID].symbol}
/>
))}
</Picker>
</View>

<View style={styles.sending}>
<View style={styles.sendingText}>
<Text color="textSecondary" fontSize={16} weight="medium">
Sending
</Text>
<Input value={amount} onChangeText={setAmount} placeholder="Amount" />
</View>

{amount.length > 0 && token.length > 0 ? (
<Text color="primary" fontSize={16} weight="bold">
{amount} {token}
</Text>
) : (
<Text color="primary" fontSize={16} weight="bold">
...
</Text>
)}
</View>
<View style={styles.sending}>
<View style={styles.sendingText}>
<Text color="textSecondary" fontSize={16} weight="medium">
Sending
</Text>

<View style={styles.recipient}>
<Text fontSize={16} weight="regular">
to
{amount.length > 0 && token.length > 0 ? (
<Text color="primary" fontSize={16} weight="bold">
{amount} {token}
</Text>
<Text numberOfLines={1} ellipsizeMode="middle" fontSize={16} weight="medium">
{(profile?.nip05 && `@${profile.nip05}`) ??
profile?.displayName ??
profile?.name ??
event?.pubkey}
) : (
<Text color="primary" fontSize={16} weight="bold">
...
</Text>
</View>
)}
</View>

<View style={styles.submitButton}>
<Button variant="secondary" disabled={!isActive} onPress={onTipPress}>
Tip
</Button>
<View style={styles.recipient}>
<Text fontSize={16} weight="regular">
to
</Text>
<Text numberOfLines={1} ellipsizeMode="middle" fontSize={16} weight="medium">
{(profile?.nip05 && `@${profile.nip05}`) ??
profile?.displayName ??
profile?.name ??
event?.pubkey}
</Text>
</View>

<Text
weight="semiBold"
color="inputPlaceholder"
fontSize={13}
align="center"
style={styles.comment}
>
Tip friends and support creators with your favorite tokens.
</Text>
</SafeAreaView>
</View>

<View style={styles.submitButton}>
<Button variant="secondary" disabled={!isActive} onPress={onTipPress}>
Tip
</Button>
</View>

<Text
weight="semiBold"
color="inputPlaceholder"
fontSize={13}
align="center"
style={styles.comment}
>
Tip friends and support creators with your favorite tokens.
</Text>
</Modalize>
);
},
Expand Down

0 comments on commit ba5bb44

Please sign in to comment.