* Configure stack navigation to display header * Use wallet connect to connect with dApps * Replace react-native alerts with js alerts * Add example env file * Remove unnecessary code * Make UI changes * Uncomment required code * Remove unnecessary dependencies * Remove any type * Fix indentation --------- Co-authored-by: Shreerang Kale <shreerangkale@gmail.com> Co-authored-by: Nabarun <nabarun@deepstacksoft.com>
47 lines
1.4 KiB
TypeScript
47 lines
1.4 KiB
TypeScript
import React, { useState } from 'react';
|
|
import { View } from 'react-native';
|
|
import { Button, Text, TextInput } from 'react-native-paper';
|
|
|
|
import { useNavigation } from '@react-navigation/native';
|
|
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
|
|
|
|
import { web3WalletPair } from '../utils/wallet-connect/WalletConnectUtils';
|
|
import styles from '../styles/stylesheet';
|
|
import { StackParamsList } from '../types';
|
|
|
|
const AddSession = () => {
|
|
const navigation =
|
|
useNavigation<NativeStackNavigationProp<StackParamsList>>();
|
|
|
|
const [currentWCURI, setCurrentWCURI] = useState<string>('');
|
|
|
|
const pair = async () => {
|
|
const pairing = await web3WalletPair({ uri: currentWCURI });
|
|
navigation.navigate('WalletConnect');
|
|
return pairing;
|
|
};
|
|
|
|
return (
|
|
<View style={styles.appContainer}>
|
|
<View style={styles.inputContainer}>
|
|
<Text variant="titleMedium">Enter WalletConnect URI</Text>
|
|
<TextInput
|
|
mode="outlined"
|
|
onChangeText={setCurrentWCURI}
|
|
value={currentWCURI}
|
|
numberOfLines={4}
|
|
multiline={true}
|
|
style={styles.walletConnectUriText}
|
|
/>
|
|
|
|
<View style={styles.signButton}>
|
|
<Button mode="contained" onPress={pair}>
|
|
Pair Session
|
|
</Button>
|
|
</View>
|
|
</View>
|
|
</View>
|
|
);
|
|
};
|
|
export default AddSession;
|