Skip to content
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

Create a macOS implementation of AsyncStorage + macOS example app and e2e tests #296

Merged
merged 24 commits into from
Feb 27, 2020

Conversation

tom-un
Copy link
Contributor

@tom-un tom-un commented Feb 17, 2020

Summary:

This change adds a macOS implementation of AsyncStorage. It shares the same source as the iOS implementation.

The macOS react-native implementation is an "out-of-tree" platform from the core react-native repo which contains only iOS and Android implementations. Having two react-native implementations in node_modules creates some challenges for the metro bundler. The metro issue is being discussed here react-native-community/discussions-and-proposals#182. In lieu of an "official" solution I'm using a workaround involving react-native.config.js and a pair of metro.config.js files for the two react-native implementations. The identical approach was used for the macOS implementation in the react-native-webview repo as recently completed in this PR.

Test Plan:

A native macOS example app was added parallel to the iOS and Android example apps. End to end tests were created and added to the Circle CI PR scripts. The iOS and Android e2e tests were implemented using detox: but detox has no support for macOS, so the macOS tests were implemented as Xcode XCUITests. The same detox JavaScript test logic was ported into XCUITest Object C.

The macOS e2e tests can be executed similarly to the iOS and Android tests:

$ yarn install
$ yarn test:e2e:macos

Or the example app can be opened in Xcode and launched. However, due to the "out-of-tree" platform issues described above, you must manually launch the metro bundler:

$ open example/macos/AsyncStorageExample.xcodeproj  # open the example in xcode
$ yarn start:macos                                  # start metro bundler in react-native-macos mode

async-storage-macos

@tom-un tom-un requested review from krizzu and tido64 February 17, 2020 04:39
docs/Linking.md Outdated Show resolved Hide resolved
example/macos/AsyncStorageExample-macOS/Info.plist Outdated Show resolved Hide resolved
metro.config.macos.js Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
react-native.config.js Outdated Show resolved Hide resolved
tom-un and others added 4 commits February 20, 2020 14:37
Co-Authored-By: Tommy Nguyen <4123478+tido64@users.noreply.github.com>
Co-Authored-By: Tommy Nguyen <4123478+tido64@users.noreply.github.com>
@krizzu
Copy link
Member

krizzu commented Feb 27, 2020

@tom-un Thanks for the great work! I've tested it locally and works great! :) I'll go ahead and merge it.

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.

None yet

3 participants