@onekeyfe/react-native-splash-screen 1.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +36 -0
- package/ReactNativeSplashScreen.podspec +30 -0
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +130 -0
- package/android/gradle.properties +4 -0
- package/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/margelo/nitro/reactnativesplashscreen/ReactNativeSplashScreen.kt +77 -0
- package/android/src/main/java/com/margelo/nitro/reactnativesplashscreen/ReactNativeSplashScreenPackage.kt +24 -0
- package/android/src/main/java/com/margelo/nitro/reactnativesplashscreen/SplashImageResizeMode.kt +23 -0
- package/android/src/main/java/com/margelo/nitro/reactnativesplashscreen/SplashScreenBridge.kt +108 -0
- package/android/src/main/java/com/margelo/nitro/reactnativesplashscreen/SplashScreenView.kt +34 -0
- package/android/src/main/java/com/margelo/nitro/reactnativesplashscreen/SplashViewController.kt +117 -0
- package/ios/ReactNativeSplashScreen.swift +15 -0
- package/lib/module/ReactNativeSplashScreen.nitro.js +4 -0
- package/lib/module/ReactNativeSplashScreen.nitro.js.map +1 -0
- package/lib/module/index.js +6 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/ReactNativeSplashScreen.nitro.d.ts +9 -0
- package/lib/typescript/src/ReactNativeSplashScreen.nitro.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/nitro.json +17 -0
- package/nitrogen/generated/android/c++/JHybridReactNativeSplashScreenSpec.cpp +80 -0
- package/nitrogen/generated/android/c++/JHybridReactNativeSplashScreenSpec.hpp +66 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativesplashscreen/HybridReactNativeSplashScreenSpec.kt +62 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativesplashscreen/reactnativesplashscreenOnLoad.kt +35 -0
- package/nitrogen/generated/android/reactnativesplashscreen+autolinking.cmake +81 -0
- package/nitrogen/generated/android/reactnativesplashscreen+autolinking.gradle +27 -0
- package/nitrogen/generated/android/reactnativesplashscreenOnLoad.cpp +44 -0
- package/nitrogen/generated/android/reactnativesplashscreenOnLoad.hpp +25 -0
- package/nitrogen/generated/ios/ReactNativeSplashScreen+autolinking.rb +60 -0
- package/nitrogen/generated/ios/ReactNativeSplashScreen-Swift-Cxx-Bridge.cpp +49 -0
- package/nitrogen/generated/ios/ReactNativeSplashScreen-Swift-Cxx-Bridge.hpp +110 -0
- package/nitrogen/generated/ios/ReactNativeSplashScreen-Swift-Cxx-Umbrella.hpp +44 -0
- package/nitrogen/generated/ios/ReactNativeSplashScreenAutolinking.mm +33 -0
- package/nitrogen/generated/ios/ReactNativeSplashScreenAutolinking.swift +25 -0
- package/nitrogen/generated/ios/c++/HybridReactNativeSplashScreenSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridReactNativeSplashScreenSpecSwift.hpp +84 -0
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridReactNativeSplashScreenSpec.swift +57 -0
- package/nitrogen/generated/ios/swift/HybridReactNativeSplashScreenSpec_cxx.swift +157 -0
- package/nitrogen/generated/shared/c++/HybridReactNativeSplashScreenSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridReactNativeSplashScreenSpec.hpp +63 -0
- package/package.json +169 -0
- package/src/ReactNativeSplashScreen.nitro.ts +7 -0
- package/src/index.tsx +8 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { HybridObject } from 'react-native-nitro-modules';
|
|
2
|
+
export interface ReactNativeSplashScreen extends HybridObject<{
|
|
3
|
+
ios: 'swift';
|
|
4
|
+
android: 'kotlin';
|
|
5
|
+
}> {
|
|
6
|
+
preventAutoHideAsync(): Promise<boolean>;
|
|
7
|
+
hideAsync(): Promise<boolean>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=ReactNativeSplashScreen.nitro.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReactNativeSplashScreen.nitro.d.ts","sourceRoot":"","sources":["../../../src/ReactNativeSplashScreen.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D,MAAM,WAAW,uBACf,SAAQ,YAAY,CAAC;IAAE,GAAG,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,QAAQ,CAAA;CAAE,CAAC;IACzD,oBAAoB,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IACzC,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CAC/B"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ReactNativeSplashScreen as ReactNativeSplashScreenType } from './ReactNativeSplashScreen.nitro';
|
|
2
|
+
export declare const ReactNativeSplashScreen: ReactNativeSplashScreenType;
|
|
3
|
+
export type * from './ReactNativeSplashScreen.nitro';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,IAAI,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAK9G,eAAO,MAAM,uBAAuB,6BAAsC,CAAC;AAC3E,mBAAmB,iCAAiC,CAAC"}
|
package/nitro.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cxxNamespace": ["reactnativesplashscreen"],
|
|
3
|
+
"ios": {
|
|
4
|
+
"iosModuleName": "ReactNativeSplashScreen"
|
|
5
|
+
},
|
|
6
|
+
"android": {
|
|
7
|
+
"androidNamespace": ["reactnativesplashscreen"],
|
|
8
|
+
"androidCxxLibName": "reactnativesplashscreen"
|
|
9
|
+
},
|
|
10
|
+
"autolinking": {
|
|
11
|
+
"ReactNativeSplashScreen": {
|
|
12
|
+
"swift": "ReactNativeSplashScreen",
|
|
13
|
+
"kotlin": "ReactNativeSplashScreen"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"ignorePaths": ["node_modules"]
|
|
17
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JHybridReactNativeSplashScreenSpec.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "JHybridReactNativeSplashScreenSpec.hpp"
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
#include <NitroModules/Promise.hpp>
|
|
13
|
+
#include <NitroModules/JPromise.hpp>
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::reactnativesplashscreen {
|
|
16
|
+
|
|
17
|
+
jni::local_ref<JHybridReactNativeSplashScreenSpec::jhybriddata> JHybridReactNativeSplashScreenSpec::initHybrid(jni::alias_ref<jhybridobject> jThis) {
|
|
18
|
+
return makeCxxInstance(jThis);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
void JHybridReactNativeSplashScreenSpec::registerNatives() {
|
|
22
|
+
registerHybrid({
|
|
23
|
+
makeNativeMethod("initHybrid", JHybridReactNativeSplashScreenSpec::initHybrid),
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
size_t JHybridReactNativeSplashScreenSpec::getExternalMemorySize() noexcept {
|
|
28
|
+
static const auto method = javaClassStatic()->getMethod<jlong()>("getMemorySize");
|
|
29
|
+
return method(_javaPart);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
void JHybridReactNativeSplashScreenSpec::dispose() noexcept {
|
|
33
|
+
static const auto method = javaClassStatic()->getMethod<void()>("dispose");
|
|
34
|
+
method(_javaPart);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
std::string JHybridReactNativeSplashScreenSpec::toString() {
|
|
38
|
+
static const auto method = javaClassStatic()->getMethod<jni::JString()>("toString");
|
|
39
|
+
auto javaString = method(_javaPart);
|
|
40
|
+
return javaString->toStdString();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Properties
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
// Methods
|
|
47
|
+
std::shared_ptr<Promise<bool>> JHybridReactNativeSplashScreenSpec::preventAutoHideAsync() {
|
|
48
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("preventAutoHideAsync");
|
|
49
|
+
auto __result = method(_javaPart);
|
|
50
|
+
return [&]() {
|
|
51
|
+
auto __promise = Promise<bool>::create();
|
|
52
|
+
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
|
|
53
|
+
auto __result = jni::static_ref_cast<jni::JBoolean>(__boxedResult);
|
|
54
|
+
__promise->resolve(static_cast<bool>(__result->value()));
|
|
55
|
+
});
|
|
56
|
+
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
57
|
+
jni::JniException __jniError(__throwable);
|
|
58
|
+
__promise->reject(std::make_exception_ptr(__jniError));
|
|
59
|
+
});
|
|
60
|
+
return __promise;
|
|
61
|
+
}();
|
|
62
|
+
}
|
|
63
|
+
std::shared_ptr<Promise<bool>> JHybridReactNativeSplashScreenSpec::hideAsync() {
|
|
64
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("hideAsync");
|
|
65
|
+
auto __result = method(_javaPart);
|
|
66
|
+
return [&]() {
|
|
67
|
+
auto __promise = Promise<bool>::create();
|
|
68
|
+
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
|
|
69
|
+
auto __result = jni::static_ref_cast<jni::JBoolean>(__boxedResult);
|
|
70
|
+
__promise->resolve(static_cast<bool>(__result->value()));
|
|
71
|
+
});
|
|
72
|
+
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
73
|
+
jni::JniException __jniError(__throwable);
|
|
74
|
+
__promise->reject(std::make_exception_ptr(__jniError));
|
|
75
|
+
});
|
|
76
|
+
return __promise;
|
|
77
|
+
}();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
} // namespace margelo::nitro::reactnativesplashscreen
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridReactNativeSplashScreenSpec.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <NitroModules/JHybridObject.hpp>
|
|
11
|
+
#include <fbjni/fbjni.h>
|
|
12
|
+
#include "HybridReactNativeSplashScreenSpec.hpp"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
namespace margelo::nitro::reactnativesplashscreen {
|
|
18
|
+
|
|
19
|
+
using namespace facebook;
|
|
20
|
+
|
|
21
|
+
class JHybridReactNativeSplashScreenSpec: public jni::HybridClass<JHybridReactNativeSplashScreenSpec, JHybridObject>,
|
|
22
|
+
public virtual HybridReactNativeSplashScreenSpec {
|
|
23
|
+
public:
|
|
24
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/reactnativesplashscreen/HybridReactNativeSplashScreenSpec;";
|
|
25
|
+
static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
|
|
26
|
+
static void registerNatives();
|
|
27
|
+
|
|
28
|
+
protected:
|
|
29
|
+
// C++ constructor (called from Java via `initHybrid()`)
|
|
30
|
+
explicit JHybridReactNativeSplashScreenSpec(jni::alias_ref<jhybridobject> jThis) :
|
|
31
|
+
HybridObject(HybridReactNativeSplashScreenSpec::TAG),
|
|
32
|
+
HybridBase(jThis),
|
|
33
|
+
_javaPart(jni::make_global(jThis)) {}
|
|
34
|
+
|
|
35
|
+
public:
|
|
36
|
+
~JHybridReactNativeSplashScreenSpec() override {
|
|
37
|
+
// Hermes GC can destroy JS objects on a non-JNI Thread.
|
|
38
|
+
jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public:
|
|
42
|
+
size_t getExternalMemorySize() noexcept override;
|
|
43
|
+
void dispose() noexcept override;
|
|
44
|
+
std::string toString() override;
|
|
45
|
+
|
|
46
|
+
public:
|
|
47
|
+
inline const jni::global_ref<JHybridReactNativeSplashScreenSpec::javaobject>& getJavaPart() const noexcept {
|
|
48
|
+
return _javaPart;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public:
|
|
52
|
+
// Properties
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
public:
|
|
56
|
+
// Methods
|
|
57
|
+
std::shared_ptr<Promise<bool>> preventAutoHideAsync() override;
|
|
58
|
+
std::shared_ptr<Promise<bool>> hideAsync() override;
|
|
59
|
+
|
|
60
|
+
private:
|
|
61
|
+
friend HybridBase;
|
|
62
|
+
using HybridBase::HybridBase;
|
|
63
|
+
jni::global_ref<JHybridReactNativeSplashScreenSpec::javaobject> _javaPart;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
} // namespace margelo::nitro::reactnativesplashscreen
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridReactNativeSplashScreenSpec.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.reactnativesplashscreen
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import com.margelo.nitro.core.Promise
|
|
14
|
+
import com.margelo.nitro.core.HybridObject
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* A Kotlin class representing the ReactNativeSplashScreen HybridObject.
|
|
18
|
+
* Implement this abstract class to create Kotlin-based instances of ReactNativeSplashScreen.
|
|
19
|
+
*/
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
@Suppress(
|
|
23
|
+
"KotlinJniMissingFunction", "unused",
|
|
24
|
+
"RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
|
|
25
|
+
"LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
|
|
26
|
+
)
|
|
27
|
+
abstract class HybridReactNativeSplashScreenSpec: HybridObject() {
|
|
28
|
+
@DoNotStrip
|
|
29
|
+
private var mHybridData: HybridData = initHybrid()
|
|
30
|
+
|
|
31
|
+
init {
|
|
32
|
+
super.updateNative(mHybridData)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
override fun updateNative(hybridData: HybridData) {
|
|
36
|
+
mHybridData = hybridData
|
|
37
|
+
super.updateNative(hybridData)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Default implementation of `HybridObject.toString()`
|
|
41
|
+
override fun toString(): String {
|
|
42
|
+
return "[HybridObject ReactNativeSplashScreen]"
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Properties
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
// Methods
|
|
49
|
+
@DoNotStrip
|
|
50
|
+
@Keep
|
|
51
|
+
abstract fun preventAutoHideAsync(): Promise<Boolean>
|
|
52
|
+
|
|
53
|
+
@DoNotStrip
|
|
54
|
+
@Keep
|
|
55
|
+
abstract fun hideAsync(): Promise<Boolean>
|
|
56
|
+
|
|
57
|
+
private external fun initHybrid(): HybridData
|
|
58
|
+
|
|
59
|
+
companion object {
|
|
60
|
+
protected const val TAG = "HybridReactNativeSplashScreenSpec"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// reactnativesplashscreenOnLoad.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.reactnativesplashscreen
|
|
9
|
+
|
|
10
|
+
import android.util.Log
|
|
11
|
+
|
|
12
|
+
internal class reactnativesplashscreenOnLoad {
|
|
13
|
+
companion object {
|
|
14
|
+
private const val TAG = "reactnativesplashscreenOnLoad"
|
|
15
|
+
private var didLoad = false
|
|
16
|
+
/**
|
|
17
|
+
* Initializes the native part of "reactnativesplashscreen".
|
|
18
|
+
* This method is idempotent and can be called more than once.
|
|
19
|
+
*/
|
|
20
|
+
@JvmStatic
|
|
21
|
+
fun initializeNative() {
|
|
22
|
+
if (didLoad) return
|
|
23
|
+
try {
|
|
24
|
+
Log.i(TAG, "Loading reactnativesplashscreen C++ library...")
|
|
25
|
+
System.loadLibrary("reactnativesplashscreen")
|
|
26
|
+
Log.i(TAG, "Successfully loaded reactnativesplashscreen C++ library!")
|
|
27
|
+
didLoad = true
|
|
28
|
+
} catch (e: Error) {
|
|
29
|
+
Log.e(TAG, "Failed to load reactnativesplashscreen C++ library! Is it properly installed and linked? " +
|
|
30
|
+
"Is the name correct? (see `CMakeLists.txt`, at `add_library(...)`)", e)
|
|
31
|
+
throw e
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#
|
|
2
|
+
# reactnativesplashscreen+autolinking.cmake
|
|
3
|
+
# This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
# https://github.com/mrousavy/nitro
|
|
5
|
+
# Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
#
|
|
7
|
+
|
|
8
|
+
# This is a CMake file that adds all files generated by Nitrogen
|
|
9
|
+
# to the current CMake project.
|
|
10
|
+
#
|
|
11
|
+
# To use it, add this to your CMakeLists.txt:
|
|
12
|
+
# ```cmake
|
|
13
|
+
# include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/reactnativesplashscreen+autolinking.cmake)
|
|
14
|
+
# ```
|
|
15
|
+
|
|
16
|
+
# Define a flag to check if we are building properly
|
|
17
|
+
add_definitions(-DBUILDING_REACTNATIVESPLASHSCREEN_WITH_GENERATED_CMAKE_PROJECT)
|
|
18
|
+
|
|
19
|
+
# Enable Raw Props parsing in react-native (for Nitro Views)
|
|
20
|
+
add_definitions(-DRN_SERIALIZABLE_STATE)
|
|
21
|
+
|
|
22
|
+
# Add all headers that were generated by Nitrogen
|
|
23
|
+
include_directories(
|
|
24
|
+
"../nitrogen/generated/shared/c++"
|
|
25
|
+
"../nitrogen/generated/android/c++"
|
|
26
|
+
"../nitrogen/generated/android/"
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
# Add all .cpp sources that were generated by Nitrogen
|
|
30
|
+
target_sources(
|
|
31
|
+
# CMake project name (Android C++ library name)
|
|
32
|
+
reactnativesplashscreen PRIVATE
|
|
33
|
+
# Autolinking Setup
|
|
34
|
+
../nitrogen/generated/android/reactnativesplashscreenOnLoad.cpp
|
|
35
|
+
# Shared Nitrogen C++ sources
|
|
36
|
+
../nitrogen/generated/shared/c++/HybridReactNativeSplashScreenSpec.cpp
|
|
37
|
+
# Android-specific Nitrogen C++ sources
|
|
38
|
+
../nitrogen/generated/android/c++/JHybridReactNativeSplashScreenSpec.cpp
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
# From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake
|
|
42
|
+
# Used in node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake
|
|
43
|
+
target_compile_definitions(
|
|
44
|
+
reactnativesplashscreen PRIVATE
|
|
45
|
+
-DFOLLY_NO_CONFIG=1
|
|
46
|
+
-DFOLLY_HAVE_CLOCK_GETTIME=1
|
|
47
|
+
-DFOLLY_USE_LIBCPP=1
|
|
48
|
+
-DFOLLY_CFG_NO_COROUTINES=1
|
|
49
|
+
-DFOLLY_MOBILE=1
|
|
50
|
+
-DFOLLY_HAVE_RECVMMSG=1
|
|
51
|
+
-DFOLLY_HAVE_PTHREAD=1
|
|
52
|
+
# Once we target android-23 above, we can comment
|
|
53
|
+
# the following line. NDK uses GNU style stderror_r() after API 23.
|
|
54
|
+
-DFOLLY_HAVE_XSI_STRERROR_R=1
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
# Add all libraries required by the generated specs
|
|
58
|
+
find_package(fbjni REQUIRED) # <-- Used for communication between Java <-> C++
|
|
59
|
+
find_package(ReactAndroid REQUIRED) # <-- Used to set up React Native bindings (e.g. CallInvoker/TurboModule)
|
|
60
|
+
find_package(react-native-nitro-modules REQUIRED) # <-- Used to create all HybridObjects and use the Nitro core library
|
|
61
|
+
|
|
62
|
+
# Link all libraries together
|
|
63
|
+
target_link_libraries(
|
|
64
|
+
reactnativesplashscreen
|
|
65
|
+
fbjni::fbjni # <-- Facebook C++ JNI helpers
|
|
66
|
+
ReactAndroid::jsi # <-- RN: JSI
|
|
67
|
+
react-native-nitro-modules::NitroModules # <-- NitroModules Core :)
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
# Link react-native (different prefab between RN 0.75 and RN 0.76)
|
|
71
|
+
if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
|
|
72
|
+
target_link_libraries(
|
|
73
|
+
reactnativesplashscreen
|
|
74
|
+
ReactAndroid::reactnative # <-- RN: Native Modules umbrella prefab
|
|
75
|
+
)
|
|
76
|
+
else()
|
|
77
|
+
target_link_libraries(
|
|
78
|
+
reactnativesplashscreen
|
|
79
|
+
ReactAndroid::react_nativemodule_core # <-- RN: TurboModules Core
|
|
80
|
+
)
|
|
81
|
+
endif()
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// reactnativesplashscreen+autolinking.gradle
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
/// This is a Gradle file that adds all files generated by Nitrogen
|
|
9
|
+
/// to the current Gradle project.
|
|
10
|
+
///
|
|
11
|
+
/// To use it, add this to your build.gradle:
|
|
12
|
+
/// ```gradle
|
|
13
|
+
/// apply from: '../nitrogen/generated/android/reactnativesplashscreen+autolinking.gradle'
|
|
14
|
+
/// ```
|
|
15
|
+
|
|
16
|
+
logger.warn("[NitroModules] 🔥 reactnativesplashscreen is boosted by nitro!")
|
|
17
|
+
|
|
18
|
+
android {
|
|
19
|
+
sourceSets {
|
|
20
|
+
main {
|
|
21
|
+
java.srcDirs += [
|
|
22
|
+
// Nitrogen files
|
|
23
|
+
"${project.projectDir}/../nitrogen/generated/android/kotlin"
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// reactnativesplashscreenOnLoad.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#ifndef BUILDING_REACTNATIVESPLASHSCREEN_WITH_GENERATED_CMAKE_PROJECT
|
|
9
|
+
#error reactnativesplashscreenOnLoad.cpp is not being built with the autogenerated CMakeLists.txt project. Is a different CMakeLists.txt building this?
|
|
10
|
+
#endif
|
|
11
|
+
|
|
12
|
+
#include "reactnativesplashscreenOnLoad.hpp"
|
|
13
|
+
|
|
14
|
+
#include <jni.h>
|
|
15
|
+
#include <fbjni/fbjni.h>
|
|
16
|
+
#include <NitroModules/HybridObjectRegistry.hpp>
|
|
17
|
+
|
|
18
|
+
#include "JHybridReactNativeSplashScreenSpec.hpp"
|
|
19
|
+
#include <NitroModules/DefaultConstructableObject.hpp>
|
|
20
|
+
|
|
21
|
+
namespace margelo::nitro::reactnativesplashscreen {
|
|
22
|
+
|
|
23
|
+
int initialize(JavaVM* vm) {
|
|
24
|
+
using namespace margelo::nitro;
|
|
25
|
+
using namespace margelo::nitro::reactnativesplashscreen;
|
|
26
|
+
using namespace facebook;
|
|
27
|
+
|
|
28
|
+
return facebook::jni::initialize(vm, [] {
|
|
29
|
+
// Register native JNI methods
|
|
30
|
+
margelo::nitro::reactnativesplashscreen::JHybridReactNativeSplashScreenSpec::registerNatives();
|
|
31
|
+
|
|
32
|
+
// Register Nitro Hybrid Objects
|
|
33
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
34
|
+
"ReactNativeSplashScreen",
|
|
35
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
36
|
+
static DefaultConstructableObject<JHybridReactNativeSplashScreenSpec::javaobject> object("com/margelo/nitro/reactnativesplashscreen/ReactNativeSplashScreen");
|
|
37
|
+
auto instance = object.create();
|
|
38
|
+
return instance->cthis()->shared();
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
} // namespace margelo::nitro::reactnativesplashscreen
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// reactnativesplashscreenOnLoad.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include <jni.h>
|
|
9
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
10
|
+
|
|
11
|
+
namespace margelo::nitro::reactnativesplashscreen {
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Initializes the native (C++) part of reactnativesplashscreen, and autolinks all Hybrid Objects.
|
|
15
|
+
* Call this in your `JNI_OnLoad` function (probably inside `cpp-adapter.cpp`).
|
|
16
|
+
* Example:
|
|
17
|
+
* ```cpp (cpp-adapter.cpp)
|
|
18
|
+
* JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
|
|
19
|
+
* return margelo::nitro::reactnativesplashscreen::initialize(vm);
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
int initialize(JavaVM* vm);
|
|
24
|
+
|
|
25
|
+
} // namespace margelo::nitro::reactnativesplashscreen
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
#
|
|
2
|
+
# ReactNativeSplashScreen+autolinking.rb
|
|
3
|
+
# This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
# https://github.com/mrousavy/nitro
|
|
5
|
+
# Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
#
|
|
7
|
+
|
|
8
|
+
# This is a Ruby script that adds all files generated by Nitrogen
|
|
9
|
+
# to the given podspec.
|
|
10
|
+
#
|
|
11
|
+
# To use it, add this to your .podspec:
|
|
12
|
+
# ```ruby
|
|
13
|
+
# Pod::Spec.new do |spec|
|
|
14
|
+
# # ...
|
|
15
|
+
#
|
|
16
|
+
# # Add all files generated by Nitrogen
|
|
17
|
+
# load 'nitrogen/generated/ios/ReactNativeSplashScreen+autolinking.rb'
|
|
18
|
+
# add_nitrogen_files(spec)
|
|
19
|
+
# end
|
|
20
|
+
# ```
|
|
21
|
+
|
|
22
|
+
def add_nitrogen_files(spec)
|
|
23
|
+
Pod::UI.puts "[NitroModules] 🔥 ReactNativeSplashScreen is boosted by nitro!"
|
|
24
|
+
|
|
25
|
+
spec.dependency "NitroModules"
|
|
26
|
+
|
|
27
|
+
current_source_files = Array(spec.attributes_hash['source_files'])
|
|
28
|
+
spec.source_files = current_source_files + [
|
|
29
|
+
# Generated cross-platform specs
|
|
30
|
+
"nitrogen/generated/shared/**/*.{h,hpp,c,cpp,swift}",
|
|
31
|
+
# Generated bridges for the cross-platform specs
|
|
32
|
+
"nitrogen/generated/ios/**/*.{h,hpp,c,cpp,mm,swift}",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
current_public_header_files = Array(spec.attributes_hash['public_header_files'])
|
|
36
|
+
spec.public_header_files = current_public_header_files + [
|
|
37
|
+
# Generated specs
|
|
38
|
+
"nitrogen/generated/shared/**/*.{h,hpp}",
|
|
39
|
+
# Swift to C++ bridging helpers
|
|
40
|
+
"nitrogen/generated/ios/ReactNativeSplashScreen-Swift-Cxx-Bridge.hpp"
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
current_private_header_files = Array(spec.attributes_hash['private_header_files'])
|
|
44
|
+
spec.private_header_files = current_private_header_files + [
|
|
45
|
+
# iOS specific specs
|
|
46
|
+
"nitrogen/generated/ios/c++/**/*.{h,hpp}",
|
|
47
|
+
# Views are framework-specific and should be private
|
|
48
|
+
"nitrogen/generated/shared/**/views/**/*"
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
current_pod_target_xcconfig = spec.attributes_hash['pod_target_xcconfig'] || {}
|
|
52
|
+
spec.pod_target_xcconfig = current_pod_target_xcconfig.merge({
|
|
53
|
+
# Use C++ 20
|
|
54
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
|
|
55
|
+
# Enables C++ <-> Swift interop (by default it's only C)
|
|
56
|
+
"SWIFT_OBJC_INTEROP_MODE" => "objcxx",
|
|
57
|
+
# Enables stricter modular headers
|
|
58
|
+
"DEFINES_MODULE" => "YES",
|
|
59
|
+
})
|
|
60
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNativeSplashScreen-Swift-Cxx-Bridge.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "ReactNativeSplashScreen-Swift-Cxx-Bridge.hpp"
|
|
9
|
+
|
|
10
|
+
// Include C++ implementation defined types
|
|
11
|
+
#include "HybridReactNativeSplashScreenSpecSwift.hpp"
|
|
12
|
+
#include "ReactNativeSplashScreen-Swift-Cxx-Umbrella.hpp"
|
|
13
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::reactnativesplashscreen::bridge::swift {
|
|
16
|
+
|
|
17
|
+
// pragma MARK: std::function<void(bool /* result */)>
|
|
18
|
+
Func_void_bool create_Func_void_bool(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
19
|
+
auto swiftClosure = ReactNativeSplashScreen::Func_void_bool::fromUnsafe(swiftClosureWrapper);
|
|
20
|
+
return [swiftClosure = std::move(swiftClosure)](bool result) mutable -> void {
|
|
21
|
+
swiftClosure.call(result);
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
|
|
26
|
+
Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
27
|
+
auto swiftClosure = ReactNativeSplashScreen::Func_void_std__exception_ptr::fromUnsafe(swiftClosureWrapper);
|
|
28
|
+
return [swiftClosure = std::move(swiftClosure)](const std::exception_ptr& error) mutable -> void {
|
|
29
|
+
swiftClosure.call(error);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// pragma MARK: std::shared_ptr<HybridReactNativeSplashScreenSpec>
|
|
34
|
+
std::shared_ptr<HybridReactNativeSplashScreenSpec> create_std__shared_ptr_HybridReactNativeSplashScreenSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
35
|
+
ReactNativeSplashScreen::HybridReactNativeSplashScreenSpec_cxx swiftPart = ReactNativeSplashScreen::HybridReactNativeSplashScreenSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
36
|
+
return std::make_shared<margelo::nitro::reactnativesplashscreen::HybridReactNativeSplashScreenSpecSwift>(swiftPart);
|
|
37
|
+
}
|
|
38
|
+
void* NON_NULL get_std__shared_ptr_HybridReactNativeSplashScreenSpec_(std__shared_ptr_HybridReactNativeSplashScreenSpec_ cppType) {
|
|
39
|
+
std::shared_ptr<margelo::nitro::reactnativesplashscreen::HybridReactNativeSplashScreenSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::reactnativesplashscreen::HybridReactNativeSplashScreenSpecSwift>(cppType);
|
|
40
|
+
#ifdef NITRO_DEBUG
|
|
41
|
+
if (swiftWrapper == nullptr) [[unlikely]] {
|
|
42
|
+
throw std::runtime_error("Class \"HybridReactNativeSplashScreenSpec\" is not implemented in Swift!");
|
|
43
|
+
}
|
|
44
|
+
#endif
|
|
45
|
+
ReactNativeSplashScreen::HybridReactNativeSplashScreenSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
|
46
|
+
return swiftPart.toUnsafe();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
} // namespace margelo::nitro::reactnativesplashscreen::bridge::swift
|