react-native-screenshot-aware 1.2.2 → 1.3.1
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/README.md +6 -0
- package/android/generated/java/com/screenshotaware/NativeScreenshotAwareSpec.java +41 -0
- package/android/generated/jni/CMakeLists.txt +36 -0
- package/android/generated/jni/ScreenshotAwareSpec-generated.cpp +38 -0
- package/android/generated/jni/ScreenshotAwareSpec.h +31 -0
- package/android/generated/jni/react/renderer/components/ScreenshotAwareSpec/ScreenshotAwareSpecJSI-generated.cpp +36 -0
- package/android/generated/jni/react/renderer/components/ScreenshotAwareSpec/ScreenshotAwareSpecJSI.h +80 -0
- package/ios/generated/ScreenshotAwareSpec/ScreenshotAwareSpec-generated.mm +46 -0
- package/ios/generated/ScreenshotAwareSpec/ScreenshotAwareSpec.h +63 -0
- package/ios/generated/ScreenshotAwareSpecJSI-generated.cpp +36 -0
- package/ios/generated/ScreenshotAwareSpecJSI.h +80 -0
- package/lib/commonjs/codegenSpec/NativeScreenshotAware.ts +9 -0
- package/lib/module/codegenSpec/NativeScreenshotAware.ts +9 -0
- package/package.json +7 -6
- package/lib/commonjs/codegenSpec/NativeScreenshotAware.js +0 -9
- package/lib/commonjs/codegenSpec/NativeScreenshotAware.js.map +0 -1
- package/lib/module/codegenSpec/NativeScreenshotAware.js +0 -5
- package/lib/module/codegenSpec/NativeScreenshotAware.js.map +0 -1
package/README.md
CHANGED
|
@@ -19,6 +19,12 @@
|
|
|
19
19
|
- 📱 Supports Android 14+ (API level 34+) and iOS 14+
|
|
20
20
|
- 🏗️ Supports the new architecture for React Native
|
|
21
21
|
|
|
22
|
+
|
|
23
|
+
## Compatibility
|
|
24
|
+
|
|
25
|
+
- React Native <0.76, use version 1.2.2 or below 1.2.0 of this package (1.2.1 is buggy)
|
|
26
|
+
- React Native >=0.76, use version 1.3.0 or later
|
|
27
|
+
|
|
22
28
|
## Installation
|
|
23
29
|
|
|
24
30
|
```sh
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateModuleJavaSpec.js
|
|
9
|
+
*
|
|
10
|
+
* @nolint
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
package com.screenshotaware;
|
|
14
|
+
|
|
15
|
+
import com.facebook.proguard.annotations.DoNotStrip;
|
|
16
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
17
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
18
|
+
import com.facebook.react.bridge.ReactMethod;
|
|
19
|
+
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
|
|
20
|
+
import javax.annotation.Nonnull;
|
|
21
|
+
|
|
22
|
+
public abstract class NativeScreenshotAwareSpec extends ReactContextBaseJavaModule implements TurboModule {
|
|
23
|
+
public static final String NAME = "ScreenshotAware";
|
|
24
|
+
|
|
25
|
+
public NativeScreenshotAwareSpec(ReactApplicationContext reactContext) {
|
|
26
|
+
super(reactContext);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@Override
|
|
30
|
+
public @Nonnull String getName() {
|
|
31
|
+
return NAME;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@ReactMethod
|
|
35
|
+
@DoNotStrip
|
|
36
|
+
public abstract void addListener(String eventName);
|
|
37
|
+
|
|
38
|
+
@ReactMethod
|
|
39
|
+
@DoNotStrip
|
|
40
|
+
public abstract void removeListeners(double count);
|
|
41
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
#
|
|
3
|
+
# This source code is licensed under the MIT license found in the
|
|
4
|
+
# LICENSE file in the root directory of this source tree.
|
|
5
|
+
|
|
6
|
+
cmake_minimum_required(VERSION 3.13)
|
|
7
|
+
set(CMAKE_VERBOSE_MAKEFILE on)
|
|
8
|
+
|
|
9
|
+
file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/ScreenshotAwareSpec/*.cpp)
|
|
10
|
+
|
|
11
|
+
add_library(
|
|
12
|
+
react_codegen_ScreenshotAwareSpec
|
|
13
|
+
OBJECT
|
|
14
|
+
${react_codegen_SRCS}
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
target_include_directories(react_codegen_ScreenshotAwareSpec PUBLIC . react/renderer/components/ScreenshotAwareSpec)
|
|
18
|
+
|
|
19
|
+
target_link_libraries(
|
|
20
|
+
react_codegen_ScreenshotAwareSpec
|
|
21
|
+
fbjni
|
|
22
|
+
jsi
|
|
23
|
+
# We need to link different libraries based on whether we are building rncore or not, that's necessary
|
|
24
|
+
# because we want to break a circular dependency between react_codegen_rncore and reactnative
|
|
25
|
+
reactnative
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
target_compile_options(
|
|
29
|
+
react_codegen_ScreenshotAwareSpec
|
|
30
|
+
PRIVATE
|
|
31
|
+
-DLOG_TAG=\"ReactNative\"
|
|
32
|
+
-fexceptions
|
|
33
|
+
-frtti
|
|
34
|
+
-std=c++20
|
|
35
|
+
-Wall
|
|
36
|
+
)
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateModuleJniCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include "ScreenshotAwareSpec.h"
|
|
12
|
+
|
|
13
|
+
namespace facebook::react {
|
|
14
|
+
|
|
15
|
+
static facebook::jsi::Value __hostFunction_NativeScreenshotAwareSpecJSI_addListener(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
16
|
+
static jmethodID cachedMethodId = nullptr;
|
|
17
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "addListener", "(Ljava/lang/String;)V", args, count, cachedMethodId);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static facebook::jsi::Value __hostFunction_NativeScreenshotAwareSpecJSI_removeListeners(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
21
|
+
static jmethodID cachedMethodId = nullptr;
|
|
22
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "removeListeners", "(D)V", args, count, cachedMethodId);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
NativeScreenshotAwareSpecJSI::NativeScreenshotAwareSpecJSI(const JavaTurboModule::InitParams ¶ms)
|
|
26
|
+
: JavaTurboModule(params) {
|
|
27
|
+
methodMap_["addListener"] = MethodMetadata {1, __hostFunction_NativeScreenshotAwareSpecJSI_addListener};
|
|
28
|
+
methodMap_["removeListeners"] = MethodMetadata {1, __hostFunction_NativeScreenshotAwareSpecJSI_removeListeners};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
std::shared_ptr<TurboModule> ScreenshotAwareSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms) {
|
|
32
|
+
if (moduleName == "ScreenshotAware") {
|
|
33
|
+
return std::make_shared<NativeScreenshotAwareSpecJSI>(params);
|
|
34
|
+
}
|
|
35
|
+
return nullptr;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateModuleJniH.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#pragma once
|
|
12
|
+
|
|
13
|
+
#include <ReactCommon/JavaTurboModule.h>
|
|
14
|
+
#include <ReactCommon/TurboModule.h>
|
|
15
|
+
#include <jsi/jsi.h>
|
|
16
|
+
|
|
17
|
+
namespace facebook::react {
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* JNI C++ class for module 'NativeScreenshotAware'
|
|
21
|
+
*/
|
|
22
|
+
class JSI_EXPORT NativeScreenshotAwareSpecJSI : public JavaTurboModule {
|
|
23
|
+
public:
|
|
24
|
+
NativeScreenshotAwareSpecJSI(const JavaTurboModule::InitParams ¶ms);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
JSI_EXPORT
|
|
29
|
+
std::shared_ptr<TurboModule> ScreenshotAwareSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms);
|
|
30
|
+
|
|
31
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateModuleCpp.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#include "ScreenshotAwareSpecJSI.h"
|
|
11
|
+
|
|
12
|
+
namespace facebook::react {
|
|
13
|
+
|
|
14
|
+
static jsi::Value __hostFunction_NativeScreenshotAwareCxxSpecJSI_addListener(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
15
|
+
static_cast<NativeScreenshotAwareCxxSpecJSI *>(&turboModule)->addListener(
|
|
16
|
+
rt,
|
|
17
|
+
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt)
|
|
18
|
+
);
|
|
19
|
+
return jsi::Value::undefined();
|
|
20
|
+
}
|
|
21
|
+
static jsi::Value __hostFunction_NativeScreenshotAwareCxxSpecJSI_removeListeners(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
22
|
+
static_cast<NativeScreenshotAwareCxxSpecJSI *>(&turboModule)->removeListeners(
|
|
23
|
+
rt,
|
|
24
|
+
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asNumber()
|
|
25
|
+
);
|
|
26
|
+
return jsi::Value::undefined();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
NativeScreenshotAwareCxxSpecJSI::NativeScreenshotAwareCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
|
|
30
|
+
: TurboModule("ScreenshotAware", jsInvoker) {
|
|
31
|
+
methodMap_["addListener"] = MethodMetadata {1, __hostFunction_NativeScreenshotAwareCxxSpecJSI_addListener};
|
|
32
|
+
methodMap_["removeListeners"] = MethodMetadata {1, __hostFunction_NativeScreenshotAwareCxxSpecJSI_removeListeners};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
} // namespace facebook::react
|
package/android/generated/jni/react/renderer/components/ScreenshotAwareSpec/ScreenshotAwareSpecJSI.h
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateModuleH.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
#include <ReactCommon/TurboModule.h>
|
|
13
|
+
#include <react/bridging/Bridging.h>
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class JSI_EXPORT NativeScreenshotAwareCxxSpecJSI : public TurboModule {
|
|
19
|
+
protected:
|
|
20
|
+
NativeScreenshotAwareCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
21
|
+
|
|
22
|
+
public:
|
|
23
|
+
virtual void addListener(jsi::Runtime &rt, jsi::String eventName) = 0;
|
|
24
|
+
virtual void removeListeners(jsi::Runtime &rt, double count) = 0;
|
|
25
|
+
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
template <typename T>
|
|
29
|
+
class JSI_EXPORT NativeScreenshotAwareCxxSpec : public TurboModule {
|
|
30
|
+
public:
|
|
31
|
+
jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
32
|
+
return delegate_.create(rt, propName);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
|
|
36
|
+
return delegate_.getPropertyNames(runtime);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
static constexpr std::string_view kModuleName = "ScreenshotAware";
|
|
40
|
+
|
|
41
|
+
protected:
|
|
42
|
+
NativeScreenshotAwareCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
43
|
+
: TurboModule(std::string{NativeScreenshotAwareCxxSpec::kModuleName}, jsInvoker),
|
|
44
|
+
delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
private:
|
|
48
|
+
class Delegate : public NativeScreenshotAwareCxxSpecJSI {
|
|
49
|
+
public:
|
|
50
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
51
|
+
NativeScreenshotAwareCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
|
|
52
|
+
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
void addListener(jsi::Runtime &rt, jsi::String eventName) override {
|
|
56
|
+
static_assert(
|
|
57
|
+
bridging::getParameterCount(&T::addListener) == 2,
|
|
58
|
+
"Expected addListener(...) to have 2 parameters");
|
|
59
|
+
|
|
60
|
+
return bridging::callFromJs<void>(
|
|
61
|
+
rt, &T::addListener, jsInvoker_, instance_, std::move(eventName));
|
|
62
|
+
}
|
|
63
|
+
void removeListeners(jsi::Runtime &rt, double count) override {
|
|
64
|
+
static_assert(
|
|
65
|
+
bridging::getParameterCount(&T::removeListeners) == 2,
|
|
66
|
+
"Expected removeListeners(...) to have 2 parameters");
|
|
67
|
+
|
|
68
|
+
return bridging::callFromJs<void>(
|
|
69
|
+
rt, &T::removeListeners, jsInvoker_, instance_, std::move(count));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
private:
|
|
73
|
+
friend class NativeScreenshotAwareCxxSpec;
|
|
74
|
+
T *instance_;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
Delegate delegate_;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateModuleObjCpp
|
|
8
|
+
*
|
|
9
|
+
* We create an umbrella header (and corresponding implementation) here since
|
|
10
|
+
* Cxx compilation in BUCK has a limitation: source-code producing genrule()s
|
|
11
|
+
* must have a single output. More files => more genrule()s => slower builds.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
#import "ScreenshotAwareSpec.h"
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@implementation NativeScreenshotAwareSpecBase
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
- (void)setEventEmitterCallback:(EventEmitterCallbackWrapper *)eventEmitterCallbackWrapper
|
|
21
|
+
{
|
|
22
|
+
_eventEmitterCallback = std::move(eventEmitterCallbackWrapper->_eventEmitterCallback);
|
|
23
|
+
}
|
|
24
|
+
@end
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
namespace facebook::react {
|
|
28
|
+
|
|
29
|
+
static facebook::jsi::Value __hostFunction_NativeScreenshotAwareSpecJSI_addListener(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
30
|
+
return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, VoidKind, "addListener", @selector(addListener:), args, count);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
static facebook::jsi::Value __hostFunction_NativeScreenshotAwareSpecJSI_removeListeners(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
34
|
+
return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, VoidKind, "removeListeners", @selector(removeListeners:), args, count);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
NativeScreenshotAwareSpecJSI::NativeScreenshotAwareSpecJSI(const ObjCTurboModule::InitParams ¶ms)
|
|
38
|
+
: ObjCTurboModule(params) {
|
|
39
|
+
|
|
40
|
+
methodMap_["addListener"] = MethodMetadata {1, __hostFunction_NativeScreenshotAwareSpecJSI_addListener};
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
methodMap_["removeListeners"] = MethodMetadata {1, __hostFunction_NativeScreenshotAwareSpecJSI_removeListeners};
|
|
44
|
+
|
|
45
|
+
}
|
|
46
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateModuleObjCpp
|
|
8
|
+
*
|
|
9
|
+
* We create an umbrella header (and corresponding implementation) here since
|
|
10
|
+
* Cxx compilation in BUCK has a limitation: source-code producing genrule()s
|
|
11
|
+
* must have a single output. More files => more genrule()s => slower builds.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
#ifndef __cplusplus
|
|
15
|
+
#error This file must be compiled as Obj-C++. If you are importing it, you must change your file extension to .mm.
|
|
16
|
+
#endif
|
|
17
|
+
|
|
18
|
+
// Avoid multiple includes of ScreenshotAwareSpec symbols
|
|
19
|
+
#ifndef ScreenshotAwareSpec_H
|
|
20
|
+
#define ScreenshotAwareSpec_H
|
|
21
|
+
|
|
22
|
+
#import <Foundation/Foundation.h>
|
|
23
|
+
#import <RCTRequired/RCTRequired.h>
|
|
24
|
+
#import <RCTTypeSafety/RCTConvertHelpers.h>
|
|
25
|
+
#import <RCTTypeSafety/RCTTypedModuleConstants.h>
|
|
26
|
+
#import <React/RCTBridgeModule.h>
|
|
27
|
+
#import <React/RCTCxxConvert.h>
|
|
28
|
+
#import <React/RCTManagedPointer.h>
|
|
29
|
+
#import <ReactCommon/RCTTurboModule.h>
|
|
30
|
+
#import <optional>
|
|
31
|
+
#import <vector>
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
35
|
+
|
|
36
|
+
@protocol NativeScreenshotAwareSpec <RCTBridgeModule, RCTTurboModule>
|
|
37
|
+
|
|
38
|
+
- (void)addListener:(NSString *)eventName;
|
|
39
|
+
- (void)removeListeners:(double)count;
|
|
40
|
+
|
|
41
|
+
@end
|
|
42
|
+
|
|
43
|
+
@interface NativeScreenshotAwareSpecBase : NSObject {
|
|
44
|
+
@protected
|
|
45
|
+
facebook::react::EventEmitterCallback _eventEmitterCallback;
|
|
46
|
+
}
|
|
47
|
+
- (void)setEventEmitterCallback:(EventEmitterCallbackWrapper *)eventEmitterCallbackWrapper;
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@end
|
|
51
|
+
|
|
52
|
+
namespace facebook::react {
|
|
53
|
+
/**
|
|
54
|
+
* ObjC++ class for module 'NativeScreenshotAware'
|
|
55
|
+
*/
|
|
56
|
+
class JSI_EXPORT NativeScreenshotAwareSpecJSI : public ObjCTurboModule {
|
|
57
|
+
public:
|
|
58
|
+
NativeScreenshotAwareSpecJSI(const ObjCTurboModule::InitParams ¶ms);
|
|
59
|
+
};
|
|
60
|
+
} // namespace facebook::react
|
|
61
|
+
|
|
62
|
+
NS_ASSUME_NONNULL_END
|
|
63
|
+
#endif // ScreenshotAwareSpec_H
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateModuleCpp.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#include "ScreenshotAwareSpecJSI.h"
|
|
11
|
+
|
|
12
|
+
namespace facebook::react {
|
|
13
|
+
|
|
14
|
+
static jsi::Value __hostFunction_NativeScreenshotAwareCxxSpecJSI_addListener(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
15
|
+
static_cast<NativeScreenshotAwareCxxSpecJSI *>(&turboModule)->addListener(
|
|
16
|
+
rt,
|
|
17
|
+
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt)
|
|
18
|
+
);
|
|
19
|
+
return jsi::Value::undefined();
|
|
20
|
+
}
|
|
21
|
+
static jsi::Value __hostFunction_NativeScreenshotAwareCxxSpecJSI_removeListeners(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
22
|
+
static_cast<NativeScreenshotAwareCxxSpecJSI *>(&turboModule)->removeListeners(
|
|
23
|
+
rt,
|
|
24
|
+
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asNumber()
|
|
25
|
+
);
|
|
26
|
+
return jsi::Value::undefined();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
NativeScreenshotAwareCxxSpecJSI::NativeScreenshotAwareCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
|
|
30
|
+
: TurboModule("ScreenshotAware", jsInvoker) {
|
|
31
|
+
methodMap_["addListener"] = MethodMetadata {1, __hostFunction_NativeScreenshotAwareCxxSpecJSI_addListener};
|
|
32
|
+
methodMap_["removeListeners"] = MethodMetadata {1, __hostFunction_NativeScreenshotAwareCxxSpecJSI_removeListeners};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateModuleH.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
#include <ReactCommon/TurboModule.h>
|
|
13
|
+
#include <react/bridging/Bridging.h>
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class JSI_EXPORT NativeScreenshotAwareCxxSpecJSI : public TurboModule {
|
|
19
|
+
protected:
|
|
20
|
+
NativeScreenshotAwareCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
21
|
+
|
|
22
|
+
public:
|
|
23
|
+
virtual void addListener(jsi::Runtime &rt, jsi::String eventName) = 0;
|
|
24
|
+
virtual void removeListeners(jsi::Runtime &rt, double count) = 0;
|
|
25
|
+
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
template <typename T>
|
|
29
|
+
class JSI_EXPORT NativeScreenshotAwareCxxSpec : public TurboModule {
|
|
30
|
+
public:
|
|
31
|
+
jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
32
|
+
return delegate_.create(rt, propName);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
|
|
36
|
+
return delegate_.getPropertyNames(runtime);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
static constexpr std::string_view kModuleName = "ScreenshotAware";
|
|
40
|
+
|
|
41
|
+
protected:
|
|
42
|
+
NativeScreenshotAwareCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
43
|
+
: TurboModule(std::string{NativeScreenshotAwareCxxSpec::kModuleName}, jsInvoker),
|
|
44
|
+
delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
private:
|
|
48
|
+
class Delegate : public NativeScreenshotAwareCxxSpecJSI {
|
|
49
|
+
public:
|
|
50
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
51
|
+
NativeScreenshotAwareCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
|
|
52
|
+
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
void addListener(jsi::Runtime &rt, jsi::String eventName) override {
|
|
56
|
+
static_assert(
|
|
57
|
+
bridging::getParameterCount(&T::addListener) == 2,
|
|
58
|
+
"Expected addListener(...) to have 2 parameters");
|
|
59
|
+
|
|
60
|
+
return bridging::callFromJs<void>(
|
|
61
|
+
rt, &T::addListener, jsInvoker_, instance_, std::move(eventName));
|
|
62
|
+
}
|
|
63
|
+
void removeListeners(jsi::Runtime &rt, double count) override {
|
|
64
|
+
static_assert(
|
|
65
|
+
bridging::getParameterCount(&T::removeListeners) == 2,
|
|
66
|
+
"Expected removeListeners(...) to have 2 parameters");
|
|
67
|
+
|
|
68
|
+
return bridging::callFromJs<void>(
|
|
69
|
+
rt, &T::removeListeners, jsInvoker_, instance_, std::move(count));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
private:
|
|
73
|
+
friend class NativeScreenshotAwareCxxSpec;
|
|
74
|
+
T *instance_;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
Delegate delegate_;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TurboModule } from "react-native";
|
|
2
|
+
import { TurboModuleRegistry } from "react-native";
|
|
3
|
+
|
|
4
|
+
export interface Spec extends TurboModule {
|
|
5
|
+
addListener(eventName: string): void;
|
|
6
|
+
removeListeners(count: number): void;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export default TurboModuleRegistry.getEnforcing<Spec>("ScreenshotAware");
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TurboModule } from "react-native";
|
|
2
|
+
import { TurboModuleRegistry } from "react-native";
|
|
3
|
+
|
|
4
|
+
export interface Spec extends TurboModule {
|
|
5
|
+
addListener(eventName: string): void;
|
|
6
|
+
removeListeners(count: number): void;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export default TurboModuleRegistry.getEnforcing<Spec>("ScreenshotAware");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-screenshot-aware",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "React Native module for real-time screenshot detection on Android and iOS",
|
|
5
5
|
"source": "src/index.tsx",
|
|
6
6
|
"main": "lib/commonjs/index.js",
|
|
@@ -75,10 +75,10 @@
|
|
|
75
75
|
"expo": "^52.0.37",
|
|
76
76
|
"husky": "9.1.7",
|
|
77
77
|
"jest": "29.7.0",
|
|
78
|
-
"react": "19.
|
|
78
|
+
"react": "19.1.0",
|
|
79
79
|
"react-native": "0.78.1",
|
|
80
|
-
"react-native-builder-bob": "0.38.
|
|
81
|
-
"react-test-renderer": "19.
|
|
80
|
+
"react-native-builder-bob": "0.38.4",
|
|
81
|
+
"react-test-renderer": "19.1.0",
|
|
82
82
|
"semantic-release": "24.2.3",
|
|
83
83
|
"turbo": "2.4.4",
|
|
84
84
|
"typescript": "5.8.2"
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
},
|
|
89
89
|
"peerDependencies": {
|
|
90
90
|
"react": "*",
|
|
91
|
-
"react-native": "
|
|
91
|
+
"react-native": ">=0.76"
|
|
92
92
|
},
|
|
93
93
|
"peerDependenciesMeta": {
|
|
94
94
|
"expo": {
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"workspaces": [
|
|
99
99
|
"example"
|
|
100
100
|
],
|
|
101
|
-
"packageManager": "yarn@4.
|
|
101
|
+
"packageManager": "yarn@4.8.0",
|
|
102
102
|
"jest": {
|
|
103
103
|
"preset": "react-native",
|
|
104
104
|
"modulePathIgnorePatterns": [
|
|
@@ -135,6 +135,7 @@
|
|
|
135
135
|
"source": "src",
|
|
136
136
|
"output": "lib",
|
|
137
137
|
"targets": [
|
|
138
|
+
"codegen",
|
|
138
139
|
"commonjs",
|
|
139
140
|
"module",
|
|
140
141
|
"typescript"
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _reactNative = require("react-native");
|
|
8
|
-
var _default = exports.default = _reactNative.TurboModuleRegistry.getEnforcing("ScreenshotAware");
|
|
9
|
-
//# sourceMappingURL=NativeScreenshotAware.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../../src","sources":["codegenSpec/NativeScreenshotAware.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAAmD,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAOpCC,gCAAmB,CAACC,YAAY,CAAO,iBAAiB,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../../src","sources":["codegenSpec/NativeScreenshotAware.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;AAOlD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,iBAAiB,CAAC","ignoreList":[]}
|