This repository has been archived by the owner on Apr 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathApp.tsx
58 lines (50 loc) · 1.58 KB
/
App.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/**
* Example React Native App using XMTP.
*/
import React, {memo} from 'react';
// Polyfill necessary xmtp-js libraries for React Native.
import './polyfills.js';
import Home from './components/Home';
import * as Linking from 'expo-linking';
import {Text} from 'react-native';
import {NavigationContainer} from '@react-navigation/native';
import WalletConnectProvider, {
QrcodeModal,
RenderQrcodeModalProps,
} from '@walletconnect/react-native-dapp';
import AsyncStorage from '@react-native-async-storage/async-storage';
const APP_SCHEME = 'examplexmtp';
const prefix = Linking.createURL('/', {scheme: APP_SCHEME});
const App = () => {
const linking = {
prefixes: [prefix],
};
const QRCodeComponent = (props: RenderQrcodeModalProps) => {
if (!props.visible) {
return null;
}
return <QrcodeModal division={4} {...props} />;
};
const QRCodeModal = memo(QRCodeComponent);
return (
<NavigationContainer linking={linking} fallback={<Text>Loading...</Text>}>
<WalletConnectProvider
redirectUrl={`${APP_SCHEME}://`}
bridge="https://bridge.walletconnect.org"
renderQrcodeModal={props => <QRCodeModal {...props} />}
clientMeta={{
description: 'Sign in with XMTP',
url: 'https://xmtp.org',
icons: ['https://avatars.githubusercontent.com/u/82580170'],
name: 'XMTP',
}}
storageOptions={{
// @ts-expect-error: Internal
asyncStorage: AsyncStorage,
}}>
<Home />
</WalletConnectProvider>
</NavigationContainer>
);
};
export default App;