mirror of
				https://gitcode.com/gh_mirrors/re/react-native-pushy.git
				synced 2025-10-31 21:33:12 +08:00 
			
		
		
		
	fix example
This commit is contained in:
		| @@ -72,8 +72,8 @@ def jscFlavor = 'org.webkit:android-jsc:+' | ||||
|  | ||||
| android { | ||||
|     ndkVersion rootProject.ext.ndkVersion | ||||
|  | ||||
|     compileSdkVersion rootProject.ext.compileSdkVersion | ||||
|     buildToolsVersion rootProject.ext.buildToolsVersion | ||||
|     compileSdk rootProject.ext.compileSdkVersion | ||||
|  | ||||
|     namespace "com.awesomeproject" | ||||
|     defaultConfig { | ||||
|   | ||||
| @@ -2,12 +2,8 @@ | ||||
| <manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     xmlns:tools="http://schemas.android.com/tools"> | ||||
|  | ||||
|     <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/> | ||||
|  | ||||
|     <application | ||||
|         android:usesCleartextTraffic="true" | ||||
|         tools:targetApi="28" | ||||
|         tools:ignore="GoogleAppIndexingWarning"> | ||||
|         <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false" /> | ||||
|     </application> | ||||
|         tools:ignore="GoogleAppIndexingWarning"/> | ||||
| </manifest> | ||||
|   | ||||
| @@ -1,5 +1,4 @@ | ||||
| <manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|   package="com.awesomeproject"> | ||||
| <manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||||
|  | ||||
|     <uses-permission android:name="android.permission.INTERNET" /> | ||||
|     <uses-permission android:name="android.permission.CAMERA" /> | ||||
|   | ||||
| @@ -1,32 +0,0 @@ | ||||
| package com.awesomeproject; | ||||
|  | ||||
| import com.facebook.react.ReactActivity; | ||||
| import com.facebook.react.ReactActivityDelegate; | ||||
| import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint; | ||||
| import com.facebook.react.defaults.DefaultReactActivityDelegate; | ||||
|  | ||||
| public class MainActivity extends ReactActivity { | ||||
|  | ||||
|   /** | ||||
|    * Returns the name of the main component registered from JavaScript. This is used to schedule | ||||
|    * rendering of the component. | ||||
|    */ | ||||
|   @Override | ||||
|   protected String getMainComponentName() { | ||||
|     return "AwesomeProject"; | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * Returns the instance of the {@link ReactActivityDelegate}. Here we use a util class {@link | ||||
|    * DefaultReactActivityDelegate} which allows you to easily enable Fabric and Concurrent React | ||||
|    * (aka React 18) with two boolean flags. | ||||
|    */ | ||||
|   @Override | ||||
|   protected ReactActivityDelegate createReactActivityDelegate() { | ||||
|     return new DefaultReactActivityDelegate( | ||||
|         this, | ||||
|         getMainComponentName(), | ||||
|         // If you opted-in for the New Architecture, we enable the Fabric Renderer. | ||||
|         DefaultNewArchitectureEntryPoint.getFabricEnabled()); | ||||
|   } | ||||
| } | ||||
| @@ -0,0 +1,22 @@ | ||||
| package com.awesomeproject | ||||
|  | ||||
| import com.facebook.react.ReactActivity | ||||
| import com.facebook.react.ReactActivityDelegate | ||||
| import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled | ||||
| import com.facebook.react.defaults.DefaultReactActivityDelegate | ||||
|  | ||||
| class MainActivity : ReactActivity() { | ||||
|  | ||||
|   /** | ||||
|    * Returns the name of the main component registered from JavaScript. This is used to schedule | ||||
|    * rendering of the component. | ||||
|    */ | ||||
|   override fun getMainComponentName(): String = "AwesomeProject" | ||||
|  | ||||
|   /** | ||||
|    * Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate] | ||||
|    * which allows you to enable New Architecture with a single boolean flags [fabricEnabled] | ||||
|    */ | ||||
|   override fun createReactActivityDelegate(): ReactActivityDelegate = | ||||
|       DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled) | ||||
| } | ||||
| @@ -1,69 +0,0 @@ | ||||
| package com.awesomeproject; | ||||
|  | ||||
| import android.app.Application; | ||||
| import com.facebook.react.PackageList; | ||||
| import com.facebook.react.ReactApplication; | ||||
| import com.facebook.react.ReactNativeHost; | ||||
| import com.facebook.react.ReactPackage; | ||||
| import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint; | ||||
| import com.facebook.react.defaults.DefaultReactNativeHost; | ||||
| import com.facebook.soloader.SoLoader; | ||||
| import java.util.List; | ||||
| import cn.reactnative.modules.update.UpdateContext; | ||||
|  | ||||
| public class MainApplication extends Application implements ReactApplication { | ||||
|  | ||||
|   private final ReactNativeHost mReactNativeHost = | ||||
|       new DefaultReactNativeHost(this) { | ||||
|           @Override | ||||
|           public boolean getUseDeveloperSupport() { | ||||
|               return BuildConfig.DEBUG; | ||||
|           } | ||||
|  | ||||
|           @Override | ||||
|           protected String getJSBundleFile() { | ||||
|               return UpdateContext.getBundleUrl(MainApplication.this); | ||||
|           } | ||||
|  | ||||
|           @Override | ||||
|           protected List<ReactPackage> getPackages() { | ||||
|               @SuppressWarnings("UnnecessaryLocalVariable") | ||||
|               List<ReactPackage> packages = new PackageList(this).getPackages(); | ||||
|               // Packages that cannot be autolinked yet can be added manually here, for example: | ||||
|               // packages.add(new MyReactNativePackage()); | ||||
|               return packages; | ||||
|           } | ||||
|  | ||||
|           @Override | ||||
|           protected boolean isNewArchEnabled() { | ||||
|               return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED; | ||||
|           } | ||||
|  | ||||
|           @Override | ||||
|           protected Boolean isHermesEnabled() { | ||||
|               return BuildConfig.IS_HERMES_ENABLED; | ||||
|           } | ||||
|  | ||||
|  | ||||
|           @Override | ||||
|           protected String getJSMainModuleName() { | ||||
|               return "index"; | ||||
|           } | ||||
|       }; | ||||
|  | ||||
|  | ||||
|   @Override | ||||
|   public ReactNativeHost getReactNativeHost() { | ||||
|     return mReactNativeHost; | ||||
|   } | ||||
|  | ||||
|   @Override | ||||
|   public void onCreate() { | ||||
|     super.onCreate(); | ||||
|     SoLoader.init(this, /* native exopackage */ false); | ||||
|     if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { | ||||
|       // If you opted-in for the New Architecture, we load the native entry point for this app. | ||||
|       DefaultNewArchitectureEntryPoint.load(); | ||||
|     } | ||||
|   } | ||||
| } | ||||
| @@ -0,0 +1,48 @@ | ||||
| package com.awesomeproject | ||||
|  | ||||
| import android.app.Application | ||||
| import cn.reactnative.modules.update.UpdateContext | ||||
| import com.facebook.react.PackageList | ||||
| import com.facebook.react.ReactApplication | ||||
| import com.facebook.react.ReactHost | ||||
| import com.facebook.react.ReactNativeHost | ||||
| import com.facebook.react.ReactPackage | ||||
| import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load | ||||
| import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost | ||||
| import com.facebook.react.defaults.DefaultReactNativeHost | ||||
| import com.facebook.react.soloader.OpenSourceMergedSoMapping | ||||
| import com.facebook.soloader.SoLoader | ||||
|  | ||||
| class MainApplication : Application(), ReactApplication { | ||||
|  | ||||
|   override val reactNativeHost: ReactNativeHost = | ||||
|       object : DefaultReactNativeHost(this) { | ||||
|            | ||||
|         override fun getJSBundleFile(): String? = UpdateContext.getBundleUrl(this@MainApplication) | ||||
|  | ||||
|         override fun getPackages(): List<ReactPackage> = | ||||
|             PackageList(this).packages.apply { | ||||
|               // Packages that cannot be autolinked yet can be added manually here, for example: | ||||
|               // add(MyReactNativePackage()) | ||||
|             } | ||||
|  | ||||
|         override fun getJSMainModuleName(): String = "index" | ||||
|  | ||||
|         override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG | ||||
|  | ||||
|         override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED | ||||
|         override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED | ||||
|       } | ||||
|  | ||||
|   override val reactHost: ReactHost | ||||
|     get() = getDefaultReactHost(applicationContext, reactNativeHost) | ||||
|  | ||||
|   override fun onCreate() { | ||||
|     super.onCreate() | ||||
|     SoLoader.init(this, OpenSourceMergedSoMapping) | ||||
|     if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { | ||||
|       // If you opted-in for the New Architecture, we load the native entry point for this app. | ||||
|       load() | ||||
|     } | ||||
|   } | ||||
| } | ||||
| @@ -1,6 +1,7 @@ | ||||
| distributionBase=GRADLE_USER_HOME | ||||
| distributionPath=wrapper/dists | ||||
| distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip | ||||
| distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip | ||||
| networkTimeout=10000 | ||||
| validateDistributionUrl=true | ||||
| zipStoreBase=GRADLE_USER_HOME | ||||
| zipStorePath=wrapper/dists | ||||
|   | ||||
| @@ -2,6 +2,5 @@ pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") } | ||||
| plugins { id("com.facebook.react.settings") } | ||||
| extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() } | ||||
| rootProject.name = 'AwesomeProject' | ||||
| apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) | ||||
| include ':app' | ||||
| includeBuild('../node_modules/@react-native/gradle-plugin') | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 sunnylqm
					sunnylqm