-
Notifications
You must be signed in to change notification settings - Fork 524
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #564 from jemise111/update-example-64-2
Update example to rn 0.64.2
- Loading branch information
Showing
40 changed files
with
4,530 additions
and
4,704 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Windows files | ||
[*.bat] | ||
end_of_line = crlf |
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,4 @@ | ||
module.exports = { | ||
root: true, | ||
extends: '@react-native-community', | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
*.pbxproj -text | ||
# Windows files should use crlf line endings | ||
# https://help.github.com/articles/dealing-with-line-endings/ | ||
*.bat text eol=crlf |
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
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
Binary file not shown.
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
SwipeListExample/android/app/src/debug/java/com/swipelistexample/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.swipelistexample; | ||
|
||
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
Oops, something went wrong.