diff --git a/packages/app-harness/renative.json b/packages/app-harness/renative.json
index f33aa02f5..943eaee53 100644
--- a/packages/app-harness/renative.json
+++ b/packages/app-harness/renative.json
@@ -259,9 +259,6 @@
}
},
"react-native-google-cast": {
- "ios": {
- "disabled": true
- },
"androidwear": {
"disabled": true
},
diff --git a/packages/app-harness/src/components/CastButton/index.android.mobile.tsx b/packages/app-harness/src/components/CastButton/index.android.mobile.tsx
deleted file mode 100644
index f2632e181..000000000
--- a/packages/app-harness/src/components/CastButton/index.android.mobile.tsx
+++ /dev/null
@@ -1,25 +0,0 @@
-import React, { useEffect } from 'react';
-import { CastButton, useRemoteMediaClient } from 'react-native-google-cast';
-import { testProps } from '../../config';
-
-export function CastComponent() {
- const client = useRemoteMediaClient();
-
- useEffect(() => {
- if (client) {
- client.loadMedia({
- mediaInfo: {
- contentUrl:
- 'https://commondatastorage.googleapis.com/gtv-videos-bucket/CastVideos/mp4/BigBuckBunny.mp4',
- },
- });
- }
- }, [client]);
-
- return (
-
- );
-}
diff --git a/packages/app-harness/src/components/CastButton/index.mobile.tsx b/packages/app-harness/src/components/CastButton/index.mobile.tsx
new file mode 100644
index 000000000..b905eb11d
--- /dev/null
+++ b/packages/app-harness/src/components/CastButton/index.mobile.tsx
@@ -0,0 +1,36 @@
+import { Button, View } from 'react-native';
+import { CastButton, CastContext } from 'react-native-google-cast';
+import { testProps } from '../../config';
+import { useLoggerContext } from '../../context';
+
+export function CastComponent() {
+ const { logDebug } = useLoggerContext();
+ return (
+
+
+
+ );
+}
diff --git a/packages/app-harness/test/specs/e2e.cjs b/packages/app-harness/test/specs/e2e.cjs
index 490440f06..10ff72b0e 100644
--- a/packages/app-harness/test/specs/e2e.cjs
+++ b/packages/app-harness/test/specs/e2e.cjs
@@ -72,8 +72,11 @@ describe('Test App Harness', () => {
await FlexnRunner.expectToBeDisplayedByText('Cast to');
await FlexnRunner.waitForDisplayedByText('OK');
await FlexnRunner.expectToBeDisplayedByText('OK');
+ } else if (process.env.PLATFORM === 'ios') {
+ await FlexnRunner.clickById('app-harness-home-cast-support-button');
+ await FlexnRunner.expectToBeDisplayedByText('Cast to');
} else {
await FlexnRunner.expectToHaveTextById('app-harness-home-cast-support-text', 'Not supported');
- }
+ }
});
});
diff --git a/packages/config-templates/renative.templates.json b/packages/config-templates/renative.templates.json
index 91f2237e8..bf298e464 100644
--- a/packages/config-templates/renative.templates.json
+++ b/packages/config-templates/renative.templates.json
@@ -2599,39 +2599,23 @@
},
"ios": {
"templateXcode": {
- "appDelegateImports": [
- "GoogleCast"
- ],
"AppDelegate_mm": {
- "appDelegateImports": [
- "GoogleCast/GoogleCast.h"
- ],
+ "appDelegateImports": ["GoogleCast/GoogleCast.h"],
"appDelegateMethods": {
"application": {
"didFinishLaunchingWithOptions": [
"NSString *receiverAppID = kGCKDefaultMediaReceiverApplicationID; // or @\"ABCD1234\"",
- "GCKDiscoveryCriteria *criteria = [[GCKDiscoveryCriteria alloc] initWithApplicationID:receiverAppID];",
- "GCKCastOptions* options = [[GCKCastOptions alloc] initWithDiscoveryCriteria:criteria];",
- "[GCKCastContext setSharedInstanceWithOptions:options];"
+ "GCKDiscoveryCriteria *criteria = [[GCKDiscoveryCriteria alloc] initWithApplicationID:receiverAppID]",
+ "GCKCastOptions* options = [[GCKCastOptions alloc] initWithDiscoveryCriteria:criteria]",
+ "options.disableDiscoveryAutostart = {{props.DISABLE_DISCOVERY_AUTOSTART}}",
+ "options.startDiscoveryAfterFirstTapOnCastButton = {{props.START_DISCOVERY_AFTER_FIRST_TAP_ON_CAST_BUTTON}}",
+ "[GCKCastContext setSharedInstanceWithOptions:options]"
]
}
}
},
- "appDelegateMethods": {
- "application": {
- "didFinishLaunchingWithOptions": [
- "let receiverAppID = \"{{props.APPLICATION_ID}}\" // or \"ABCD1234\"",
- "let criteria = GCKDiscoveryCriteria(applicationID: receiverAppID)",
- "let options = GCKCastOptions(discoveryCriteria: criteria)",
- "GCKCastContext.setSharedInstanceWith(options)"
- ]
- }
- },
"Info_plist": {
- "NSBonjourServices": [
- "_googlecast._tcp",
- "_CC1AD845._googlecast._tcp"
- ],
+ "NSBonjourServices": ["_googlecast._tcp", "_CC1AD845._googlecast._tcp"],
"NSLocalNetworkUsageDescription": "${PRODUCT_NAME} uses the local network to discover Cast-enabled devices on your WiFi network."
}
},
@@ -2640,7 +2624,9 @@
"podName": "react-native-google-cast/NoBluetoothArm"
},
"props": {
- "APPLICATION_ID": "01234"
+ "APPLICATION_ID": "01234",
+ "DISABLE_DISCOVERY_AUTOSTART": "false",
+ "START_DISCOVERY_AFTER_FIRST_TAP_ON_CAST_BUTTON": "false"
},
"version": "4.8.0"
},