-
Notifications
You must be signed in to change notification settings - Fork 323
Set up Gen2 environments pull and example apps #5274
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
base: main
Are you sure you want to change the base?
Conversation
|
const AMPLIFY_CONFIG_PATH = | ||
VERSION === 'gen1' ? 'src/amplifyconfiguration' : 'amplify_outputs'; | ||
|
||
const amplifyOutputs = require( |
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.
Have to use require()
for dynamic import because import()
is only supported by react native bundler when used in conjunction with React.lazy()
to load a lazy component.
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.
Note: we cannot extract const AMPLIFY_CONFIG_PATH
and reuse it elsewhere because that way, the bundler will fail to understand it and thus fail to do import analysis. It has to stay close to the require()
statement below.
|
||
Amplify.configure(config); | ||
const AMPLIFY_CONFIG_PATH = |
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.
Using src/amplifyconfiguration
- the json equivalent of src/aws-exports
because require
will return the exact config object when loading a json file versus putting it behind a default
key when loading a js file
Description of changes
aws-exports.js
files are moved@gen1
and@gen2
. 90% of them can be shared but a few scenarios will be differentiated(e.g., no username login in Gen2, error messages are different, etc)React Native
Set environment variable
VERSION=gen1
in example app andyarn e2e detox:e2e:ios:debug
Set environment variable
VERSION=gen2
in example app andyarn e2e detox:e2e:ios:debug:gen2
Set environment variable
VERSION=gen1
in example app andyarn e2e detox:build:android:debug
Set environment variable
VERSION=gen2
in example app andyarn e2e detox:build:android:debug:gen2
Note: when switching environment variable between
VERSION=gen1
andVERSION=gen2
, do NOT forget to reset the Metro cacheChecklist
yarn test
passes and tests are updated/addedsideEffects
field updatedBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.