@azzapp/react-native-snapshot-view 0.1.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/LICENSE +20 -0
- package/README.md +39 -0
- package/android/build.gradle +126 -0
- package/android/generated/java/com/azzapp/rnsnapshotview/NativeRNSnapshotViewSpec.java +42 -0
- package/android/generated/java/com/facebook/react/viewmanagers/RNSnapshotRendererManagerDelegate.java +31 -0
- package/android/generated/java/com/facebook/react/viewmanagers/RNSnapshotRendererManagerInterface.java +17 -0
- package/android/generated/jni/CMakeLists.txt +49 -0
- package/android/generated/jni/RNSnapshotViewSpec-generated.cpp +38 -0
- package/android/generated/jni/RNSnapshotViewSpec.h +31 -0
- package/android/generated/jni/react/renderer/components/RNSnapshotViewSpec/ComponentDescriptors.cpp +22 -0
- package/android/generated/jni/react/renderer/components/RNSnapshotViewSpec/ComponentDescriptors.h +24 -0
- package/android/generated/jni/react/renderer/components/RNSnapshotViewSpec/EventEmitters.cpp +16 -0
- package/android/generated/jni/react/renderer/components/RNSnapshotViewSpec/EventEmitters.h +23 -0
- package/android/generated/jni/react/renderer/components/RNSnapshotViewSpec/Props.cpp +25 -0
- package/android/generated/jni/react/renderer/components/RNSnapshotViewSpec/Props.h +27 -0
- package/android/generated/jni/react/renderer/components/RNSnapshotViewSpec/RNSnapshotViewSpecJSI-generated.cpp +34 -0
- package/android/generated/jni/react/renderer/components/RNSnapshotViewSpec/RNSnapshotViewSpecJSI.h +76 -0
- package/android/generated/jni/react/renderer/components/RNSnapshotViewSpec/ShadowNodes.cpp +17 -0
- package/android/generated/jni/react/renderer/components/RNSnapshotViewSpec/ShadowNodes.h +32 -0
- package/android/generated/jni/react/renderer/components/RNSnapshotViewSpec/States.cpp +16 -0
- package/android/generated/jni/react/renderer/components/RNSnapshotViewSpec/States.h +29 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/azzapp/rnsnapshotview/RNSnapshotRenderer.kt +27 -0
- package/android/src/main/java/com/azzapp/rnsnapshotview/RNSnapshotRendererManager.kt +28 -0
- package/android/src/main/java/com/azzapp/rnsnapshotview/ReactNativeSnapshotViewModule.kt +222 -0
- package/android/src/main/java/com/azzapp/rnsnapshotview/ReactNativeSnapshotViewPackage.kt +42 -0
- package/android/src/newarch/RNSnapshotRendererManagerSpec.kt +21 -0
- package/android/src/newarch/RNSnapshotViewSpec.kt +7 -0
- package/android/src/oldarch/RNSnapshotRendererManagerSpec.kt +9 -0
- package/android/src/oldarch/RNSnapshotViewSpec.kt +12 -0
- package/azzapp-react-native-snapshot-view.podspec +42 -0
- package/ios/RNSnapshotRenderer.h +17 -0
- package/ios/RNSnapshotRenderer.mm +61 -0
- package/ios/RNSnapshotRendererManager.mm +62 -0
- package/ios/RNSnapshotView.h +15 -0
- package/ios/RNSnapshotView.mm +71 -0
- package/ios/generated/RNSnapshotViewSpec/ComponentDescriptors.cpp +22 -0
- package/ios/generated/RNSnapshotViewSpec/ComponentDescriptors.h +24 -0
- package/ios/generated/RNSnapshotViewSpec/EventEmitters.cpp +16 -0
- package/ios/generated/RNSnapshotViewSpec/EventEmitters.h +23 -0
- package/ios/generated/RNSnapshotViewSpec/Props.cpp +25 -0
- package/ios/generated/RNSnapshotViewSpec/Props.h +27 -0
- package/ios/generated/RNSnapshotViewSpec/RCTComponentViewHelpers.h +20 -0
- package/ios/generated/RNSnapshotViewSpec/RNSnapshotViewSpec-generated.mm +36 -0
- package/ios/generated/RNSnapshotViewSpec/RNSnapshotViewSpec.h +54 -0
- package/ios/generated/RNSnapshotViewSpec/ShadowNodes.cpp +17 -0
- package/ios/generated/RNSnapshotViewSpec/ShadowNodes.h +32 -0
- package/ios/generated/RNSnapshotViewSpec/States.cpp +16 -0
- package/ios/generated/RNSnapshotViewSpec/States.h +29 -0
- package/ios/generated/RNSnapshotViewSpecJSI-generated.cpp +34 -0
- package/ios/generated/RNSnapshotViewSpecJSI.h +76 -0
- package/lib/commonjs/NativeRNSnapshotView.js +9 -0
- package/lib/commonjs/NativeRNSnapshotView.js.map +1 -0
- package/lib/commonjs/RNSnapshotRendererNativeComponent.js +10 -0
- package/lib/commonjs/RNSnapshotRendererNativeComponent.js.map +1 -0
- package/lib/commonjs/SnapshotRenderer.js +36 -0
- package/lib/commonjs/SnapshotRenderer.js.map +1 -0
- package/lib/commonjs/index.js +54 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/module/NativeRNSnapshotView.js +5 -0
- package/lib/module/NativeRNSnapshotView.js.map +1 -0
- package/lib/module/RNSnapshotRendererNativeComponent.js +5 -0
- package/lib/module/RNSnapshotRendererNativeComponent.js.map +1 -0
- package/lib/module/SnapshotRenderer.js +31 -0
- package/lib/module/SnapshotRenderer.js.map +1 -0
- package/lib/module/index.js +42 -0
- package/lib/module/index.js.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/NativeRNSnapshotView.d.ts +8 -0
- package/lib/typescript/commonjs/src/NativeRNSnapshotView.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/RNSnapshotRendererNativeComponent.d.ts +7 -0
- package/lib/typescript/commonjs/src/RNSnapshotRendererNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/SnapshotRenderer.d.ts +27 -0
- package/lib/typescript/commonjs/src/SnapshotRenderer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +16 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/NativeRNSnapshotView.d.ts +8 -0
- package/lib/typescript/module/src/NativeRNSnapshotView.d.ts.map +1 -0
- package/lib/typescript/module/src/RNSnapshotRendererNativeComponent.d.ts +7 -0
- package/lib/typescript/module/src/RNSnapshotRendererNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/SnapshotRenderer.d.ts +27 -0
- package/lib/typescript/module/src/SnapshotRenderer.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +16 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/package.json +202 -0
- package/src/NativeRNSnapshotView.ts +9 -0
- package/src/RNSnapshotRendererNativeComponent.ts +8 -0
- package/src/SnapshotRenderer.tsx +44 -0
- package/src/index.tsx +57 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 François de Campredon
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# @azzapp/react-native-snapshot-view
|
|
2
|
+
|
|
3
|
+
Snapshot view for react-native
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install @azzapp/react-native-snapshot-view
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
import { captureSnapshot, SnapshotRenderer } from "@azzapp/react-native-snapshot-view";
|
|
16
|
+
|
|
17
|
+
// capture a snapshot of a view
|
|
18
|
+
const snapshotID = await captureSnapshot(viewRef.current);
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
// Display the captured snapshot
|
|
22
|
+
|
|
23
|
+
<SnapshotRenderer snapshotID={snapshotID} />
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
>:warning: captured snapshot are kept in memory, either use `releaseSnapshot` to release them, or let the `SnapshotRenderer` component release the snapshot on unmount.
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## Contributing
|
|
30
|
+
|
|
31
|
+
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
|
|
32
|
+
|
|
33
|
+
## License
|
|
34
|
+
|
|
35
|
+
MIT
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
// Buildscript is evaluated before everything else so we can't use getExtOrDefault
|
|
3
|
+
def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["ReactNativeSnapshotView_kotlinVersion"]
|
|
4
|
+
|
|
5
|
+
repositories {
|
|
6
|
+
google()
|
|
7
|
+
mavenCentral()
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
dependencies {
|
|
11
|
+
classpath "com.android.tools.build:gradle:7.2.1"
|
|
12
|
+
// noinspection DifferentKotlinGradleVersion
|
|
13
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
def reactNativeArchitectures() {
|
|
18
|
+
def value = rootProject.getProperties().get("reactNativeArchitectures")
|
|
19
|
+
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
def isNewArchitectureEnabled() {
|
|
23
|
+
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
apply plugin: "com.android.library"
|
|
27
|
+
apply plugin: "kotlin-android"
|
|
28
|
+
|
|
29
|
+
if (isNewArchitectureEnabled()) {
|
|
30
|
+
apply plugin: "com.facebook.react"
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
def getExtOrDefault(name) {
|
|
34
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["ReactNativeSnapshotView_" + name]
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
def getExtOrIntegerDefault(name) {
|
|
38
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["ReactNativeSnapshotView_" + name]).toInteger()
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
def supportsNamespace() {
|
|
42
|
+
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
|
|
43
|
+
def major = parsed[0].toInteger()
|
|
44
|
+
def minor = parsed[1].toInteger()
|
|
45
|
+
|
|
46
|
+
// Namespace support was added in 7.3.0
|
|
47
|
+
return (major == 7 && minor >= 3) || major >= 8
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
android {
|
|
51
|
+
if (supportsNamespace()) {
|
|
52
|
+
namespace "com.azzapp.rnsnapshotview"
|
|
53
|
+
|
|
54
|
+
sourceSets {
|
|
55
|
+
main {
|
|
56
|
+
manifest.srcFile "src/main/AndroidManifestNew.xml"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
62
|
+
|
|
63
|
+
defaultConfig {
|
|
64
|
+
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
65
|
+
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
66
|
+
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
67
|
+
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
buildFeatures {
|
|
71
|
+
buildConfig true
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
buildTypes {
|
|
75
|
+
release {
|
|
76
|
+
minifyEnabled false
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
lintOptions {
|
|
81
|
+
disable "GradleCompatible"
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
compileOptions {
|
|
85
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
86
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
sourceSets {
|
|
90
|
+
main {
|
|
91
|
+
if (isNewArchitectureEnabled()) {
|
|
92
|
+
java.srcDirs += [
|
|
93
|
+
"src/newarch",
|
|
94
|
+
// Codegen specs
|
|
95
|
+
"generated/java",
|
|
96
|
+
"generated/jni"
|
|
97
|
+
]
|
|
98
|
+
} else {
|
|
99
|
+
java.srcDirs += ["src/oldarch"]
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
repositories {
|
|
106
|
+
mavenCentral()
|
|
107
|
+
google()
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
111
|
+
|
|
112
|
+
dependencies {
|
|
113
|
+
// For < 0.71, this will be from the local maven repo
|
|
114
|
+
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
|
|
115
|
+
//noinspection GradleDynamicVersion
|
|
116
|
+
implementation "com.facebook.react:react-native:+"
|
|
117
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (isNewArchitectureEnabled()) {
|
|
121
|
+
react {
|
|
122
|
+
jsRootDir = file("../src/")
|
|
123
|
+
libraryName = "ReactNativeSnapshotViewView"
|
|
124
|
+
codegenJavaPackageName = "com.azzapp.rnsnapshotview"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
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.azzapp.rnsnapshotview;
|
|
14
|
+
|
|
15
|
+
import com.facebook.proguard.annotations.DoNotStrip;
|
|
16
|
+
import com.facebook.react.bridge.Promise;
|
|
17
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
18
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
19
|
+
import com.facebook.react.bridge.ReactMethod;
|
|
20
|
+
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
|
|
21
|
+
import javax.annotation.Nonnull;
|
|
22
|
+
|
|
23
|
+
public abstract class NativeRNSnapshotViewSpec extends ReactContextBaseJavaModule implements TurboModule {
|
|
24
|
+
public static final String NAME = "RNSnapshotView";
|
|
25
|
+
|
|
26
|
+
public NativeRNSnapshotViewSpec(ReactApplicationContext reactContext) {
|
|
27
|
+
super(reactContext);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@Override
|
|
31
|
+
public @Nonnull String getName() {
|
|
32
|
+
return NAME;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@ReactMethod
|
|
36
|
+
@DoNotStrip
|
|
37
|
+
public abstract void captureSnapshot(double target, Promise promise);
|
|
38
|
+
|
|
39
|
+
@ReactMethod
|
|
40
|
+
@DoNotStrip
|
|
41
|
+
public abstract void releaseSnapshot(String a, Promise promise);
|
|
42
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
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: GeneratePropsJavaDelegate.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
package com.facebook.react.viewmanagers;
|
|
11
|
+
|
|
12
|
+
import android.view.View;
|
|
13
|
+
import androidx.annotation.Nullable;
|
|
14
|
+
import com.facebook.react.uimanager.BaseViewManagerDelegate;
|
|
15
|
+
import com.facebook.react.uimanager.BaseViewManagerInterface;
|
|
16
|
+
|
|
17
|
+
public class RNSnapshotRendererManagerDelegate<T extends View, U extends BaseViewManagerInterface<T> & RNSnapshotRendererManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
|
|
18
|
+
public RNSnapshotRendererManagerDelegate(U viewManager) {
|
|
19
|
+
super(viewManager);
|
|
20
|
+
}
|
|
21
|
+
@Override
|
|
22
|
+
public void setProperty(T view, String propName, @Nullable Object value) {
|
|
23
|
+
switch (propName) {
|
|
24
|
+
case "snapshotID":
|
|
25
|
+
mViewManager.setSnapshotID(view, value == null ? null : (String) value);
|
|
26
|
+
break;
|
|
27
|
+
default:
|
|
28
|
+
super.setProperty(view, propName, value);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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: GeneratePropsJavaInterface.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
package com.facebook.react.viewmanagers;
|
|
11
|
+
|
|
12
|
+
import android.view.View;
|
|
13
|
+
import androidx.annotation.Nullable;
|
|
14
|
+
|
|
15
|
+
public interface RNSnapshotRendererManagerInterface<T extends View> {
|
|
16
|
+
void setSnapshotID(T view, @Nullable String value);
|
|
17
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
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/RNSnapshotViewSpec/*.cpp)
|
|
10
|
+
|
|
11
|
+
add_library(
|
|
12
|
+
react_codegen_RNSnapshotViewSpec
|
|
13
|
+
SHARED
|
|
14
|
+
${react_codegen_SRCS}
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
target_include_directories(react_codegen_RNSnapshotViewSpec PUBLIC . react/renderer/components/RNSnapshotViewSpec)
|
|
18
|
+
|
|
19
|
+
target_link_libraries(
|
|
20
|
+
react_codegen_RNSnapshotViewSpec
|
|
21
|
+
fbjni
|
|
22
|
+
folly_runtime
|
|
23
|
+
glog
|
|
24
|
+
jsi
|
|
25
|
+
react_codegen_rncore
|
|
26
|
+
react_debug
|
|
27
|
+
react_nativemodule_core
|
|
28
|
+
react_render_componentregistry
|
|
29
|
+
react_render_core
|
|
30
|
+
react_render_debug
|
|
31
|
+
react_render_graphics
|
|
32
|
+
react_render_imagemanager
|
|
33
|
+
react_render_mapbuffer
|
|
34
|
+
react_utils
|
|
35
|
+
rrc_image
|
|
36
|
+
rrc_view
|
|
37
|
+
turbomodulejsijni
|
|
38
|
+
yoga
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
target_compile_options(
|
|
42
|
+
react_codegen_RNSnapshotViewSpec
|
|
43
|
+
PRIVATE
|
|
44
|
+
-DLOG_TAG=\"ReactNative\"
|
|
45
|
+
-fexceptions
|
|
46
|
+
-frtti
|
|
47
|
+
-std=c++20
|
|
48
|
+
-Wall
|
|
49
|
+
)
|
|
@@ -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 "RNSnapshotViewSpec.h"
|
|
12
|
+
|
|
13
|
+
namespace facebook::react {
|
|
14
|
+
|
|
15
|
+
static facebook::jsi::Value __hostFunction_NativeRNSnapshotViewSpecJSI_captureSnapshot(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, PromiseKind, "captureSnapshot", "(DLcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static facebook::jsi::Value __hostFunction_NativeRNSnapshotViewSpecJSI_releaseSnapshot(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, PromiseKind, "releaseSnapshot", "(Ljava/lang/String;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
NativeRNSnapshotViewSpecJSI::NativeRNSnapshotViewSpecJSI(const JavaTurboModule::InitParams ¶ms)
|
|
26
|
+
: JavaTurboModule(params) {
|
|
27
|
+
methodMap_["captureSnapshot"] = MethodMetadata {1, __hostFunction_NativeRNSnapshotViewSpecJSI_captureSnapshot};
|
|
28
|
+
methodMap_["releaseSnapshot"] = MethodMetadata {1, __hostFunction_NativeRNSnapshotViewSpecJSI_releaseSnapshot};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
std::shared_ptr<TurboModule> RNSnapshotViewSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms) {
|
|
32
|
+
if (moduleName == "RNSnapshotView") {
|
|
33
|
+
return std::make_shared<NativeRNSnapshotViewSpecJSI>(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 'NativeRNSnapshotView'
|
|
21
|
+
*/
|
|
22
|
+
class JSI_EXPORT NativeRNSnapshotViewSpecJSI : public JavaTurboModule {
|
|
23
|
+
public:
|
|
24
|
+
NativeRNSnapshotViewSpecJSI(const JavaTurboModule::InitParams ¶ms);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
JSI_EXPORT
|
|
29
|
+
std::shared_ptr<TurboModule> RNSnapshotViewSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms);
|
|
30
|
+
|
|
31
|
+
} // namespace facebook::react
|
package/android/generated/jni/react/renderer/components/RNSnapshotViewSpec/ComponentDescriptors.cpp
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
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: GenerateComponentDescriptorCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include "ComponentDescriptors.h"
|
|
12
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
13
|
+
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
void RNSnapshotViewSpec_registerComponentDescriptorsFromCodegen(
|
|
18
|
+
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry) {
|
|
19
|
+
registry->add(concreteComponentDescriptorProvider<RNSnapshotRendererComponentDescriptor>());
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
} // namespace facebook::react
|
package/android/generated/jni/react/renderer/components/RNSnapshotViewSpec/ComponentDescriptors.h
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
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: GenerateComponentDescriptorH.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#pragma once
|
|
12
|
+
|
|
13
|
+
#include "ShadowNodes.h"
|
|
14
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
15
|
+
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
|
16
|
+
|
|
17
|
+
namespace facebook::react {
|
|
18
|
+
|
|
19
|
+
using RNSnapshotRendererComponentDescriptor = ConcreteComponentDescriptor<RNSnapshotRendererShadowNode>;
|
|
20
|
+
|
|
21
|
+
void RNSnapshotViewSpec_registerComponentDescriptorsFromCodegen(
|
|
22
|
+
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry);
|
|
23
|
+
|
|
24
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,16 @@
|
|
|
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: GenerateEventEmitterCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include "EventEmitters.h"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
namespace facebook::react {
|
|
15
|
+
|
|
16
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,23 @@
|
|
|
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: GenerateEventEmitterH.js
|
|
9
|
+
*/
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
#include <react/renderer/components/view/ViewEventEmitter.h>
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
class RNSnapshotRendererEventEmitter : public ViewEventEmitter {
|
|
17
|
+
public:
|
|
18
|
+
using ViewEventEmitter::ViewEventEmitter;
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
};
|
|
23
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,25 @@
|
|
|
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: GeneratePropsCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include "Props.h"
|
|
12
|
+
#include <react/renderer/core/PropsParserContext.h>
|
|
13
|
+
#include <react/renderer/core/propsConversions.h>
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
RNSnapshotRendererProps::RNSnapshotRendererProps(
|
|
18
|
+
const PropsParserContext &context,
|
|
19
|
+
const RNSnapshotRendererProps &sourceProps,
|
|
20
|
+
const RawProps &rawProps): ViewProps(context, sourceProps, rawProps),
|
|
21
|
+
|
|
22
|
+
snapshotID(convertRawProp(context, rawProps, "snapshotID", sourceProps.snapshotID, {}))
|
|
23
|
+
{}
|
|
24
|
+
|
|
25
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,27 @@
|
|
|
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: GeneratePropsH.js
|
|
9
|
+
*/
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
#include <react/renderer/components/view/ViewProps.h>
|
|
13
|
+
#include <react/renderer/core/PropsParserContext.h>
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
class RNSnapshotRendererProps final : public ViewProps {
|
|
18
|
+
public:
|
|
19
|
+
RNSnapshotRendererProps() = default;
|
|
20
|
+
RNSnapshotRendererProps(const PropsParserContext& context, const RNSnapshotRendererProps &sourceProps, const RawProps &rawProps);
|
|
21
|
+
|
|
22
|
+
#pragma mark - Props
|
|
23
|
+
|
|
24
|
+
std::string snapshotID{};
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,34 @@
|
|
|
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 "RNSnapshotViewSpecJSI.h"
|
|
11
|
+
|
|
12
|
+
namespace facebook::react {
|
|
13
|
+
|
|
14
|
+
static jsi::Value __hostFunction_NativeRNSnapshotViewCxxSpecJSI_captureSnapshot(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
15
|
+
return static_cast<NativeRNSnapshotViewCxxSpecJSI *>(&turboModule)->captureSnapshot(
|
|
16
|
+
rt,
|
|
17
|
+
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asNumber()
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
static jsi::Value __hostFunction_NativeRNSnapshotViewCxxSpecJSI_releaseSnapshot(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
21
|
+
return static_cast<NativeRNSnapshotViewCxxSpecJSI *>(&turboModule)->releaseSnapshot(
|
|
22
|
+
rt,
|
|
23
|
+
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt)
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
NativeRNSnapshotViewCxxSpecJSI::NativeRNSnapshotViewCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
|
|
28
|
+
: TurboModule("RNSnapshotView", jsInvoker) {
|
|
29
|
+
methodMap_["captureSnapshot"] = MethodMetadata {1, __hostFunction_NativeRNSnapshotViewCxxSpecJSI_captureSnapshot};
|
|
30
|
+
methodMap_["releaseSnapshot"] = MethodMetadata {1, __hostFunction_NativeRNSnapshotViewCxxSpecJSI_releaseSnapshot};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
} // namespace facebook::react
|
package/android/generated/jni/react/renderer/components/RNSnapshotViewSpec/RNSnapshotViewSpecJSI.h
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
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 NativeRNSnapshotViewCxxSpecJSI : public TurboModule {
|
|
19
|
+
protected:
|
|
20
|
+
NativeRNSnapshotViewCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
21
|
+
|
|
22
|
+
public:
|
|
23
|
+
virtual jsi::Value captureSnapshot(jsi::Runtime &rt, double target) = 0;
|
|
24
|
+
virtual jsi::Value releaseSnapshot(jsi::Runtime &rt, jsi::String a) = 0;
|
|
25
|
+
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
template <typename T>
|
|
29
|
+
class JSI_EXPORT NativeRNSnapshotViewCxxSpec : public TurboModule {
|
|
30
|
+
public:
|
|
31
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
32
|
+
return delegate_.get(rt, propName);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
static constexpr std::string_view kModuleName = "RNSnapshotView";
|
|
36
|
+
|
|
37
|
+
protected:
|
|
38
|
+
NativeRNSnapshotViewCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
39
|
+
: TurboModule(std::string{NativeRNSnapshotViewCxxSpec::kModuleName}, jsInvoker),
|
|
40
|
+
delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
private:
|
|
44
|
+
class Delegate : public NativeRNSnapshotViewCxxSpecJSI {
|
|
45
|
+
public:
|
|
46
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
47
|
+
NativeRNSnapshotViewCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
|
|
48
|
+
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
jsi::Value captureSnapshot(jsi::Runtime &rt, double target) override {
|
|
52
|
+
static_assert(
|
|
53
|
+
bridging::getParameterCount(&T::captureSnapshot) == 2,
|
|
54
|
+
"Expected captureSnapshot(...) to have 2 parameters");
|
|
55
|
+
|
|
56
|
+
return bridging::callFromJs<jsi::Value>(
|
|
57
|
+
rt, &T::captureSnapshot, jsInvoker_, instance_, std::move(target));
|
|
58
|
+
}
|
|
59
|
+
jsi::Value releaseSnapshot(jsi::Runtime &rt, jsi::String a) override {
|
|
60
|
+
static_assert(
|
|
61
|
+
bridging::getParameterCount(&T::releaseSnapshot) == 2,
|
|
62
|
+
"Expected releaseSnapshot(...) to have 2 parameters");
|
|
63
|
+
|
|
64
|
+
return bridging::callFromJs<jsi::Value>(
|
|
65
|
+
rt, &T::releaseSnapshot, jsInvoker_, instance_, std::move(a));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
private:
|
|
69
|
+
friend class NativeRNSnapshotViewCxxSpec;
|
|
70
|
+
T *instance_;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
Delegate delegate_;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,17 @@
|
|
|
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: GenerateShadowNodeCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include "ShadowNodes.h"
|
|
12
|
+
|
|
13
|
+
namespace facebook::react {
|
|
14
|
+
|
|
15
|
+
extern const char RNSnapshotRendererComponentName[] = "RNSnapshotRenderer";
|
|
16
|
+
|
|
17
|
+
} // namespace facebook::react
|