Skip to content

Commit 6e9697b

Browse files
authored
v0.4.0 - Expo 52 React Native 0.76 Support
* package upgrades * Lockfile update * App clip podfile insertion fix * README warning update * cleanup * Adding expo modules autolinking * Incrementing version * Bumping deployment target
1 parent eb1770a commit 6e9697b

File tree

7 files changed

+43
-39
lines changed

7 files changed

+43
-39
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# react-native-app-clip
22

33
> **Warning**
4-
> Starting with version 0.3.0, react-native-app-clip requires **Expo SDK 51** and **React Native 0.74**.
4+
> Starting with version 0.4.0, react-native-app-clip requires **Expo SDK 52** and **React Native 0.76**. Downgrade to 0.3.1 if you wish to use **Expo SDK 51** and **React Native 0.74**.
55
66
Expo Config Plugin that generates an App Clip for iOS apps built with Expo.
77

bun.lockb

-19.5 KB
Binary file not shown.

example/app.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"bundleIdSuffix": "Clip",
2424
"targetSuffix": "Clip",
2525
"groupIdentifier": "example.clipper",
26-
"deploymentTarget": "14.2",
26+
"deploymentTarget": "15.1",
2727
"requestEphemeralUserNotification": true,
2828
"requestLocationConfirmation": true,
2929
"appleSignin": true,

package.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-app-clip",
3-
"version": "0.3.1",
3+
"version": "0.4.0",
44
"description": "Config plugin to add an App Clip to a React Native iOS app",
55
"main": "build/index.js",
66
"types": "build/index.d.ts",
@@ -38,13 +38,12 @@
3838
"license": "MIT",
3939
"homepage": "https://github.com/bndkt/react-native-app-clip#readme",
4040
"dependencies": {
41-
"@expo/config-plugins": "8.0.8",
42-
"@expo/plist": "0.1.3"
41+
"@expo/config-plugins": "~9.0.0",
42+
"@expo/plist": "~0.2.0"
4343
},
4444
"devDependencies": {
45-
"@types/react": "18.2.79",
46-
"expo-module-scripts": "3.5.2",
47-
"expo-modules-core": "1.12.24"
45+
"expo-module-scripts": "^4.0.0",
46+
"expo-modules-core": "^2.0.0"
4847
},
4948
"peerDependencies": {
5049
"expo": "*",

plugin/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const withAppClip: ConfigPlugin<{
3535
name ??= "Clip";
3636
bundleIdSuffix ??= "Clip";
3737
targetSuffix ??= "Clip";
38-
deploymentTarget ??= "14.0";
38+
deploymentTarget ??= "15.1";
3939
appleSignin ??= false;
4040

4141
if (!config.ios?.bundleIdentifier) {

plugin/src/withPodfile.ts

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { mergeContents } from "@expo/config-plugins/build/utils/generateCode";
21
import { type ConfigPlugin, withDangerousMod } from "expo/config-plugins";
32
import fs from "node:fs";
43
import path from "node:path";
@@ -20,41 +19,47 @@ export const withPodfile: ConfigPlugin<{
2019

2120
const useExpoModules =
2221
excludedPackages && excludedPackages.length > 0
23-
? `exclude = ["${excludedPackages.join(`", "`)}"]
24-
use_expo_modules!(exclude: exclude)`
22+
? `exclude = ["${excludedPackages.join(`", "`)}"]\n use_expo_modules!(exclude: exclude)`
2523
: "use_expo_modules!";
2624

2725
const appClipTarget = `
28-
target '${targetName}' do
29-
${useExpoModules}
30-
config = use_native_modules!
26+
target '${targetName}' do
27+
${useExpoModules}
3128
32-
use_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks']
33-
use_frameworks! :linkage => ENV['USE_FRAMEWORKS'].to_sym if ENV['USE_FRAMEWORKS']
29+
if ENV['EXPO_USE_COMMUNITY_AUTOLINKING'] == '1'
30+
config_command = ['node', '-e', "process.argv=['', '', 'config'];require('@react-native-community/cli').run()"];
31+
else
32+
config_command = [
33+
'node',
34+
'--no-warnings',
35+
'--eval',
36+
'require(require.resolve(\\'expo-modules-autolinking\\', { paths: [require.resolve(\\'expo/package.json\\')] }))(process.argv.slice(1))',
37+
'react-native-config',
38+
'--json',
39+
'--platform',
40+
'ios'
41+
]
42+
end
43+
config = use_native_modules!(config_command)
3444
35-
use_react_native!(
36-
:path => config[:reactNativePath],
37-
:hermes_enabled => podfile_properties['expo.jsEngine'] == nil || podfile_properties['expo.jsEngine'] == 'hermes',
38-
# An absolute path to your application root.
39-
:app_path => "#{Pod::Config.instance.installation_root}/..",
40-
:privacy_file_aggregation_enabled => podfile_properties['apple.privacyManifestAggregationEnabled'] != 'false',
41-
)
42-
end
43-
`;
45+
use_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks']
46+
use_frameworks! :linkage => ENV['USE_FRAMEWORKS'].to_sym if ENV['USE_FRAMEWORKS']
4447
45-
/* podfileContent = podfileContent
46-
.concat(`\n\n# >>> Inserted by react-native-app-clip`)
47-
.concat(podfileInsert)
48-
.concat(`\n\n# <<< Inserted by react-native-app-clip`); */
48+
use_react_native!(
49+
:path => config[:reactNativePath],
50+
:hermes_enabled => podfile_properties['expo.jsEngine'] == nil || podfile_properties['expo.jsEngine'] == 'hermes',
51+
# An absolute path to your application root.
52+
:app_path => "#{Pod::Config.instance.installation_root}/..",
53+
:privacy_file_aggregation_enabled => podfile_properties['apple.privacyManifestAggregationEnabled'] != 'false',
54+
)
55+
end
56+
`.trim();
4957

50-
podfileContent = mergeContents({
51-
tag: "react-native-app-clip-2",
52-
src: podfileContent,
53-
newSrc: appClipTarget,
54-
anchor: "Pod::UI.warn e",
55-
offset: 3,
56-
comment: "#",
57-
}).contents;
58+
// It's generally safer to use `mergeContents` to insert new content into the Podfile, but this new target should always be inserted at the end of the file.
59+
podfileContent = podfileContent
60+
.concat(`\n\n# >>> Inserted by react-native-app-clip\n`)
61+
.concat(appClipTarget)
62+
.concat(`\n\n# <<< Inserted by react-native-app-clip\n`);
5863

5964
fs.writeFileSync(podFilePath, podfileContent);
6065

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
"outDir": "./build"
66
},
77
"include": ["./src"],
8-
"exclude": ["**/__mocks__/*", "**/__tests__/*"]
8+
"exclude": ["**/__mocks__/*", "**/__tests__/*", "**/__rsc_tests__/*"]
99
}

0 commit comments

Comments
 (0)