Skip to content

Commit 21386a0

Browse files
committed
fixed problems with mobile side and fixed up issues with dependencies
1 parent 67976d2 commit 21386a0

7 files changed

Lines changed: 100 additions & 131 deletions

File tree

apps/mobile/android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ react {
2222
// skip the bundling of the JS bundle and the assets. Default is "debug", "debugOptimized".
2323
// If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
2424
// debuggableVariants = ["liteDebug", "liteDebugOptimized", "prodDebug", "prodDebugOptimized"]
25-
25+
debuggableVariants = ["debug"]
2626
/* Bundling */
2727
// A list containing the node command and its flags. Default is just 'node'.
2828
// nodeExecutableAndArgs = ["node"]
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
2+
3+
<uses-permission android:name="android.permission.INTERNET" />
4+
5+
<application
6+
android:name=".MainApplication"
7+
android:label="@string/app_name"
8+
android:icon="@mipmap/ic_launcher"
9+
android:roundIcon="@mipmap/ic_launcher_round"
10+
android:allowBackup="false"
11+
android:theme="@style/AppTheme"
12+
android:supportsRtl="true">
13+
14+
<activity
15+
android:name=".MainActivity"
16+
android:label="@string/app_name"
17+
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
18+
android:launchMode="singleTask"
19+
android:windowSoftInputMode="adjustResize"
20+
android:exported="true">
21+
22+
<intent-filter>
23+
<action android:name="android.intent.action.MAIN" />
24+
<category android:name="android.intent.category.LAUNCHER" />
25+
</intent-filter>
26+
27+
</activity>
28+
29+
</application>
30+
31+
</manifest>

apps/mobile/android/app/src/main/java/com/devcard/app/MainApplication.kt

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,34 @@ import android.app.Application
44
import com.facebook.react.PackageList
55
import com.facebook.react.ReactApplication
66
import com.facebook.react.ReactHost
7-
import com.facebook.react.ReactNativeApplicationEntryPoint.loadReactNative
7+
import com.facebook.react.ReactNativeHost
8+
import com.facebook.react.ReactPackage
89
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
10+
import com.facebook.react.defaults.DefaultReactNativeHost
11+
import com.facebook.react.ReactNativeApplicationEntryPoint.loadReactNative
912

1013
class MainApplication : Application(), ReactApplication {
1114

12-
override val reactHost: ReactHost by lazy {
13-
getDefaultReactHost(
14-
context = applicationContext,
15-
packageList =
16-
PackageList(this).packages.apply {
17-
// Packages that cannot be autolinked yet can be added manually here, for example:
18-
// add(MyReactNativePackage())
19-
},
20-
)
21-
}
15+
override val reactNativeHost: ReactNativeHost =
16+
object : DefaultReactNativeHost(this) {
17+
18+
override fun getPackages(): List<ReactPackage> =
19+
PackageList(this).packages
20+
21+
override fun getJSMainModuleName(): String = "index"
22+
23+
override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG
24+
25+
override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
26+
override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
27+
}
28+
29+
override val reactHost: ReactHost
30+
get() = getDefaultReactHost(applicationContext, reactNativeHost)
2231

2332
override fun onCreate() {
2433
super.onCreate()
2534
loadReactNative(this)
2635
}
2736
}
37+

apps/mobile/android/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m
1616
# This option should only be used with decoupled projects. More details, visit
1717
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
1818
# org.gradle.parallel=true
19+
newArchEnabled=false
1920

2021
# AndroidX package structure to make it clearer which packages are bundled with the
2122
# Android operating system, and which are packaged with your app's APK
@@ -32,7 +33,6 @@ reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
3233
# your application. You should enable this flag either if you want
3334
# to write custom TurboModules/Fabric components OR use libraries that
3435
# are providing them.
35-
newArchEnabled=false
3636

3737
# Use this property to enable or disable the Hermes JS engine.
3838
# If set to false, you will be using JSC instead.

apps/mobile/metro.config.js

Lines changed: 10 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,20 @@
11
const { getDefaultConfig } = require('@react-native/metro-config');
22
const path = require('path');
33

4-
// Monorepo root
54
const projectRoot = __dirname;
65
const monorepoRoot = path.resolve(projectRoot, '../..');
76

8-
/**
9-
* Metro configuration for React Native monorepo
10-
*/
11-
module.exports = (async () => {
12-
const config = await getDefaultConfig(projectRoot);
7+
const config = getDefaultConfig(projectRoot);
138

14-
config.watchFolders = [monorepoRoot];
15-
config.resolver = config.resolver || {};
16-
config.resolver.nodeModulesPaths = [
17-
path.resolve(projectRoot, 'node_modules'),
18-
path.resolve(monorepoRoot, 'node_modules'),
19-
];
20-
config.resolver.disableHierarchicalLookup = false;
9+
config.watchFolders = [
10+
path.resolve(monorepoRoot, 'packages'),
11+
];
2112

22-
const pinnedModules = {
23-
react: path.resolve(projectRoot, 'node_modules/react'),
24-
'react-native': path.resolve(projectRoot, 'node_modules/react-native'),
25-
'react-native-reanimated': path.resolve(
26-
projectRoot,
27-
'node_modules/react-native-reanimated'
28-
),
29-
'react-native-worklets': path.resolve(
30-
projectRoot,
31-
'node_modules/react-native-worklets'
32-
),
33-
'react-native-gesture-handler': path.resolve(
34-
projectRoot,
35-
'node_modules/react-native-gesture-handler'
36-
),
37-
};
13+
config.resolver.nodeModulesPaths = [
14+
path.resolve(projectRoot, 'node_modules'),
15+
path.resolve(monorepoRoot, 'node_modules'),
16+
];
3817

39-
config.resolver.extraNodeModules = pinnedModules;
40-
config.resolver.resolveRequest = (context, moduleName, platform) => {
41-
for (const [name, modulePath] of Object.entries(pinnedModules)) {
42-
if (moduleName === name || moduleName.startsWith(`${name}/`)) {
43-
const target = path.join(modulePath, moduleName.slice(name.length));
44-
return context.resolveRequest(context, target, platform);
45-
}
46-
}
18+
config.resolver.disableHierarchicalLookup = true;
4719

48-
return context.resolveRequest(context, moduleName, platform);
49-
};
50-
51-
return config;
52-
})();
20+
module.exports = config;

apps/mobile/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@
2424
"react-native-camera-kit": "^14.0.0",
2525
"react-native-gesture-handler": "^2.28.0",
2626
"react-native-qrcode-svg": "^6.3.0",
27-
"react-native-reanimated": "^3.16.7",
27+
"react-native-reanimated": "^4.4.0",
2828
"react-native-safe-area-context": "^5.5.2",
2929
"react-native-screens": "^4.0.0",
3030
"react-native-svg": "^15.0.0",
3131
"react-native-vector-icons": "^10.0.0",
3232
"react-native-view-shot": "^5.1.0",
3333
"react-native-web": "^0.21.2",
3434
"react-native-webview": "^13.0.0",
35-
"react-native-worklets": "0.5.1"
35+
"react-native-worklets": "0.9.1"
3636
},
3737
"devDependencies": {
3838
"@babel/core": "^7.25.2",

0 commit comments

Comments
 (0)