-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes brunolemos/react-native-web-monorepo#57 Closes brunolemos/react-native-web-monorepo#58 Closes brunolemos/react-native-web-monorepo#49 Closes brunolemos/react-native-web-monorepo#41 Closes brunolemos/react-native-web-monorepo#22
- Loading branch information
1 parent
b490b12
commit 9117bcf
Showing
36 changed files
with
3,260 additions
and
2,757 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ This is the source code from [this tutorial](https://dev.to/brunolemos/tutorial- | |
|
||
### How to run | ||
|
||
_Requirements: [React Native](https://facebook.github.io/react-native/docs/getting-started.html#native) (last tested on react-native@0.61)_ | ||
_Requirements: [React Native](https://reactnative.dev/docs/environment-setup) (last tested on react-native@0.63.x)_ | ||
|
||
- `$ git clone [email protected]:brunolemos/react-native-web-monorepo.git` | ||
- `$ cd react-native-web-monorepo` | ||
|
@@ -29,25 +29,17 @@ _Requirements: [React Native](https://facebook.github.io/react-native/docs/getti | |
- _You may need to launch your device emulator before the next command_ | ||
- `$ yarn android` or `$ yarn ios` | ||
|
||
### Author | ||
|
||
Follow me on Twitter: [@brunolemos](https://twitter.com/brunolemos)<br/> | ||
|
||
<a href="https://twitter.com/brunolemos" target="_blank"><img src="https://github.com/brunolemos.png?size=100" height="100" /></a> | ||
<br/> | ||
|
||
## Who is using this on production | ||
|
||
Check out [DevHub](https://github.com/devhubapp/devhub). | ||
The main difference is that it supports Desktop (Electron) in addition to Web, iOS and Android. | ||
|
||
![DevHub Desktop](https://user-images.githubusercontent.com/619186/63945240-59d40000-ca49-11e9-98c1-353225f8dcf6.jpg) | ||
<br/> | ||
|
||
![DevHub Menubar](https://github.com/devhubapp/devhub/raw/master/landing/static/screenshots/devhub-desktop-menubar-banner.jpg) | ||
### Author | ||
|
||
<p align="center"> | ||
<img alt="DevHub Mobile - Notifications" height="620" src="https://github.com/devhubapp/devhub/raw/master/landing/static/screenshots/iphone-notifications-dark.jpg" /> | ||
<img alt="DevHub Mobile - Notification Filters" height="620" src="https://github.com/devhubapp/devhub/raw/master/landing/static/screenshots/iphone-notifications-filters-dark.jpg" /> | ||
<img alt="DevHub Mobile - Events" height="620" src="https://github.com/devhubapp/devhub/raw/master/landing/static/screenshots/iphone-events-dark.jpg" /> | ||
</p> | ||
Follow me on Twitter: [@brunolemos](https://twitter.com/brunolemos)<br/> | ||
|
||
<br/> | ||
<a href="https://twitter.com/brunolemos" target="_blank"><img src="https://github.com/brunolemos.png?size=100" height="100" /></a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
packages/mobile/android/.settings/org.eclipse.buildship.core.prefs
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
packages/mobile/android/app/src/debug/java/com/myprojectname/ReactNativeFlipper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root | ||
* directory of this source tree. | ||
*/ | ||
package com.myprojectname; | ||
|
||
import android.content.Context; | ||
import com.facebook.flipper.android.AndroidFlipperClient; | ||
import com.facebook.flipper.android.utils.FlipperUtils; | ||
import com.facebook.flipper.core.FlipperClient; | ||
import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin; | ||
import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin; | ||
import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin; | ||
import com.facebook.flipper.plugins.inspector.DescriptorMapping; | ||
import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin; | ||
import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor; | ||
import com.facebook.flipper.plugins.network.NetworkFlipperPlugin; | ||
import com.facebook.flipper.plugins.react.ReactFlipperPlugin; | ||
import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin; | ||
import com.facebook.react.ReactInstanceManager; | ||
import com.facebook.react.bridge.ReactContext; | ||
import com.facebook.react.modules.network.NetworkingModule; | ||
import okhttp3.OkHttpClient; | ||
|
||
public class ReactNativeFlipper { | ||
public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) { | ||
if (FlipperUtils.shouldEnableFlipper(context)) { | ||
final FlipperClient client = AndroidFlipperClient.getInstance(context); | ||
|
||
client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults())); | ||
client.addPlugin(new ReactFlipperPlugin()); | ||
client.addPlugin(new DatabasesFlipperPlugin(context)); | ||
client.addPlugin(new SharedPreferencesFlipperPlugin(context)); | ||
client.addPlugin(CrashReporterPlugin.getInstance()); | ||
|
||
NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin(); | ||
NetworkingModule.setCustomClientBuilder( | ||
new NetworkingModule.CustomClientBuilder() { | ||
@Override | ||
public void apply(OkHttpClient.Builder builder) { | ||
builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin)); | ||
} | ||
}); | ||
client.addPlugin(networkFlipperPlugin); | ||
client.start(); | ||
|
||
// Fresco Plugin needs to ensure that ImagePipelineFactory is initialized | ||
// Hence we run if after all native modules have been initialized | ||
ReactContext reactContext = reactInstanceManager.getCurrentReactContext(); | ||
if (reactContext == null) { | ||
reactInstanceManager.addReactInstanceEventListener( | ||
new ReactInstanceManager.ReactInstanceEventListener() { | ||
@Override | ||
public void onReactContextInitialized(ReactContext reactContext) { | ||
reactInstanceManager.removeReactInstanceEventListener(this); | ||
reactContext.runOnNativeModulesQueueThread( | ||
new Runnable() { | ||
@Override | ||
public void run() { | ||
client.addPlugin(new FrescoFlipperPlugin()); | ||
} | ||
}); | ||
} | ||
}); | ||
} else { | ||
client.addPlugin(new FrescoFlipperPlugin()); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
3 changes: 2 additions & 1 deletion
3
packages/mobile/android/gradle/wrapper/gradle-wrapper.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#Sun Nov 22 00:28:00 BRT 2020 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-all.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip |
Oops, something went wrong.