packages = new PackageList(this).getPackages();
27 | // Packages that cannot be autolinked yet can be added manually here, for example:
28 | // packages.add(new MyReactNativePackage());
29 | return packages;
30 | }
31 |
32 | @Override
33 | protected String getJSMainModuleName() {
34 | return "index";
35 | }
36 | };
37 |
38 | @Override
39 | public ReactNativeHost getReactNativeHost() {
40 | return mReactNativeHost;
41 | }
42 |
43 | @Override
44 | public void onCreate() {
45 | super.onCreate();
46 | SoLoader.init(this, /* native exopackage */ false);
47 | initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
48 | }
49 |
50 | /**
51 | * Loads Flipper in React Native templates. Call this in the onCreate method with something like
52 | * initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
53 | *
54 | * @param context
55 | * @param reactInstanceManager
56 | */
57 | private static void initializeFlipper(
58 | Context context, ReactInstanceManager reactInstanceManager) {
59 | if (BuildConfig.DEBUG) {
60 | try {
61 | /*
62 | We use reflection here to pick up the class that initializes Flipper,
63 | since Flipper library is not available in release mode
64 | */
65 | Class> aClass = Class.forName("com.reactnativeuniversalproject.ReactNativeFlipper");
66 | aClass
67 | .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
68 | .invoke(null, context, reactInstanceManager);
69 | } catch (ClassNotFoundException e) {
70 | e.printStackTrace();
71 | } catch (NoSuchMethodException e) {
72 | e.printStackTrace();
73 | } catch (IllegalAccessException e) {
74 | e.printStackTrace();
75 | } catch (InvocationTargetException e) {
76 | e.printStackTrace();
77 | }
78 | }
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/packages/mobile/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-native-universal-project",
3 | "version": "0.0.1",
4 | "private": true,
5 | "workspaces": {
6 | "packages": [
7 | "packages/*"
8 | ],
9 | "nohoist": [
10 | "**/@react-native-async-storage/async-storage",
11 | "**/react",
12 | "**/react-dom",
13 | "**/react-native",
14 | "**/react-native/**",
15 | "**/react-native-codegen",
16 | "**/react-native-dev-menu",
17 | "**/react-native-macos",
18 | "**/react-native-windows"
19 | ]
20 | },
21 | "scripts": {
22 | "reset": "find . -type dir -name node_modules | xargs rm -rf && rm -rf yarn.lock",
23 | "android:metro": "yarn workspace @my-app/mobile start",
24 | "android:start": "yarn workspace @my-app/mobile android",
25 | "android:studio": "yarn workspace @my-app/mobile studio",
26 | "ios:metro": "yarn workspace @my-app/mobile start",
27 | "ios:start": "yarn workspace @my-app/mobile ios",
28 | "ios:xcode": "yarn workspace @my-app/mobile xcode",
29 | "ios:pods": "yarn workspace @my-app/mobile pods",
30 | "tv:android:metro": "yarn workspace @my-app/tv start",
31 | "tv:android:start": "yarn workspace @my-app/tv android",
32 | "tv:android:studio": "yarn workspace @my-app/tv studio",
33 | "tv:tvos:metro": "yarn workspace @my-app/tv start",
34 | "tv:tvos:start": "yarn workspace @my-app/tv ios",
35 | "tv:tvos:xcode": "yarn workspace @my-app/tv xcode",
36 | "tv:tvos:pods": "yarn workspace @my-app/tv pods",
37 | "macos:metro": "yarn workspace @my-app/macos start",
38 | "macos:start": "yarn workspace @my-app/macos macos",
39 | "macos:xcode": "yarn workspace @my-app/macos xcode",
40 | "macos:pods": "yarn workspace @my-app/macos pods",
41 | "web:start": "yarn workspace @my-app/web start",
42 | "web:build": "yarn workspace @my-app/web build",
43 | "next:start": "yarn workspace @my-app/next dev",
44 | "next:build": "yarn workspace @my-app/next build",
45 | "next:serve": "yarn workspace @my-app/next start",
46 | "electron:start": "yarn workspace @my-app/electron start",
47 | "electron:package:mac": "yarn workspace @my-app/electron package:mac",
48 | "electron:package:win": "yarn workspace @my-app/electron package:win",
49 | "electron:package:linux": "yarn workspace @my-app/electron package:linux",
50 | "browser-ext:start": "yarn workspace @my-app/browser-ext start",
51 | "browser-ext:build": "yarn workspace @my-app/browser-ext build",
52 | "windows:metro": "yarn workspace @my-app/windows start",
53 | "windows:start": "yarn workspace @my-app/windows windows",
54 | "lint": "ultra -r lint",
55 | "lint:fix": "ultra -r lint:fix",
56 | "test": "ultra -r test",
57 | "typecheck": "ultra -r typecheck"
58 | },
59 | "devDependencies": {
60 | "@typescript-eslint/eslint-plugin": "^4.29.3",
61 | "@typescript-eslint/parser": "^4.29.3",
62 | "eslint": "^7.32.0",
63 | "eslint-config-prettier": "^8.3.0",
64 | "eslint-plugin-react-app": "^6.2.2",
65 | "eslint-plugin-react-native": "^3.11.0",
66 | "prettier": "^2.3.2",
67 | "typescript": "^4.4.2",
68 | "ultra-runner": "^3.10.5"
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/packages/macos/macos/reactnativeuniversalproject.xcodeproj/xcshareddata/xcschemes/reactnativeuniversalproject-iOS.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
43 |
45 |
51 |
52 |
53 |
54 |
60 |
62 |
68 |
69 |
70 |
71 |
73 |
74 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/packages/macos/macos/reactnativeuniversalproject.xcodeproj/xcshareddata/xcschemes/reactnativeuniversalproject-macOS.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
43 |
45 |
51 |
52 |
53 |
54 |
60 |
62 |
68 |
69 |
70 |
71 |
73 |
74 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/packages/electron/public/electron.js:
--------------------------------------------------------------------------------
1 | // Module to control the application lifecycle and the native browser window.
2 | const { app, BrowserWindow, protocol } = require("electron");
3 | const path = require("path");
4 | const url = require("url");
5 |
6 | // Create the native browser window.
7 | function createWindow() {
8 | const mainWindow = new BrowserWindow({
9 | width: 800,
10 | height: 600,
11 | // Set the path of an additional "preload" script that can be used to
12 | // communicate between node-land and browser-land.
13 | webPreferences: {
14 | preload: path.join(__dirname, "preload.js"),
15 | },
16 | });
17 |
18 | // In production, set the initial browser path to the local bundle generated
19 | // by the Create React App build process.
20 | // In development, set it to localhost to allow live/hot-reloading.
21 | const appURL = app.isPackaged
22 | ? url.format({
23 | pathname: path.join(__dirname, "index.html"),
24 | protocol: "file:",
25 | slashes: true,
26 | })
27 | : "http://localhost:3000";
28 | mainWindow.loadURL(appURL);
29 |
30 | // Automatically open Chrome's DevTools in development mode.
31 | if (!app.isPackaged) {
32 | mainWindow.webContents.openDevTools();
33 | }
34 | }
35 |
36 | // Setup a local proxy to adjust the paths of requested files when loading
37 | // them from the local production bundle (e.g.: local fonts, etc...).
38 | function setupLocalFilesNormalizerProxy() {
39 | protocol.registerHttpProtocol(
40 | "file",
41 | (request, callback) => {
42 | const url = request.url.substr(8);
43 | callback({ path: path.normalize(`${__dirname}/${url}`) });
44 | },
45 | (error) => {
46 | if (error) console.error("Failed to register protocol");
47 | }
48 | );
49 | }
50 |
51 | // This method will be called when Electron has finished its initialization and
52 | // is ready to create the browser windows.
53 | // Some APIs can only be used after this event occurs.
54 | app.whenReady().then(() => {
55 | createWindow();
56 | setupLocalFilesNormalizerProxy();
57 |
58 | app.on("activate", function () {
59 | // On macOS it's common to re-create a window in the app when the
60 | // dock icon is clicked and there are no other windows open.
61 | if (BrowserWindow.getAllWindows().length === 0) {
62 | createWindow();
63 | }
64 | });
65 | });
66 |
67 | // Quit when all windows are closed, except on macOS.
68 | // There, it's common for applications and their menu bar to stay active until
69 | // the user quits explicitly with Cmd + Q.
70 | app.on("window-all-closed", function () {
71 | if (process.platform !== "darwin") {
72 | app.quit();
73 | }
74 | });
75 |
76 | // If your app has no need to navigate or only needs to navigate to known pages,
77 | // it is a good idea to limit navigation outright to that known scope,
78 | // disallowing any other kinds of navigation.
79 | const allowedNavigationDestinations = "https://my-electron-app.com";
80 | app.on("web-contents-created", (event, contents) => {
81 | contents.on("will-navigate", (event, navigationUrl) => {
82 | const parsedUrl = new URL(navigationUrl);
83 |
84 | if (!allowedNavigationDestinations.includes(parsedUrl.origin)) {
85 | event.preventDefault();
86 | }
87 | });
88 | });
89 |
90 | // In this file you can include the rest of your app's specific main process
91 | // code. You can also put them in separate files and require them here.
--------------------------------------------------------------------------------
/packages/tv/android/app/src/debug/java/com/tv/ReactNativeFlipper.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Facebook, Inc. and its affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the LICENSE file in the root
5 | * directory of this source tree.
6 | */
7 | package com.tv;
8 |
9 | import android.content.Context;
10 | import com.facebook.flipper.android.AndroidFlipperClient;
11 | import com.facebook.flipper.android.utils.FlipperUtils;
12 | import com.facebook.flipper.core.FlipperClient;
13 | import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin;
14 | import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin;
15 | import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin;
16 | import com.facebook.flipper.plugins.inspector.DescriptorMapping;
17 | import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin;
18 | import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor;
19 | import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;
20 | import com.facebook.flipper.plugins.react.ReactFlipperPlugin;
21 | import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
22 | import com.facebook.react.ReactInstanceManager;
23 | import com.facebook.react.bridge.ReactContext;
24 | import com.facebook.react.modules.network.NetworkingModule;
25 | import okhttp3.OkHttpClient;
26 |
27 | public class ReactNativeFlipper {
28 | public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
29 | if (FlipperUtils.shouldEnableFlipper(context)) {
30 | final FlipperClient client = AndroidFlipperClient.getInstance(context);
31 |
32 | client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));
33 | client.addPlugin(new ReactFlipperPlugin());
34 | client.addPlugin(new DatabasesFlipperPlugin(context));
35 | client.addPlugin(new SharedPreferencesFlipperPlugin(context));
36 | client.addPlugin(CrashReporterPlugin.getInstance());
37 |
38 | NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
39 | NetworkingModule.setCustomClientBuilder(
40 | new NetworkingModule.CustomClientBuilder() {
41 | @Override
42 | public void apply(OkHttpClient.Builder builder) {
43 | builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin));
44 | }
45 | });
46 | client.addPlugin(networkFlipperPlugin);
47 | client.start();
48 |
49 | // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized
50 | // Hence we run if after all native modules have been initialized
51 | ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
52 | if (reactContext == null) {
53 | reactInstanceManager.addReactInstanceEventListener(
54 | new ReactInstanceManager.ReactInstanceEventListener() {
55 | @Override
56 | public void onReactContextInitialized(ReactContext reactContext) {
57 | reactInstanceManager.removeReactInstanceEventListener(this);
58 | reactContext.runOnNativeModulesQueueThread(
59 | new Runnable() {
60 | @Override
61 | public void run() {
62 | client.addPlugin(new FrescoFlipperPlugin());
63 | }
64 | });
65 | }
66 | });
67 | } else {
68 | client.addPlugin(new FrescoFlipperPlugin());
69 | }
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/packages/tv/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto init
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto init
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :init
68 | @rem Get command-line arguments, handling Windows variants
69 |
70 | if not "%OS%" == "Windows_NT" goto win9xME_args
71 |
72 | :win9xME_args
73 | @rem Slurp the command line arguments.
74 | set CMD_LINE_ARGS=
75 | set _SKIP=2
76 |
77 | :win9xME_args_slurp
78 | if "x%~1" == "x" goto execute
79 |
80 | set CMD_LINE_ARGS=%*
81 |
82 | :execute
83 | @rem Setup the command line
84 |
85 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
86 |
87 | @rem Execute Gradle
88 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
89 |
90 | :end
91 | @rem End local scope for the variables with windows NT shell
92 | if "%ERRORLEVEL%"=="0" goto mainEnd
93 |
94 | :fail
95 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
96 | rem the _cmd.exe /c_ return code!
97 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
98 | exit /b 1
99 |
100 | :mainEnd
101 | if "%OS%"=="Windows_NT" endlocal
102 |
103 | :omega
104 |
--------------------------------------------------------------------------------
/packages/tv/ios/tv.xcodeproj/xcshareddata/xcschemes/tv.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
53 |
55 |
61 |
62 |
63 |
64 |
70 |
72 |
78 |
79 |
80 |
81 |
83 |
84 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/packages/mobile/android/app/src/debug/java/com/reactnativeuniversalproject/ReactNativeFlipper.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Facebook, Inc. and its affiliates.
3 | *
4 | *
This source code is licensed under the MIT license found in the LICENSE file in the root
5 | * directory of this source tree.
6 | */
7 | package com.reactnativeuniversalproject;
8 |
9 | import android.content.Context;
10 | import com.facebook.flipper.android.AndroidFlipperClient;
11 | import com.facebook.flipper.android.utils.FlipperUtils;
12 | import com.facebook.flipper.core.FlipperClient;
13 | import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin;
14 | import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin;
15 | import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin;
16 | import com.facebook.flipper.plugins.inspector.DescriptorMapping;
17 | import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin;
18 | import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor;
19 | import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;
20 | import com.facebook.flipper.plugins.react.ReactFlipperPlugin;
21 | import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
22 | import com.facebook.react.ReactInstanceManager;
23 | import com.facebook.react.bridge.ReactContext;
24 | import com.facebook.react.modules.network.NetworkingModule;
25 | import okhttp3.OkHttpClient;
26 |
27 | public class ReactNativeFlipper {
28 | public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
29 | if (FlipperUtils.shouldEnableFlipper(context)) {
30 | final FlipperClient client = AndroidFlipperClient.getInstance(context);
31 |
32 | client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));
33 | client.addPlugin(new ReactFlipperPlugin());
34 | client.addPlugin(new DatabasesFlipperPlugin(context));
35 | client.addPlugin(new SharedPreferencesFlipperPlugin(context));
36 | client.addPlugin(CrashReporterPlugin.getInstance());
37 |
38 | NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
39 | NetworkingModule.setCustomClientBuilder(
40 | new NetworkingModule.CustomClientBuilder() {
41 | @Override
42 | public void apply(OkHttpClient.Builder builder) {
43 | builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin));
44 | }
45 | });
46 | client.addPlugin(networkFlipperPlugin);
47 | client.start();
48 |
49 | // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized
50 | // Hence we run if after all native modules have been initialized
51 | ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
52 | if (reactContext == null) {
53 | reactInstanceManager.addReactInstanceEventListener(
54 | new ReactInstanceManager.ReactInstanceEventListener() {
55 | @Override
56 | public void onReactContextInitialized(ReactContext reactContext) {
57 | reactInstanceManager.removeReactInstanceEventListener(this);
58 | reactContext.runOnNativeModulesQueueThread(
59 | new Runnable() {
60 | @Override
61 | public void run() {
62 | client.addPlugin(new FrescoFlipperPlugin());
63 | }
64 | });
65 | }
66 | });
67 | } else {
68 | client.addPlugin(new FrescoFlipperPlugin());
69 | }
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/packages/tv/ios/tv.xcodeproj/xcshareddata/xcschemes/tv-tvOS.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
53 |
55 |
61 |
62 |
63 |
64 |
70 |
72 |
78 |
79 |
80 |
81 |
83 |
84 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/packages/windows/windows/ReactNativeUniversalProject/App.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
3 | #include "App.h"
4 |
5 | #include "AutolinkedNativeModules.g.h"
6 | #include "ReactPackageProvider.h"
7 |
8 | using namespace winrt;
9 | using namespace xaml;
10 | using namespace xaml::Controls;
11 | using namespace xaml::Navigation;
12 |
13 | using namespace Windows::ApplicationModel;
14 | namespace winrt::ReactNativeUniversalProject::implementation
15 | {
16 | ///
17 | /// Initializes the singleton application object. This is the first line of
18 | /// authored code executed, and as such is the logical equivalent of main() or
19 | /// WinMain().
20 | ///
21 | App::App() noexcept
22 | {
23 | #if BUNDLE
24 | JavaScriptBundleFile(L"index.windows");
25 | InstanceSettings().UseWebDebugger(false);
26 | InstanceSettings().UseFastRefresh(false);
27 | #else
28 | JavaScriptBundleFile(L"index");
29 | InstanceSettings().UseWebDebugger(true);
30 | InstanceSettings().UseFastRefresh(true);
31 | #endif
32 |
33 | #if _DEBUG
34 | InstanceSettings().UseDeveloperSupport(true);
35 | #else
36 | InstanceSettings().UseDeveloperSupport(false);
37 | #endif
38 |
39 | RegisterAutolinkedNativeModulePackages(PackageProviders()); // Includes any autolinked modules
40 |
41 | PackageProviders().Append(make()); // Includes all modules in this project
42 |
43 | InitializeComponent();
44 | }
45 |
46 | ///
47 | /// Invoked when the application is launched normally by the end user. Other entry points
48 | /// will be used such as when the application is launched to open a specific file.
49 | ///
50 | /// Details about the launch request and process.
51 | void App::OnLaunched(activation::LaunchActivatedEventArgs const& e)
52 | {
53 | super::OnLaunched(e);
54 |
55 | Frame rootFrame = Window::Current().Content().as();
56 | rootFrame.Navigate(xaml_typename(), box_value(e.Arguments()));
57 | }
58 |
59 | ///
60 | /// Invoked when the application is activated by some means other than normal launching.
61 | ///
62 | void App::OnActivated(Activation::IActivatedEventArgs const &e) {
63 | auto preActivationContent = Window::Current().Content();
64 | super::OnActivated(e);
65 | if (!preActivationContent && Window::Current()) {
66 | Frame rootFrame = Window::Current().Content().as();
67 | rootFrame.Navigate(xaml_typename(), nullptr);
68 | }
69 | }
70 |
71 | ///
72 | /// Invoked when application execution is being suspended. Application state is saved
73 | /// without knowing whether the application will be terminated or resumed with the contents
74 | /// of memory still intact.
75 | ///
76 | /// The source of the suspend request.
77 | /// Details about the suspend request.
78 | void App::OnSuspending([[maybe_unused]] IInspectable const& sender, [[maybe_unused]] SuspendingEventArgs const& e)
79 | {
80 | // Save application state and stop any background activity
81 | }
82 |
83 | ///
84 | /// Invoked when Navigation to a certain page fails
85 | ///
86 | /// The Frame which failed navigation
87 | /// Details about the navigation failure
88 | void App::OnNavigationFailed(IInspectable const&, NavigationFailedEventArgs const& e)
89 | {
90 | throw hresult_error(E_FAIL, hstring(L"Failed to load Page ") + e.SourcePageType().Name);
91 | }
92 |
93 | } // namespace winrt::ReactNativeUniversalProject::implementation
94 |
--------------------------------------------------------------------------------
/packages/macos/macos/reactnativeuniversalproject-iOS/Base.lproj/LaunchScreen.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
21 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/packages/mobile/ios/ReactNativeUniversalProject.xcodeproj/xcshareddata/xcschemes/ReactNativeUniversalProject.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
53 |
55 |
61 |
62 |
63 |
64 |
70 |
72 |
78 |
79 |
80 |
81 |
83 |
84 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/packages/mobile/ios/ReactNativeUniversalProject/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
24 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/packages/tv/ios/tv/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
25 |
31 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------