mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-03-12 10:30:36 +01:00
Created App container with Navigator ref and proper Linking
This commit is contained in:
parent
811ea39bf7
commit
a450c865df
2 changed files with 47 additions and 2 deletions
45
App.js
Normal file
45
App.js
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
import React from 'react';
|
||||||
|
import { Linking } from 'react-native';
|
||||||
|
import { NavigationActions } from 'react-navigation';
|
||||||
|
|
||||||
|
import MainBottomTabs from './MainBottomTabs';
|
||||||
|
|
||||||
|
export default class App extends React.Component {
|
||||||
|
navigator = null;
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
Linking.getInitialURL()
|
||||||
|
.then(url => this.handleOpenURL({ url }))
|
||||||
|
.catch(console.error);
|
||||||
|
|
||||||
|
Linking.addEventListener('url', this.handleOpenURL);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
Linking.removeEventListener('url', this.handleOpenURL);
|
||||||
|
}
|
||||||
|
|
||||||
|
handleOpenURL = event => {
|
||||||
|
if (event.url && event.url.indexOf('bitcoin:') === 0) {
|
||||||
|
this.navigator &&
|
||||||
|
this.navigator.dispatch(
|
||||||
|
NavigationActions.navigate({
|
||||||
|
routeName: 'SendDetails',
|
||||||
|
params: {
|
||||||
|
uri: event.url,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<MainBottomTabs
|
||||||
|
ref={nav => {
|
||||||
|
this.navigator = nav;
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
4
index.js
4
index.js
|
@ -1,6 +1,6 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import './shim.js';
|
import './shim.js';
|
||||||
import MainBottomTabs from './MainBottomTabs';
|
import App from './App';
|
||||||
import { Sentry } from 'react-native-sentry';
|
import { Sentry } from 'react-native-sentry';
|
||||||
import { AppRegistry } from 'react-native';
|
import { AppRegistry } from 'react-native';
|
||||||
import WalletMigrate from './screen/wallets/walletMigrate';
|
import WalletMigrate from './screen/wallets/walletMigrate';
|
||||||
|
@ -28,7 +28,7 @@ class BlueAppComponent extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return this.state.isMigratingData ? <WalletMigrate onComplete={() => this.setIsMigratingData()} /> : <MainBottomTabs />;
|
return this.state.isMigratingData ? <WalletMigrate onComplete={() => this.setIsMigratingData()} /> : <App />;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue