diff --git a/example/.flowconfig b/example/.flowconfig index f565799e7c3255ec139da685bbf8595c94b51414..1043c82d706e48946b7b9d6586ea198e4e27f05b 100644 --- a/example/.flowconfig +++ b/example/.flowconfig @@ -1,58 +1,70 @@ [ignore] - -# We fork some components by platform. +; We fork some components by platform .*/*[.]android.js -# Ignore templates with `@flow` in header -.*/local-cli/generator.* - -# Ignore malformed json -.*/node_modules/y18n/test/.*\.json - -# Ignore the website subdir -/website/.* - -# Ignore BUCK generated dirs +; Ignore "BUCK" generated dirs /\.buckd/ -# Ignore unexpected extra @providesModule -.*/node_modules/commoner/test/source/widget/share.js +; Ignore unexpected extra "@providesModule" +.*/node_modules/.*/node_modules/fbjs/.* -# Ignore duplicate module providers -# For RN Apps installed via npm, "Libraries" folder is inside node_modules/react-native but in the source repo it is in the root +; Ignore duplicate module providers +; For RN Apps installed via npm, "Libraries" folder is inside +; "node_modules/react-native" but in the source repo it is in the root .*/Libraries/react-native/React.js -.*/Libraries/react-native/ReactNative.js -.*/node_modules/jest-runtime/build/__tests__/.* + +; Ignore polyfills +.*/Libraries/polyfills/.* + +; Ignore metro +.*/node_modules/metro/.* [include] [libs] node_modules/react-native/Libraries/react-native/react-native-interface.js -node_modules/react-native/flow -flow/ +node_modules/react-native/flow/ +node_modules/react-native/flow-github/ [options] -module.system=haste +emoji=true -esproposal.class_static_fields=enable -esproposal.class_instance_fields=enable +esproposal.optional_chaining=enable +esproposal.nullish_coalescing=enable -experimental.strict_type_args=true +module.system=haste +module.system.haste.use_name_reducers=true +# get basename +module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1' +# strip .js or .js.flow suffix +module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1' +# strip .ios suffix +module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1' +module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1' +module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1' +module.system.haste.paths.blacklist=.*/__tests__/.* +module.system.haste.paths.blacklist=.*/__mocks__/.* +module.system.haste.paths.blacklist=/node_modules/react-native/Libraries/Animated/src/polyfills/.* +module.system.haste.paths.whitelist=/node_modules/react-native/Libraries/.* munge_underscores=true -module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub' module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' +module.file_ext=.js +module.file_ext=.jsx +module.file_ext=.json +module.file_ext=.native.js + suppress_type=$FlowIssue suppress_type=$FlowFixMe -suppress_type=$FixMe +suppress_type=$FlowFixMeProps +suppress_type=$FlowFixMeState -suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-2]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) -suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-2]\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ +suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) +suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy - -unsafe.enable_getters_and_setters=true +suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError [version] -^0.32.0 +^0.78.0 diff --git a/example/.gitignore b/example/.gitignore index eb1535e41e3df728de37aa551c2c387f8bbc31e0..5d647565fa9ef7171c321936f78dcb91257b5aa6 100644 --- a/example/.gitignore +++ b/example/.gitignore @@ -22,20 +22,35 @@ DerivedData *.xcuserstate project.xcworkspace -# Android/IJ +# Android/IntelliJ # -*.iml +build/ .idea .gradle local.properties +*.iml # node.js # node_modules/ npm-debug.log +yarn-error.log # BUCK buck-out/ \.buckd/ -android/app/libs -android/keystores/debug.keystore +*.keystore + +# fastlane +# +# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the +# screenshots whenever they are needed. +# For more information about the recommended setup visit: +# https://docs.fastlane.tools/best-practices/source-control/ + +*/fastlane/report.xml +*/fastlane/Preview.html +*/fastlane/screenshots + +# Bundle artifact +*.jsbundle diff --git a/example/android/myapplication/build.gradle b/example/android/myapplication/build.gradle index a0b23bcca1f5d76e0750f1d00264e2391989260a..215a039bd22bcde53266107aa452c56aacfb49fe 100644 --- a/example/android/myapplication/build.gradle +++ b/example/android/myapplication/build.gradle @@ -23,6 +23,17 @@ android { } } +configurations.all { + resolutionStrategy.eachDependency { DependencyResolveDetails details -> + def requested = details.requested + if (requested.group == 'com.android.support') { + if (!requested.name.startsWith("multidex")) { + details.useVersion "26.1.0" + } + } + } +} + dependencies { // compile fileTree(dir: 'libs', include: ['*.jar']) diff --git a/example/android/myapplication/src/main/java/com/wix/reactnativenotifications/app/MainActivity.java b/example/android/myapplication/src/main/java/com/wix/reactnativenotifications/app/MainActivity.java index c40ba6ed9a87d4534e7db954a9743edcff6f5e11..4459a6a3e53913a8578572345b3eadeeb1fde54c 100644 --- a/example/android/myapplication/src/main/java/com/wix/reactnativenotifications/app/MainActivity.java +++ b/example/android/myapplication/src/main/java/com/wix/reactnativenotifications/app/MainActivity.java @@ -1,11 +1,7 @@ package com.wix.reactnativenotifications.app; -import android.annotation.TargetApi; -import android.content.Intent; -import android.net.Uri; import android.os.Build; import android.os.Bundle; -import android.provider.Settings; import android.view.ViewGroup; import android.widget.Toolbar; @@ -16,8 +12,6 @@ import static android.os.Build.VERSION.SDK_INT; public class MainActivity extends ReactActivity { - private static final int OVERLAY_PERMISSION_REQ_CODE = 1234; - private ReactRootView mReactRootView; @Override @@ -27,7 +21,7 @@ public class MainActivity extends ReactActivity { ViewGroup layout; if (SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { layout = (ViewGroup) getLayoutInflater().inflate(R.layout.activity_main, null); - Toolbar toolbar = (Toolbar) layout.findViewById(R.id.toolbar); + Toolbar toolbar = layout.findViewById(R.id.toolbar); setActionBar(toolbar); } else { layout = (ViewGroup) getLayoutInflater().inflate(R.layout.activity_main_prelollipop, null); @@ -37,24 +31,7 @@ public class MainActivity extends ReactActivity { setContentView(layout); - if (SDK_INT >= Build.VERSION_CODES.M && !Settings.canDrawOverlays(this)) { - Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + getPackageName())); - startActivityForResult(intent, OVERLAY_PERMISSION_REQ_CODE); - } else { - startReactApplication(); - } - } - - @TargetApi(Build.VERSION_CODES.M) - @Override - public void onActivityResult(int requestCode, int resultCode, Intent data) { - if (requestCode == OVERLAY_PERMISSION_REQ_CODE) { - if (Settings.canDrawOverlays(this)) { - startReactApplication(); - } else { - finish(); - } - } + startReactApplication(); } private void startReactApplication() { diff --git a/example/index.android.js b/example/index.android.js index 23d9defa0e5bb6fcddeaabfbbf8360f798a3873c..af61676b881910c1ab04d39b61ed1f9c70838da9 100644 --- a/example/index.android.js +++ b/example/index.android.js @@ -32,7 +32,7 @@ function onNotificationReceived(notification) { } // It's highly recommended to keep listeners registration at global scope rather than at screen-scope seeing that -// component mount and unmount lifecycle tend to be asymmetric! +// component mount and unmount lifecycle tends to be asymmetric! NotificationsAndroid.setRegistrationTokenUpdateListener(onPushRegistered); NotificationsAndroid.setNotificationOpenedListener(onNotificationOpened); NotificationsAndroid.setNotificationReceivedListener(onNotificationReceived); diff --git a/example/package.json b/example/package.json index 78fa0e79da212810909aeb3816a1f440f98706db..9997eeed6db4f032c53d906bab5089b4bfc5f64e 100644 --- a/example/package.json +++ b/example/package.json @@ -6,14 +6,8 @@ "start": "node node_modules/react-native/local-cli/cli.js start" }, "dependencies": { - "babel-preset-react-native-stage-0": "^1.0.1", - "react": "16.0.0", - "react-native": "0.51.0", - "react-native-notifications": "../" - }, - "babel": { - "presets": [ - "react-native-stage-0" - ] + "react": "16.6.0-alpha.8af6728", + "react-native": "^0.57.4", + "react-native-notifications": "latest" } }