FIX: Latest nav 5 would show double headers if modals were not their own stack.

This commit is contained in:
marcosrdz 2020-11-23 22:15:33 -05:00
parent bfa147c912
commit 67580c2a90
8 changed files with 84 additions and 31 deletions

View File

@ -275,6 +275,34 @@ function DrawerRoot() {
);
}
const ReceiveDetailsStack = createStackNavigator();
const ReceiveDetailsStackRoot = () => (
<ReceiveDetailsStack.Navigator name="ReceiveDetailsRoot" screenOptions={defaultStackScreenOptions} initialRouteName="ReceiveDetails">
<RootStack.Screen name="ReceiveDetails" component={ReceiveDetails} options={ReceiveDetails.navigationOptions} />
</ReceiveDetailsStack.Navigator>
);
const WalletXpubStack = createStackNavigator();
const WalletXpubStackRoot = () => (
<WalletXpubStack.Navigator name="WalletXpubRoot" screenOptions={defaultStackScreenOptions} initialRouteName="WalletXpub">
<WalletXpubStack.Screen name="WalletXpub" component={WalletXpub} options={WalletXpub.navigationOptions} />
</WalletXpubStack.Navigator>
);
const WalletExportStack = createStackNavigator();
const WalletExportStackRoot = () => (
<WalletExportStack.Navigator name="WalletExportRoot" screenOptions={defaultStackScreenOptions} initialRouteName="WalletExport">
<WalletExportStack.Screen name="WalletExport" component={WalletExport} options={WalletExport.navigationOptions} />
</WalletExportStack.Navigator>
);
const LappBrowserStack = createStackNavigator();
const LappBrowserStackRoot = () => (
<LappBrowserStack.Navigator name="LappBrowserRoot" screenOptions={defaultStackScreenOptions} initialRouteName="LappBrowser">
<LappBrowserStack.Screen name="LappBrowser" component={LappBrowser} options={LappBrowser.navigationOptions} />
</LappBrowserStack.Navigator>
);
const InitStack = createStackNavigator();
const InitRoot = () => (
<InitStack.Navigator screenOptions={defaultScreenOptions} initialRouteName="LoadingScreenRoot">
@ -304,7 +332,7 @@ const Navigation = () => (
<RootStack.Screen name="HodlHodlWebview" component={HodlHodlWebview} options={HodlHodlWebview.navigationOptions} />
{/* screens */}
<RootStack.Screen name="WalletExport" component={WalletExport} options={WalletExport.navigationOptions} />
<RootStack.Screen name="WalletExportRoot" component={WalletExportStackRoot} options={{ headerShown: false }} />
<RootStack.Screen
name="ExportMultisigCoordinationSetup"
component={ExportMultisigCoordinationSetup}
@ -315,12 +343,12 @@ const Navigation = () => (
component={ViewEditMultisigCosigners}
options={ViewEditMultisigCosigners.navigationOptions}
/>
<RootStack.Screen name="WalletXpub" component={WalletXpub} options={WalletXpub.navigationOptions} />
<RootStack.Screen name="WalletXpubRoot" component={WalletXpubStackRoot} options={{ headerShown: false }} />
<RootStack.Screen name="BuyBitcoin" component={BuyBitcoin} options={BuyBitcoin.navigationOptions} />
<RootStack.Screen name="Marketplace" component={Marketplace} options={Marketplace.navigationOptions} />
<RootStack.Screen name="SelectWallet" component={SelectWallet} options={{ headerLeft: null }} />
<RootStack.Screen name="ReceiveDetails" component={ReceiveDetails} options={ReceiveDetails.navigationOptions} />
<RootStack.Screen name="LappBrowser" component={LappBrowser} options={LappBrowser.navigationOptions} />
<RootStack.Screen name="ReceiveDetailsRoot" component={ReceiveDetailsStackRoot} options={{ headerShown: false }} />
<RootStack.Screen name="LappBrowserRoot" component={LappBrowserStackRoot} options={{ headerShown: false }} />
<RootStack.Screen
name="ScanQRCodeRoot"

View File

@ -61,12 +61,12 @@ class DeeplinkSchemaMatch {
]);
} else if (action === 'openReceive') {
completionHandler([
'ReceiveDetailsRoot',
{
routeName: 'ReceiveDetails',
screen: 'ReceiveDetails',
params: {
walletID: wallet.getID(),
},
name: 'ReceiveDetails',
},
]);
}
@ -232,11 +232,14 @@ class DeeplinkSchemaMatch {
}
completionHandler([
'LappBrowser',
'LappBrowserRoot',
{
fromSecret: lnWallet.getSecret(),
fromWallet: lnWallet,
url: urlObject.query.url,
screen: 'LappBrowser',
params: {
fromSecret: lnWallet.getSecret(),
fromWallet: lnWallet,
url: urlObject.query.url,
},
},
]);
break;

View File

@ -184,8 +184,11 @@ export default class LNDCreateInvoice extends Component {
onSuccess: this.renderReceiveDetails,
onFailure: () => {
this.props.navigation.dangerouslyGetParent().pop();
this.props.navigation.navigate('WalletExport', {
walletID: this.state.fromWallet.getID(),
this.props.navigation.navigate('WalletExportRoot', {
screen: 'WalletExportRoot',
params: {
walletID: this.state.fromWallet.getID(),
},
});
},
});

View File

@ -230,8 +230,11 @@ const ReceiveDetails = () => {
onSuccess: obtainWalletAddress,
onFailure: () => {
goBack();
navigate('WalletExport', {
walletID: wallet.getID(),
navigate('WalletExportRoot', {
screen: 'WalletExport',
params: {
walletID: wallet.getID(),
},
});
},
});

View File

@ -293,7 +293,6 @@ const styles = StyleSheet.create({
CoinControl.navigationOptions = () => ({
...BlueNavigationStyle(null, false),
title: loc.cc.header,
gestureEnabled: false,
});
export default CoinControl;

View File

@ -63,7 +63,6 @@ export default class SendCreate extends Component {
})
.catch(error => {
console.log(error);
alert(error.message);
})
.finally(() => {
RNFS.unlink(filePath);

View File

@ -186,8 +186,11 @@ const WalletDetails = () => {
}, [popToTop, wallet]);
const navigateToWalletExport = () => {
navigate('WalletExport', {
walletID: wallet.getID(),
navigate('WalletExportRoot', {
screen: 'WalletExport',
params: {
walletID: wallet.getID(),
},
});
};
const navigateToMultisigCoordinationSetup = () => {
@ -201,8 +204,11 @@ const WalletDetails = () => {
});
};
const navigateToXPub = () =>
navigate('WalletXpub', {
secret: wallet.getSecret(),
navigate('WalletXpubRoot', {
screen: 'WalletXpub',
params: {
secret: wallet.getSecret(),
},
});
const renderMarketplaceButton = () => {

View File

@ -282,8 +282,11 @@ const WalletTransactions = () => {
onPress={() => {
setIsManageFundsModalVisible(false);
navigate('ReceiveDetails', {
walletID: wallet.current.getID(),
navigate('ReceiveDetailsRoot', {
screen: 'ReceiveDetails',
params: {
walletID: wallet.current.getID(),
},
});
}}
title={loc.lnd.refill_external}
@ -324,7 +327,10 @@ const WalletTransactions = () => {
<TouchableOpacity
onPress={() => {
if (wallet.current.type === LightningCustodianWallet.type) {
navigate('LappBrowser', { fromSecret: wallet.current.getSecret(), fromWallet: wallet.current });
navigate('LappBrowserRoot', {
screen: 'LappBrowser',
params: { fromSecret: wallet.current.getSecret(), fromWallet: wallet.current },
});
} else {
navigate('Marketplace', { fromWallet: wallet.current });
}
@ -353,10 +359,13 @@ const WalletTransactions = () => {
return (
<TouchableOpacity
onPress={() => {
navigate('LappBrowser', {
fromSecret: wallet.current.getSecret(),
fromWallet: wallet,
url: 'https://duckduckgo.com',
navigate('LappBrowserRoot', {
screen: 'LappBrowser',
params: {
fromSecret: wallet.current.getSecret(),
fromWallet: wallet,
url: 'https://duckduckgo.com',
},
});
}}
style={[styles.marketplaceButton2, stylesHook.marketplaceButton2]}
@ -581,8 +590,11 @@ const WalletTransactions = () => {
setIsManageFundsModalVisible(true);
},
onFailure: () =>
navigate('WalletExport', {
walletID: wallet.current.getID(),
navigate('WalletExportRoot', {
screen: 'WalletExport',
params: {
walletID: wallet.current.getID(),
},
}),
});
}
@ -641,7 +653,7 @@ const WalletTransactions = () => {
if (wallet.current.chain === Chain.OFFCHAIN) {
navigate('LNDCreateInvoiceRoot', { screen: 'LNDCreateInvoice', params: { fromWallet: wallet.current } });
} else {
navigate('ReceiveDetails', { walletID: wallet.current.getID() });
navigate('ReceiveDetailsRoot', { screen: 'ReceiveDetails', params: { walletID: wallet.current.getID() } });
}
}}
icon={