mirror of
https://github.com/spacedriveapp/spacedrive
synced 2024-07-04 12:13:27 +00:00
Update to Expo 50 and Fix to Rive Crashing (#2049)
* Update Mobile App to Expo SDK 50 + Fix to Rive Crashing * Added `metro-react-native-babel-transformer` to fix CI
This commit is contained in:
parent
2ff1ffcb9c
commit
58f9305965
|
@ -1,3 +1,5 @@
|
|||
- Make sure to run `pnpm i` if you make any change to the `package` mobile uses like `assets`.
|
||||
- If iOS build fails with `node not found` error, run `echo "export NODE_BINARY=$(command -v node)" >> .xcode.env.local` on `mobile/ios/` directory.
|
||||
- If XCode can't find node, run `ln -s "$(which node)" /usr/local/bin/node`
|
||||
- To view the logs from the Spacedrive Core API, run `xcrun simctl launch --console booted com.spacedrive.app` with the app built in debug mode.
|
||||
- If Rive Assets have been updated, run `pnpm mobile prebuild` to import the latest version of the `.riv` files into the project.
|
||||
|
|
|
@ -57,7 +57,8 @@
|
|||
"deploymentTarget": "14.0"
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
["./withRiveAssets.js"]
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,21 +56,21 @@ afterEvaluate {
|
|||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion safeExtGet("compileSdkVersion", 33)
|
||||
compileSdkVersion safeExtGet("compileSdkVersion", 34)
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_11
|
||||
targetCompatibility JavaVersion.VERSION_11
|
||||
sourceCompatibility JavaVersion.VERSION_17
|
||||
targetCompatibility JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = JavaVersion.VERSION_11.majorVersion
|
||||
jvmTarget = JavaVersion.VERSION_17.majorVersion
|
||||
}
|
||||
|
||||
namespace "com.spacedrive.core"
|
||||
defaultConfig {
|
||||
minSdkVersion safeExtGet("minSdkVersion", 28)
|
||||
targetSdkVersion safeExtGet("targetSdkVersion", 33)
|
||||
targetSdkVersion safeExtGet("targetSdkVersion", 34)
|
||||
versionCode 1
|
||||
versionName "0.2.0"
|
||||
}
|
||||
|
|
|
@ -21,44 +21,45 @@
|
|||
"@hookform/resolvers": "^3.1.0",
|
||||
"@oscartbeaumont-sd/rspc-client": "=0.0.0-main-dc31e5b2",
|
||||
"@oscartbeaumont-sd/rspc-react": "=0.0.0-main-dc31e5b2",
|
||||
"@react-native-async-storage/async-storage": "~1.18.2",
|
||||
"@react-native-masked-view/masked-view": "^0.2.9",
|
||||
"@react-native-async-storage/async-storage": "~1.21.0",
|
||||
"@react-native-masked-view/masked-view": "^0.3.0",
|
||||
"@react-navigation/bottom-tabs": "^6.5.8",
|
||||
"@react-navigation/drawer": "^6.6.3",
|
||||
"@react-navigation/native": "^6.1.7",
|
||||
"@react-navigation/stack": "^6.3.17",
|
||||
"@sd/assets": "workspace:*",
|
||||
"@sd/client": "workspace:*",
|
||||
"@shopify/flash-list": "1.4.3",
|
||||
"@shopify/flash-list": "1.6.3",
|
||||
"@tanstack/react-query": "^4.36.1",
|
||||
"babel-preset-solid": "^1.8.9",
|
||||
"class-variance-authority": "^0.7.0",
|
||||
"dayjs": "^1.11.10",
|
||||
"event-target-polyfill": "^0.0.3",
|
||||
"expo": "~49.0.8",
|
||||
"expo-blur": "^12.4.1",
|
||||
"expo-build-properties": "~0.8.3",
|
||||
"expo-linking": "~5.0.2",
|
||||
"expo-media-library": "~15.4.1",
|
||||
"expo-splash-screen": "~0.20.5",
|
||||
"expo-status-bar": "~1.6.0",
|
||||
"expo": "~50.0.5",
|
||||
"expo-blur": "^12.9.1",
|
||||
"expo-build-properties": "~0.11.1",
|
||||
"expo-linking": "~6.2.2",
|
||||
"expo-media-library": "~15.9.1",
|
||||
"expo-splash-screen": "~0.26.4",
|
||||
"expo-status-bar": "~1.11.1",
|
||||
"intl": "^1.2.5",
|
||||
"lottie-react-native": "5.1.6",
|
||||
"lottie-react-native": "6.5.1",
|
||||
"metro-react-native-babel-transformer": "^0.77.0",
|
||||
"moti": "^0.26.0",
|
||||
"phosphor-react-native": "^2.0.0",
|
||||
"react": "^18.2.0",
|
||||
"react-hook-form": "^7.47.0",
|
||||
"react-native": "0.72.6",
|
||||
"react-native": "0.73.2",
|
||||
"react-native-circular-progress": "^1.3.9",
|
||||
"react-native-document-picker": "^9.0.1",
|
||||
"react-native-fs": "^2.20.0",
|
||||
"react-native-gesture-handler": "~2.12.1",
|
||||
"react-native-gesture-handler": "~2.14.1",
|
||||
"react-native-linear-gradient": "^2.8.3",
|
||||
"react-native-popup-menu": "^0.16.1",
|
||||
"react-native-reanimated": "~3.3.0",
|
||||
"react-native-safe-area-context": "4.6.3",
|
||||
"react-native-screens": "~3.22.1",
|
||||
"react-native-svg": "13.9.0",
|
||||
"react-native-reanimated": "~3.6.2",
|
||||
"react-native-safe-area-context": "4.8.2",
|
||||
"react-native-screens": "~3.29.0",
|
||||
"react-native-svg": "14.1.0",
|
||||
"react-native-wheel-color-picker": "^1.2.0",
|
||||
"rive-react-native": "^6.2.3",
|
||||
"solid-js": "^1.8.8",
|
||||
|
@ -72,10 +73,10 @@
|
|||
"@babel/core": "^7.23.2",
|
||||
"@rnx-kit/metro-config": "^1.3.12",
|
||||
"@sd/config": "workspace:*",
|
||||
"@types/react": "^18.2.34",
|
||||
"@types/react": "^18.2.52",
|
||||
"babel-plugin-module-resolver": "^5.0.0",
|
||||
"eslint-plugin-react-native": "^4.1.0",
|
||||
"react-native-svg-transformer": "^1.1.0",
|
||||
"typescript": "^5.2.2"
|
||||
"typescript": "^5.3.3"
|
||||
}
|
||||
}
|
||||
|
|
102
apps/mobile/withRiveAssets.js
Normal file
102
apps/mobile/withRiveAssets.js
Normal file
|
@ -0,0 +1,102 @@
|
|||
/*
|
||||
* If you add an asset you need to run `npx expo prebuild`
|
||||
* If you rename or delete an asset you need to run `npx expo prebuild --clean` to delete them in your android and ios folder as well.
|
||||
*/
|
||||
|
||||
const {
|
||||
withDangerousMod,
|
||||
withXcodeProject,
|
||||
IOSConfig,
|
||||
} = require("@expo/config-plugins");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
// Specify the source directory of your assets
|
||||
const ASSET_SOURCE_DIR = "assets/rive";
|
||||
|
||||
const IOS_GROUP_NAME = "Rivassets";
|
||||
|
||||
const withRiveAssets = (config) => {
|
||||
config = addAndroidResources(config);
|
||||
config = addIOSResources(config);
|
||||
return config;
|
||||
};
|
||||
|
||||
// Code inspired by https://github.com/rive-app/rive-react-native/issues/185#issuecomment-1593396573
|
||||
function addAndroidResources(config) {
|
||||
return withDangerousMod(config, [
|
||||
"android",
|
||||
async (config) => {
|
||||
// Get the path to the Android project directory
|
||||
const projectRoot = config.modRequest.projectRoot;
|
||||
|
||||
// Get the path to the Android resources directory
|
||||
const resDir = path.join(
|
||||
projectRoot,
|
||||
"android",
|
||||
"app",
|
||||
"src",
|
||||
"main",
|
||||
"res"
|
||||
);
|
||||
|
||||
// Create the 'raw' directory if it doesn't exist
|
||||
const rawDir = path.join(resDir, "raw");
|
||||
fs.mkdirSync(rawDir, { recursive: true });
|
||||
|
||||
// Get the path to the assets directory
|
||||
const assetSourcePath = path.join(projectRoot, ASSET_SOURCE_DIR);
|
||||
|
||||
// Retrieve all files in the assets directory
|
||||
const assetFiles = fs.readdirSync(assetSourcePath);
|
||||
|
||||
// Move each asset file to the resources 'raw' directory
|
||||
for (const assetFile of assetFiles) {
|
||||
const srcAssetPath = path.join(assetSourcePath, assetFile);
|
||||
const destAssetPath = path.join(rawDir, assetFile);
|
||||
fs.copyFileSync(srcAssetPath, destAssetPath);
|
||||
}
|
||||
|
||||
return config;
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
// Code inspired by https://github.com/expo/expo/blob/61f8cf8d4b3cf5f8bf61f346476ebdb4aff40545/packages/expo-font/plugin/src/withFontsIos.ts
|
||||
function addIOSResources(config) {
|
||||
return withXcodeProject(config, async (config) => {
|
||||
const project = config.modResults;
|
||||
const platformProjectRoot = config.modRequest.platformProjectRoot;
|
||||
|
||||
// Create Assets group in project
|
||||
IOSConfig.XcodeUtils.ensureGroupRecursively(project, IOS_GROUP_NAME);
|
||||
|
||||
// Get riv filepaths
|
||||
const projectRoot = config.modRequest.projectRoot;
|
||||
const assetSourcePath = path.join(projectRoot, ASSET_SOURCE_DIR);
|
||||
const assetFiles = fs.readdirSync(assetSourcePath);
|
||||
const assetFilesPaths = assetFiles.map(
|
||||
(assetFile) => `${assetSourcePath}/${assetFile}`
|
||||
);
|
||||
|
||||
// Add assets to group
|
||||
addIOSResourceFile(project, platformProjectRoot, assetFilesPaths);
|
||||
|
||||
return config;
|
||||
});
|
||||
|
||||
function addIOSResourceFile(project, platformRoot, assetFilesPaths) {
|
||||
for (const riveFile of assetFilesPaths) {
|
||||
const riveFilePath = path.relative(platformRoot, riveFile);
|
||||
IOSConfig.XcodeUtils.addResourceFileToGroup({
|
||||
filepath: riveFilePath,
|
||||
groupName: IOS_GROUP_NAME,
|
||||
project,
|
||||
isBuildFile: true,
|
||||
verbose: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = withRiveAssets;
|
3356
pnpm-lock.yaml
3356
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue