-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
React native upgrade 0.62.2 rebased #1586
Conversation
.gitignore
Outdated
@@ -69,3 +70,6 @@ coverage | |||
|
|||
# editor | |||
.vscode | |||
|
|||
# CocoaPods | |||
/ios/Pods/ |
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 see a lot of No new line ...
warnings
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.
Thanks I will fix that!
storeFile file('debug.keystore') | ||
storePassword 'android' | ||
keyAlias 'androiddebugkey' | ||
keyPassword 'android' |
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.
are we adding new keys?
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.
do we need keys for debug?
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 if you start a new RN project those are there now. Take a look at this:
https://react-native-community.github.io/upgrade-helper/?from=0.59.10&to=0.62.1
@@ -36,7 +36,7 @@ | |||
android:launchMode="singleTask" | |||
android:name=".MainActivity" | |||
android:label="@string/app_name" | |||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize" | |||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" |
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.
cool
key.store=debug.keystore | ||
key.alias=androiddebugkey | ||
key.store.password=android | ||
key.alias.password=android |
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 made a comment before about this, so you passed these vars to that file?
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 followed this:
https://react-native-community.github.io/upgrade-helper/?from=0.59.10&to=0.62.1
So, new RN projects now are like that
index.js
Outdated
"Cannot read property 'hash' of null", | ||
'componentWillUpdate', | ||
'componentWillReceiveProps', | ||
'getNode()' |
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 saw your comment about this on the PR description. I tried to find where we were using these on our side as you said and I couldn't... this seems to come from our deps right?
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 componentWillUpdate and componentWillReceiveProps are from our code (and probably from libs). We need to use hooks. The other ones are from libs yes.
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.
hm strange I'm searching on vscode on the project and I can't find these. But anyways I agree about hooks
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.
Oh you are right! I thought we were using those, because the project started before they were deprecated. Nevermind then, they are from libs!
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.
Following issues are happening only on Android
Issue 1:
Detox e2e isn't able to run on debug mode, nor release mode
Issue 2:
Assets are not showing up on wallet view; nor the option to add tokens and/or collectibles
Issue 3:
Similar to issue 2, when you are on a dapp and initiate a txn, the confirm view is missing both details and data
You can reproduce by going to https://metamask.github.io/test-dap and tapping on deploy contract after connecting
Issue 4:
Upon going to drawer > settings > Security & Privacy and then scrolling down to both SHOW PRIVATE KEY and REVEAL SEED PHRASE; once tapping those buttons and entering password, you're unable to see anything be displayed.
@ibrahimtaveras00 Those issues should be fixed now! |
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.
Fixes look good, QA Passed 👍
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.
approving now, waiting for your decision on d111f27
* all files changed * init Pods * pods working * app running * fixed native and metro problems * fix pods deployment target * android running but with RN errors * viewpager working * fixed our custom webview * Fix RCTAnalytics * lint [IMPORTANT] * fix warnings & gesture handler * update scritps and readme * fix most tests * tests working * fix TouchableHighlight tests * rebased * return to correct pod platform version * Upgrade to RN 0.62.2 * Fix detox * fix format * fix metro server start * fix bitcode error * fix e2e release ios * returning to previous deployment target * detox bump * fix yarn clean * Create react-native-scrollable-tab-view+1.0.0.patch * Back to 11.0 deployment target and fix sentry properties * Allow more memory for daemon * Fixed end of file warnings * remove extra space * Fix for e2e tests * Ignore VirtualizedLists warning
Since this is still calling scripts/cocoapods/flipper.rb: Setting React-RCTAppDelegate > config.build_settings > FB_SONARKIT_ENABLED=1 Causing React/AppSetup/RCTAppSetupUtils.mm to wrongly try importing FlipperKit Introduced in RN v0.62 - https://github.com/facebook/react-native/blob/v0.62.0/template/ios/Podfile - #1586 We should have removed in RN v0.64 - https://github.com/facebook/react-native/blob/v0.64.0/template/ios/Podfile - https://github.com/facebook/react-native/blob/v0.63.5/template/ios/Podfile
Should have been added only as debug (not release) config in our RN 0.62.2 upg: #1586 Ref: https://github.com/facebook/react-native/blob/v0.62.0/template/ios/HelloWorld.xcodeproj/project.pbxproj#L500
Should have been added as an Apple Clang preprocessor macro (not compiler flag) in our RN 0.62.2 upg: #1586 Refactor in xcodeproj target - from: Apple Clang - Custom Compiler Flags > Other C Flags - to: Apple Clang - Preprocessing > Preprocessor Macros Ref: https://github.com/facebook/react-native/blob/v0.62.0/template/ios/HelloWorld.xcodeproj/project.pbxproj#L500 Nb: rn-tester sticking to "-DFB_SONARKIT_ENABLED=1" for OTHER_CFLAGS and OTHER_SWIFT_FLAGS
Originally added in our RN 0.62.2 upg: #1586 Should have been removed since RN 0.63.0: https://github.com/facebook/react-native/blob/v0.63.0/template/ios/HelloWorld.xcodeproj/project.pbxproj Ref: facebook/react-native#28796
## **Description** There is a bug with the RPC url not being displayed correctly when trying to add a network via a dapp. This raises a security concern because the user can potentially add a malicious network if a network RPC URL is not shown. Furthermore, the height of the network added sheet extends further than that of prod. ## **Related issues** Fixes: [#1586 ](MetaMask/mobile-planning#1586) ## **Manual testing steps** 1. Given I am on the browser view 2. And I connect my wallet to chainlist.wtf 3. When I add "Avalanche" 4. Then the add network sheet is displayed 5. But the RPC URL is not displayed correctly ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> <img width="370" alt="before-bug" src="https://github.com/MetaMask/metamask-mobile/assets/26223211/32c69155-458e-4d88-bc27-d4a175827b59"> ### **After** <!-- [screenshots/recordings] --> <img width="382" alt="fix-bug" src="https://github.com/MetaMask/metamask-mobile/assets/26223211/04b9b02d-d5de-4dad-8bd5-8e937045e74f"> ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've clearly explained what problem this PR is solving and how it is solved. - [x] I've linked related issues - [x] I've included manual testing steps - [x] I've included screenshots/recordings if applicable - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. - [x] I’ve properly set the pull request status: - [ ] In case it's not yet "ready for review", I've set it to "draft". - [x] In case it's "ready for review", I've changed it from "draft" to "non-draft". ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
## **Description** There is a bug with the RPC url not being displayed correctly when trying to add a network via a dapp. This raises a security concern because the user can potentially add a malicious network if a network RPC URL is not shown. Furthermore, the height of the network added sheet extends further than that of prod. ## **Related issues** Fixes: [#1586 ](MetaMask/mobile-planning#1586) ## **Manual testing steps** 1. Given I am on the browser view 2. And I connect my wallet to chainlist.wtf 3. When I add "Avalanche" 4. Then the add network sheet is displayed 5. But the RPC URL is not displayed correctly ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> <img width="370" alt="before-bug" src="https://github.com/MetaMask/metamask-mobile/assets/26223211/32c69155-458e-4d88-bc27-d4a175827b59"> ### **After** <!-- [screenshots/recordings] --> <img width="382" alt="fix-bug" src="https://github.com/MetaMask/metamask-mobile/assets/26223211/04b9b02d-d5de-4dad-8bd5-8e937045e74f"> ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've clearly explained what problem this PR is solving and how it is solved. - [x] I've linked related issues - [x] I've included manual testing steps - [x] I've included screenshots/recordings if applicable - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. - [x] I’ve properly set the pull request status: - [ ] In case it's not yet "ready for review", I've set it to "draft". - [x] In case it's "ready for review", I've changed it from "draft" to "non-draft". ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
Description
This PR addresses the upgrade from React Native 0.59.10 to 0.62.2. Although there were lots of changes necessary, an effort was made in order to keep as much as possible the version of the libraries that were already being used (no unnecessary library upgrades were made), and also to keep as much of the code as intact as possible (no unnecessary code changes were made). This makes it easier to track any possible problems to the React Native upgrade itself. The upgrading of libraries to a newer current version is a step 2 outside of this PR context.
Note: To run this PR, don't forget to check the changes on the README. More specifically installing the pods:
brew install cocoapods
And on the root of the project
cd ios && pod install && cd ..
To open the project on Xcode, the file MetaMask.xcworkspace should be used instead of MetaMask.xcodeproj.
yarn clean
also installs the pods now.General file changes
The first part of the upgrade was making all the file changes needed in order to integrate the new React Native version. Those changes can be followed on this upgrade-helper.
Library changes
One of the biggest changes in React 0.60+ is the integration by default of the pods system. This means every library needed to be unlinked. This is because with the new system, every library is automatically linked. More specifically, the libraries that were unlinked were:
Libraries that did not support auto-linking
Some libraries couldn't be unlinked because they did not support auto-linking. Furthermore, in order for some of them to work, changes needed to be made on each library.
More specifically on iOS:
and on Android:
Patches removed
react-native+0.59.10.patch
. Since a new version of React Native was installed, this patch did not make sense anymore. No patch for the new version was necessary, at least for successfully compiling and running the app.Removed assets
react-native-vector-icons
were removed. The auto-linking should add those fonts automatically now.Errors fixed
After the app compiled successfully, there were some errors encountered when running the app. More specifically:
WebView
. After some research, the fix was modifying our custom WebView.import 'react-native-gesture-handler';
to theindex.js file
. See here.Warnings fixed
Animated: 'useNativeDriver' was not specified. This is a required 'option and must be explicitly set to true or false
. This warning was fixed by upgradingreact-native-modal
from 9.0.0 to 11.5.6.Animated.event now requires a second argument for options
. This warning was fixed by upgradingreact-native-modal
from 9.0.0 to 11.5.6.Calling getNode() on the ref of an Animated component is no longer necessary
. Since a lot of libraries were causing this warning likereact-native-scrollable-tab-view
,react-native-keyboard-aware-scroll-view
andreact-native-tab-view
, this warning was added to the ignore list. We should address this by upgrading the libraries mentioned.componentWillUpdate deprecated
. Since this appears on a lot of our components, this warning was added to the ignore list. Check this for possible fix.componentWillReceiveProps deprecated
. Since this appears on a lot of our components, this warning was added to the ignore list. Check this for possible fix.Lint
The lint plugin we used called
eslint-config-react-native
no longer worked correctly with the new React Native version. The reccommended plugin now is@react-native-community/eslint-config
. An effort was made so that our current rules remained the same. Because of this, there were lots of rules added so a new file called.eslintrc.js
was created to accommodate all the rules. It's possible that this new config is more strict, so we may still change the config file to our liking.Issue
Resolves #1201