Skip to content

Commit 90f43d6

Browse files
chore: update example
1 parent 7852c63 commit 90f43d6

File tree

5 files changed

+67
-41
lines changed

5 files changed

+67
-41
lines changed

.yarn/patches/@op-engineering-op-sqlite-npm-15.0.7-39fbf4933a.patch

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,18 @@ index 5e1c1de234e7bdb131769728fc862d389f9995a5..dc21c6503ffe18f3ae1cf99f327e8aa1
193193
void install(jsi::Runtime &rt,
194194
const std::shared_ptr<react::CallInvoker> &invoker,
195195
const char *base_path, const char *crsqlite_path,
196+
diff --git a/cpp/bindings.h b/cpp/bindings.h
197+
index 91511ab8dff0cbd34c6b8b844c1783c39d4317cb..cc73dfe4405d568cbfbbfa5a9c879a1d88f260bf 100644
198+
--- a/cpp/bindings.h
199+
+++ b/cpp/bindings.h
200+
@@ -14,6 +14,7 @@ void install(jsi::Runtime &rt,
201+
const char *base_path, const char *crsqlite_path,
202+
const char *sqlite_vec_path);
203+
void invalidate();
204+
+bool deleteAllDbs();
205+
void expoUpdatesWorkaround(const char *base_path);
206+
207+
} // namespace opsqlite
196208
diff --git a/op-sqlite.podspec b/op-sqlite.podspec
197209
index 375cc3ef0838a3cffb87ec970f636880a8676bb3..e6fce21630ed00aa863f2baae7b3d04de783dcb0 100644
198210
--- a/op-sqlite.podspec

android/src/main/java/com/mendix/mendixnative/react/NavigationModeModule.kt

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@ package com.mendix.mendixnative.react
22

33
import android.util.Log
44
import com.facebook.react.bridge.ReactApplicationContext
5-
import com.facebook.react.bridge.ReactContextBaseJavaModule
6-
import com.facebook.react.bridge.ReactMethod
75

8-
class NavigationModeModule(reactContext: ReactApplicationContext) :
9-
ReactContextBaseJavaModule(reactContext) {
6+
class NavigationModeModule(val context: ReactApplicationContext) {
107

118
companion object {
129
const val TAG = "NavigationModeModule"
@@ -15,13 +12,9 @@ class NavigationModeModule(reactContext: ReactApplicationContext) :
1512
const val NAVIGATION_BAR_INTERACTION_MODE_GESTURE = 2
1613
}
1714

18-
override fun getName(): String = "NavigationMode"
19-
20-
@ReactMethod(isBlockingSynchronousMethod = true)
2115
fun isNavigationBarActive(): Boolean {
2216
Log.d(TAG, "=== isNavigationBarActive called (sync) ===")
2317
return try {
24-
val context = reactApplicationContext
2518
Log.d(TAG, "Context: $context")
2619

2720
val resources = context.resources
@@ -60,11 +53,9 @@ class NavigationModeModule(reactContext: ReactApplicationContext) :
6053
}
6154
}
6255

63-
@ReactMethod(isBlockingSynchronousMethod = true)
6456
fun getNavigationBarHeight(): Double {
6557
Log.d(TAG, "=== getNavigationBarHeight called (sync) ===")
6658
return try {
67-
val context = reactApplicationContext
6859
val resources = context.resources
6960

7061
val resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android")

example/android/app/src/main/java/mendixnative/example/MainApplication.kt

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,18 @@ import com.facebook.react.defaults.DefaultReactNativeHost
1212
import com.facebook.react.soloader.OpenSourceMergedSoMapping
1313
import com.facebook.soloader.SoLoader
1414

15-
class MainApplication : Application(), ReactApplication {
15+
//Start - For MendixApplication compatibility only, not part of React Native template
16+
import com.mendix.mendixnative.MendixApplication
17+
import com.mendix.mendixnative.react.splash.MendixSplashScreenPresenter
18+
import com.mendix.mendixnative.react.MxConfiguration
19+
20+
class SplashScreenPresenter: MendixSplashScreenPresenter {
21+
override fun show(activity: android.app.Activity) {}
22+
override fun hide(activity: android.app.Activity) {}
23+
}
24+
//End - For MendixApplication compatibility only, not part of React Native template
25+
26+
class MainApplication : Application(), MendixApplication {
1627

1728
override val reactNativeHost: ReactNativeHost =
1829
object : DefaultReactNativeHost(this) {
@@ -35,10 +46,19 @@ class MainApplication : Application(), ReactApplication {
3546

3647
override fun onCreate() {
3748
super.onCreate()
49+
MxConfiguration.runtimeUrl = "http://10.0.2.2:8081" //For MendixApplication compatibility only, not part of React Native template
3850
SoLoader.init(this, OpenSourceMergedSoMapping)
3951
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
4052
// If you opted-in for the New Architecture, we load the native entry point for this app.
4153
load()
4254
}
4355
}
56+
57+
//Start - For MendixApplication compatibility only, not part of React Native template
58+
override fun getUseDeveloperSupport() = false
59+
override fun createSplashScreenPresenter() = SplashScreenPresenter()
60+
override fun getPackages(): List<ReactPackage> = PackageList(this).packages
61+
override fun getJSBundleFile() = null
62+
override fun getAppSessionId() = null
63+
//End - For MendixApplication compatibility only, not part of React Native template
4464
}
Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,46 @@
11
import UIKit
22
import React
3+
import React_RCTAppDelegate
4+
import ReactAppDependencyProvider
35
import MendixNative
46

57
@main
6-
class AppDelegate: ReactAppProvider {
8+
class AppDelegate: RCTAppDelegate {
79

810
override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
9-
super.setUpProvider()
11+
12+
self.moduleName = "App"
13+
self.dependencyProvider = RCTAppDependencyProvider()
14+
self.initialProps = [:]
1015
super.application(application, didFinishLaunchingWithOptions: launchOptions)
11-
changeRoot(to: Home())
16+
17+
//Start - For MendixApplication compatibility only, not part of React Native template
18+
MxConfiguration.update(from:
19+
MendixApp.init(
20+
identifier: nil,
21+
bundleUrl: bundleURL()!,
22+
runtimeUrl: URL(string: "http://localhost:8081")!,
23+
warningsFilter: .none,
24+
isDeveloperApp: false,
25+
clearDataAtLaunch: false,
26+
splashScreenPresenter: nil,
27+
reactLoading: nil,
28+
enableThreeFingerGestures: false
29+
)
30+
)
31+
//End - For MendixApplication compatibility only, not part of React Native template
1232
return true
1333
}
1434

15-
open override func bundleURL() -> URL? {
16-
return RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
35+
override func sourceURL(for bridge: RCTBridge) -> URL? {
36+
self.bundleURL()
1737
}
18-
}
1938

20-
class Home: UIViewController {
21-
22-
lazy var button: UIButton = {
23-
let button = UIButton(type: .system)
24-
button.setTitle("Open React App", for: .normal)
25-
button.translatesAutoresizingMaskIntoConstraints = false
26-
button.addTarget(self, action: #selector(openApp), for: .touchUpInside)
27-
return button
28-
}()
29-
30-
override func viewDidLoad() {
31-
super.viewDidLoad()
32-
view.backgroundColor = .white
33-
view.addSubview(button)
34-
NSLayoutConstraint.activate([
35-
button.centerXAnchor.constraint(equalTo: view.centerXAnchor),
36-
button.centerYAnchor.constraint(equalTo: view.centerYAnchor)
37-
])
38-
}
39-
40-
@objc func openApp() {
41-
ReactAppProvider.shared()?.setReactViewController(UIViewController())
39+
override func bundleURL() -> URL? {
40+
#if DEBUG
41+
RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
42+
#else
43+
Bundle.main.url(forResource: "main", withExtension: "jsbundle")
44+
#endif
4245
}
4346
}

yarn.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2496,11 +2496,11 @@ __metadata:
24962496

24972497
"@op-engineering/op-sqlite@patch:@op-engineering/op-sqlite@npm%3A15.0.7#./.yarn/patches/@op-engineering-op-sqlite-npm-15.0.7-39fbf4933a.patch::locator=mendix-native%40workspace%3A.":
24982498
version: 15.0.7
2499-
resolution: "@op-engineering/op-sqlite@patch:@op-engineering/op-sqlite@npm%3A15.0.7#./.yarn/patches/@op-engineering-op-sqlite-npm-15.0.7-39fbf4933a.patch::version=15.0.7&hash=2e90b0&locator=mendix-native%40workspace%3A."
2499+
resolution: "@op-engineering/op-sqlite@patch:@op-engineering/op-sqlite@npm%3A15.0.7#./.yarn/patches/@op-engineering-op-sqlite-npm-15.0.7-39fbf4933a.patch::version=15.0.7&hash=686531&locator=mendix-native%40workspace%3A."
25002500
peerDependencies:
25012501
react: "*"
25022502
react-native: "*"
2503-
checksum: 9c9d3148f4ad7d5025a5d6df9c2c82996b10270936f788a5486ab1df26307ab9b88130f00472f32bd6e7a13793312be04f3e60a0ccbd1bd88ec90b3fb4a8163e
2503+
checksum: 4f77818b144fe18bfdcc5f02c2e3249b7b7686b378fd8d72db69c27a13af3e45c679ef66a2d34f4da6eca732882b696e7e1a2d54eee158edeb95c9391f3433b6
25042504
languageName: node
25052505
linkType: hard
25062506

0 commit comments

Comments
 (0)