Browse Source

FIX: Align marketplace button

setparams
Marcos Rodriguez 5 years ago
parent
commit
addd8a2926
  1. 111
      screen/wallets/transactions.js

111
screen/wallets/transactions.js

@ -73,9 +73,6 @@ export default class WalletTransactions extends Component {
const wallet = props.navigation.getParam('wallet');
this.props.navigation.setParams({ wallet: wallet, isLoading: true });
this.state = {
showMarketplace: Platform.OS === 'ios' ? wallet.getBalance() > 0 : true,
isIos: Platform.OS === 'ios',
isAndroid: Platform.OS !== 'ios',
isLoading: true,
isManageFundsModalVisible: false,
showShowFlatListRefreshControl: false,
@ -276,6 +273,63 @@ export default class WalletTransactions extends Component {
);
};
renderMarketplaceButton = () => {
return Platform.select({
android: (
<TouchableOpacity
onPress={() => {
if (this.state.wallet.type === LightningCustodianWallet.type) {
this.props.navigation.navigate('LappBrowser', { fromSecret: this.state.wallet.getSecret(), fromWallet: this.state.wallet });
} else {
this.props.navigation.navigate('Marketplace', { fromWallet: this.state.wallet });
}
}}
>
<View
style={{
margin: 16,
backgroundColor: '#f2f2f2',
borderRadius: 9,
minHeight: 49,
justifyContent: 'center',
alignItems: 'center',
}}
>
<Text style={{ color: '#062453', fontSize: 18 }}>marketplace</Text>
</View>
</TouchableOpacity>
),
ios:
this.state.wallet.getBalance() > 0 ? (
<TouchableOpacity
onPress={async () => {
if (this.state.wallet.type === LightningCustodianWallet.type) {
Linking.openURL('https://bluewallet.io/marketplace/');
} else {
let address = await this.state.wallet.getAddressAsync();
Linking.openURL('https://bluewallet.io/marketplace-btc/?address=' + address);
}
}}
>
<View
style={{
margin: 16,
backgroundColor: '#f2f2f2',
borderRadius: 9,
minHeight: 49,
justifyContent: 'center',
flexDirection: 'row',
alignItems: 'center',
}}
>
<Icon name="external-link" size={18} type="font-awesome" color="#9aa0aa" />
<Text style={{ color: '#062453', fontSize: 18, marginHorizontal: 8 }}>marketplace</Text>
</View>
</TouchableOpacity>
) : null,
});
};
onWalletSelect = async wallet => {
NavigationService.navigate('WalletTransactions');
/** @type {LightningCustodianWallet} */
@ -344,56 +398,7 @@ export default class WalletTransactions extends Component {
onManageFundsPressed={() => this.setState({ isManageFundsModalVisible: true })}
/>
<View style={{ flex: 1, backgroundColor: '#FFFFFF' }}>
{this.state.showMarketplace && this.state.isAndroid && (
<TouchableOpacity
onPress={() => {
if (this.state.wallet.type === LightningCustodianWallet.type) {
navigate('LappBrowser', { fromSecret: this.state.wallet.getSecret(), fromWallet: this.state.wallet });
} else {
navigate('Marketplace', { fromWallet: this.state.wallet });
}
}}
>
<View
style={{
margin: 16,
backgroundColor: '#f2f2f2',
borderRadius: 9,
minHeight: 49,
justifyContent: 'center',
alignItems: 'center',
}}
>
<Text style={{ color: '#062453', fontSize: 18 }}>marketplace</Text>
</View>
</TouchableOpacity>
)}
{this.state.showMarketplace && this.state.isIos && (
<TouchableOpacity
onPress={async () => {
if (this.state.wallet.type === LightningCustodianWallet.type) {
Linking.openURL('https://bluewallet.io/marketplace/');
} else {
let address = await this.state.wallet.getAddressAsync();
Linking.openURL('https://bluewallet.io/marketplace-btc/?address=' + address);
}
}}
>
<View
style={{
margin: 16,
backgroundColor: '#f2f2f2',
borderRadius: 9,
minHeight: 49,
justifyContent: 'center',
alignItems: 'center',
}}
>
<Icon name="external-link" size={18} type="font-awesome" color="#9aa0aa" />
<Text style={{ color: '#062453', fontSize: 18 }}>marketplace</Text>
</View>
</TouchableOpacity>
)}
{this.renderMarketplaceButton()}
<FlatList
onEndReachedThreshold={0.3}
onEndReached={() => {

Loading…
Cancel
Save