-
-
Notifications
You must be signed in to change notification settings - Fork 841
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: export PERMISSIONS #628
Conversation
@1natsu172 I'm not sure to understand what this PR really fix. Exporting empty maps on other platforms is something we want to avoid bundling unnecessary permissions. Ex: The permission list on windows weights ~8ko. There's no need to put that in the iOS or the Android JS bundle. |
@zoontek Sorry about that. I've been using the constants of each OS for test assertions in jest. I meant that the automatic resolution of "platform-specific extensions" by metro is not possible in jest, so can't get the constants in the node runtime. So I tried to export it with this PR. However, I also really understood your point about not doing unnecessary platform bundling. What do you think of the idea of not exporting from |
@1natsu172 I agree, only the mock needs to be edited. // mock.js
const {PERMISSIONS: {ANDROID}} = require('./dist/commonjs/permissions.android');
const {PERMISSIONS: {IOS}} = require('./dist/commonjs/permissions.ios');
const {PERMISSIONS: {WINDOWS}} = require('./dist/commonjs/permissions.windows');
const {RESULTS} = require('./dist/commonjs/results');
const PERMISSIONS = {ANDROID, IOS, WINDOWS};
export {PERMISSIONS, RESULTS};
// … This should work. I don't want to export |
1b30da8
to
aa338bb
Compare
@zoontek Thank you. I just changed the PR content to |
LGTM 👍 |
I made a new release for it: https://github.com/zoontek/react-native-permissions/releases/tag/3.0.5 |
@zoontek Thanks for the very very fast release! 🚀 |
Summary
The
PERMISSIONS
that were exported in v2 are not exported in v3. Specifically, the PERMISSIONS object is exported, but the actual object is empty.This causes an error when migrating from v2 because the permission constants are not found.
In this PR, the
PERMISSIONS
exported from each OS file has been removed and integrated intopermission.ts
.Test Plan
PERMISSIONS
exported from each OS file is not used from anywhere.yarn run lint
yarn run format
yarn run tscheck
What's required for testing (prerequisites)?
What are the steps to reproduce (after prerequisites)?
Compatibility
Checklist
README.md
CHANGELOG.md
example/App.js
)