Skip to content

Update Constants.ts #1585

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

Merged
merged 5 commits into from
Oct 6, 2021
Merged

Update Constants.ts #1585

merged 5 commits into from
Oct 6, 2021

Conversation

tacoelho
Copy link
Contributor

@tacoelho tacoelho commented Oct 4, 2021

Fix #1582

Description

Listener removal to fix bug.

Changelog

Add remove() instead of removeListener to fix the error message

Update RN version.
package.json Outdated
"react-native": "0.64.1",
"react-native": ">=0.65.0",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be reverted, migrating to higher version of RN requires more than just changing the version in package.json

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn’t know that, sorry about that.
I’ll fix.

package.json Outdated
@@ -99,7 +99,7 @@
"react": "17.0.1",
"react-autobind": "^1.0.6",
"react-dom": "^15.4.2",
"react-native": "0.64.1",
"react-native:"0.64.1",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You missed a "

Suggested change
"react-native:"0.64.1",
"react-native": "0.64.1",

Comment on lines +134 to +138
if (Dimensions.remove) {
Dimensions.remove('change', callback);
} else {
Dimensions.removeEventListener('change', callback);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tacoelho I approved, but then noticed the build fails.
It's probably because of TS.
The best way to see the errors is to run npm run prepush
Anyway, you can use @ts-expect-error for now

Suggested change
if (Dimensions.remove) {
Dimensions.remove('change', callback);
} else {
Dimensions.removeEventListener('change', callback);
}
// @ts-expect-error
if (Dimensions.remove) {
// @ts-expect-error
Dimensions.remove('change', callback);
} else {
Dimensions.removeEventListener('change', callback);
}

Copy link
Collaborator

@ethanshar ethanshar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to include this in our upcoming release
I'll merge these changes and fix the last comments in master.

Thank you for your contribution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Warning EventEmitter.removeListener('change', ...) has been deprecated
2 participants