-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Issues raised on iOS QA #325
Conversation
@@ -361,7 +361,6 @@ const AppStack = () => { | |||
> | |||
<Stack.Navigator | |||
screenOptions={{ | |||
presentation: 'modal', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the iOS modals exhibition have changed, this property is no longer desired.
src/screens/CreateTokenAmount.js
Outdated
@@ -114,7 +114,7 @@ class CreateTokenAmount extends React.Component { | |||
<HathorHeader | |||
title={t`CREATE TOKEN`} | |||
onBackPress={() => this.props.navigation.goBack()} | |||
onCancel={() => this.props.navigation.pop()} | |||
onCancel={() => this.props.navigation.getParent()?.goBack()} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if there is no parent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ?
operator was put there mostly as a coding best practice, but the idea is that there will always be a parent navigator there.
Not having a parent is a signal that there was a major refactor and our current hierarchy of navigators is different from expected. In that case, maybe throwing an exception would be a better way of informing the developer of the need to change this code as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the optional chaining operator on a38a087 .
await this.props.wallet.getNextAddress(); | ||
// When we create a new payment request, we don't update the address for a new one | ||
// This will only happen when it receives a transaction and becomes a used address | ||
await this.props.wallet.getCurrentAddress(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand what's going on here, did we change the logic for getCurrentAddress
and getNextAddress
? When?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was requested on item n⁰ 9 on issue 318.
getNextAddress()
not only fetches the next available address, but also marks the current one as used:
async getNextAddress() {
// First we mark the current address as used, then return the next
await this.getCurrentAddress({ markAsUsed: true });
By changing the call to getCurrentAddress()
we don't do this marking, and leave it to the wallet's new transaction websocket handler to do so.
If there is no property, it's better to throw an error than to silence it.
d6dc13e
to
a38a087
Compare
@@ -17,7 +17,13 @@ class AmountTextInput extends React.Component { | |||
} | |||
|
|||
focus = () => { | |||
this.inputRef.current.focus(); | |||
/* After the focus method is called, the screen is still re-rendered at least once more. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it happening just now? It was working before, wasn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it was working before.
I couldn't find a decisive answer for why this stopped working, but it probably has something to do with the general changes to the focus
related functions from React Navigation 4 to 5.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few considerations about this:
- This
focus
command works perfectly when the screen is mounted at the same time it is rendered. So it works on theCreateTokenAmount
andSendAmountInput
just as it used to work before. - The problem happens on the
NewPaymentRequest
screen, that is built inside a tab bar. TheAmountTextInput
that needs to be focused here is mounted when theMy Address
tab is focused, and because of that is not available to be rendered/focused at mount time. - The tab management component currently used does not use the React Navigation
material-top-tab-navigator
wrapper, but instead uses directly its underlyingreact-native-tab-view
lib.
That way, the focus
event does not work as expected within the screen after the migration from Navigator 4 to 5 and 6. It only receives the focus
event when changing from the Send stack to the Receive stack, for example.
I would suggest opening another PR to use the material-top-tab-navigator
on this Receive stack instead of the tab view, so that we could have the focus
events available on the screens again through React hooks and remove the edge case that brings the need for this setTimeout
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Create another issue to handle this and add it to the upgrade dependencies project, we can do it later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened issue
@@ -75,7 +76,7 @@ const HathorHeader = (props) => { | |||
|
|||
const styles = StyleSheet.create({ | |||
wrapper: { | |||
height: 56, | |||
height: HEADER_HEIGHT, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other PR you stop using this constant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right: while this PR was already under review I came up with a better organization for this on 326.
This variable will be short lived on the constants
file.
* Default Hathor Header height, used for recalculating layout offsets. | ||
* @type {number} | ||
*/ | ||
export const HEADER_HEIGHT = 56; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be removed in the iOS color PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The utils.js
still uses it on the 326 color PR. It will be completely removed soon on the colors refactor:
e53e4b2
to
9302110
Compare
9302110
to
d610eb4
Compare
Solves items from #318
Acceptance Criteria
Tested on simulators for devices:
Security Checklist