首页 > 解决方案 > 如何在 IOS(React Native)中进行两个类似 android 的活动?

问题描述

我想制作一个应用程序,该应用程序将在 IOS(React Native)中具有两个具有不同应用程序启动图标的活动。

我在 Android 上做了这个。代码如下。

      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:windowSoftInputMode="adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>

      <activity
        android:name=".NotifierActivity"
        android:label="SOS"
        android:icon="@mipmap/ic_launcher_sos"
        android:roundIcon="@mipmap/ic_launcher_sos_round"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:windowSoftInputMode="adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>

我是初学者。所以,我非常需要你的帮助。

标签: iosreact-native

解决方案


mainfest 的一个示例,如果您正在寻求更多帮助,请告诉我。您需要在 app/AndroidManifest.xml 中添加它

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.xxx">

        <uses-permission android:name="android.permission.INTERNET" />
        <uses-permission android:name="android.permission.CAMERA" />
        <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
        <application
            android:name=".MainApplication"
            android:label="@string/app_name"
            android:icon="@mipmap/ic_launcher"
            android:allowBackup="false"
            android:theme="@style/AppTheme"
            android:hardwareAccelerated="true"
            android:largeHeap="true"
            android:usesCleartextTraffic="true"
            >
        <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:windowSoftInputMode="adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>

      <activity
        android:name=".NotifierActivity"
        android:label="SOS"
        android:icon="@mipmap/ic_launcher_sos"
        android:roundIcon="@mipmap/ic_launcher_sos_round"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:windowSoftInputMode="adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>
</application>
</manifest>

推荐阅读