Skip to content
This repository has been archived by the owner on Oct 26, 2021. It is now read-only.

Extremely dirty workaround for not responsive nav buttons #425

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ class App extends Component {
<OfflineBadge />
<Routes
ref={this.handleNavigatorRef}
screenProps={{ handleWalletConfig: this.handleWalletConfig }}
screenProps={{ handleWalletConfig: this.handleWalletConfig, nav: this.navigatorRef }}
/>
</FlexItem>
</Provider>
Expand Down
5 changes: 4 additions & 1 deletion src/components/header/CameraHeaderButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ CameraHeaderButton.propTypes = {

export default compose(
withHandlers({
onPress: ({ navigation }) => () => navigation.navigate('QRScannerScreen'),
onPress: ({ navigation, screenProps }) => () => {
screenProps.nav.state.nav.routes[0].index = 1;
navigation.navigate('QRScannerScreen');
},
}),
onlyUpdateForPropTypes,
)(CameraHeaderButton);
7 changes: 6 additions & 1 deletion src/components/header/ProfileHeaderButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ ProfileHeaderButton.propTypes = {
export default compose(
pure,
withRequests,
withHandlers({ onPress: ({ navigation }) => () => navigation.navigate('ProfileScreen') }),
withHandlers({
onPress: ({ navigation, screenProps }) => () => {
screenProps.nav.state.nav.routes[0].index = 1;
navigation.navigate('ProfileScreen');
},
}),
pickProps(Object.keys(ProfileHeaderButton.propTypes)),
)(ProfileHeaderButton);
5 changes: 4 additions & 1 deletion src/screens/ProfileScreenWithData.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ export default compose(
withIsWalletEmpty,
withRequests,
withHandlers({
onPressBackButton: ({ navigation }) => () => navigation.navigate('WalletScreen'),
onPressBackButton: ({ navigation, screenProps }) => () => {
screenProps.nav.state.nav.routes[0].index = 0;
navigation.navigate('WalletScreen');
},
onPressSettings: ({ navigation }) => () => navigation.navigate('SettingsModal'),
}),
withTrackingScreen,
Expand Down
6 changes: 5 additions & 1 deletion src/screens/QRScannerScreenWithData.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class QRScannerScreenWithData extends Component {
addWalletConnector: PropTypes.func,
isFocused: PropTypes.bool,
navigation: PropTypes.object,
screenProps: PropTypes.object,
setSafeTimeout: PropTypes.func,
}

Expand Down Expand Up @@ -54,7 +55,10 @@ class QRScannerScreenWithData extends Component {
this.setState({ sheetHeight: get(nativeEvent, 'layout.height') });
}

handlePressBackButton = () => this.props.navigation.navigate('WalletScreen')
handlePressBackButton = () => {
this.props.screenProps.nav.state.nav.routes[0].index = 2;
this.props.navigation.navigate('WalletScreen');
}

handleReenableScanning = () => this.setState({ enableScanning: true })

Expand Down
6 changes: 4 additions & 2 deletions src/screens/WalletScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class WalletScreen extends PureComponent {
navigation: PropTypes.object,
onRefreshList: PropTypes.func.isRequired,
refreshAccount: PropTypes.func,
screenProps: PropTypes.object,
sections: PropTypes.array,
showBlur: PropTypes.bool,
toggleShowShitcoins: PropTypes.func,
Expand Down Expand Up @@ -95,13 +96,14 @@ class WalletScreen extends PureComponent {
onRefreshList,
sections,
showBlur,
screenProps,
} = this.props;

return (
<Page style={{ flex: 1, ...position.sizeAsObject('100%') }}>
<Header justify="space-between">
<ProfileHeaderButton navigation={navigation} />
<CameraHeaderButton navigation={navigation} />
<ProfileHeaderButton screenProps={screenProps} navigation={navigation} />
<CameraHeaderButton screenProps={screenProps} navigation={navigation} />
</Header>
<FabWrapper disabled={isEmpty}>
<AssetList
Expand Down