@azzapp/react-native-snapshot-view 0.1.3 → 0.2.0
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 +3 -2
- package/android/build.gradle +13 -59
- package/android/gradle.properties +5 -5
- package/android/src/main/AndroidManifest.xml +1 -2
- package/android/src/main/java/com/azzapp/rnsnapshotview/RNSnapshotRendererManager.kt +15 -4
- package/android/src/main/java/com/azzapp/rnsnapshotview/ReactNativeSnapshotViewModule.kt +10 -27
- package/android/src/main/java/com/azzapp/rnsnapshotview/ReactNativeSnapshotViewPackage.kt +2 -6
- package/azzapp-react-native-snapshot-view.podspec +2 -23
- package/ios/RNSnapshotRenderer.h +0 -3
- package/ios/RNSnapshotRenderer.mm +9 -6
- package/ios/RNSnapshotView.h +2 -8
- package/ios/RNSnapshotView.mm +40 -41
- package/lib/commonjs/SnapshotRenderer.js +3 -3
- package/lib/commonjs/SnapshotRenderer.js.map +1 -1
- package/lib/commonjs/index.js +1 -1
- package/lib/module/RNSnapshotRendererNativeComponent.ts +7 -0
- package/lib/module/SnapshotRenderer.js +4 -5
- package/lib/module/SnapshotRenderer.js.map +1 -1
- package/lib/module/index.js +2 -14
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/NativeRNSnapshotView.d.ts.map +1 -0
- package/lib/typescript/src/RNSnapshotRendererNativeComponent.d.ts +7 -0
- package/lib/typescript/src/RNSnapshotRendererNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/SnapshotRenderer.d.ts +19 -0
- package/lib/typescript/src/SnapshotRenderer.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +40 -75
- package/react-native.config.js +4 -0
- package/src/RNSnapshotRendererNativeComponent.ts +1 -2
- package/src/SnapshotRenderer.tsx +9 -10
- package/src/index.tsx +2 -25
- package/android/src/main/AndroidManifestNew.xml +0 -2
- package/android/src/newarch/RNSnapshotRendererManagerSpec.kt +0 -21
- package/android/src/newarch/RNSnapshotViewSpec.kt +0 -7
- package/android/src/oldarch/RNSnapshotRendererManagerSpec.kt +0 -9
- package/android/src/oldarch/RNSnapshotViewSpec.kt +0 -12
- package/ios/RNSnapshotRendererManager.mm +0 -62
- package/lib/module/RNSnapshotRendererNativeComponent.js +0 -5
- package/lib/module/RNSnapshotRendererNativeComponent.js.map +0 -1
- package/lib/typescript/commonjs/src/NativeRNSnapshotView.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/RNSnapshotRendererNativeComponent.d.ts +0 -7
- package/lib/typescript/commonjs/src/RNSnapshotRendererNativeComponent.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/SnapshotRenderer.d.ts +0 -27
- package/lib/typescript/commonjs/src/SnapshotRenderer.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/index.d.ts.map +0 -1
- package/lib/typescript/module/src/NativeRNSnapshotView.d.ts +0 -8
- package/lib/typescript/module/src/NativeRNSnapshotView.d.ts.map +0 -1
- package/lib/typescript/module/src/RNSnapshotRendererNativeComponent.d.ts +0 -7
- package/lib/typescript/module/src/RNSnapshotRendererNativeComponent.d.ts.map +0 -1
- package/lib/typescript/module/src/SnapshotRenderer.d.ts +0 -27
- package/lib/typescript/module/src/SnapshotRenderer.d.ts.map +0 -1
- package/lib/typescript/module/src/index.d.ts +0 -16
- package/lib/typescript/module/src/index.d.ts.map +0 -1
- /package/lib/{typescript/commonjs → commonjs}/package.json +0 -0
- /package/lib/{typescript/module → module}/package.json +0 -0
- /package/lib/typescript/{commonjs/src → src}/NativeRNSnapshotView.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/index.d.ts +0 -0
package/README.md
CHANGED
|
@@ -25,10 +25,11 @@ const snapshotID = await captureSnapshot(viewRef.current);
|
|
|
25
25
|
|
|
26
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
27
|
|
|
28
|
-
|
|
29
28
|
## Contributing
|
|
30
29
|
|
|
31
|
-
|
|
30
|
+
- [Development workflow](CONTRIBUTING.md#development-workflow)
|
|
31
|
+
- [Sending a pull request](CONTRIBUTING.md#sending-a-pull-request)
|
|
32
|
+
- [Code of conduct](CODE_OF_CONDUCT.md)
|
|
32
33
|
|
|
33
34
|
## License
|
|
34
35
|
|
package/android/build.gradle
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
buildscript {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
ext.getExtOrDefault = {name ->
|
|
3
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['ReactNativeSnapshotView_' + name]
|
|
4
|
+
}
|
|
4
5
|
|
|
5
6
|
repositories {
|
|
6
7
|
google()
|
|
@@ -8,63 +9,30 @@ buildscript {
|
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
dependencies {
|
|
11
|
-
classpath "com.android.tools.build:gradle:7.2
|
|
12
|
+
classpath "com.android.tools.build:gradle:8.7.2"
|
|
12
13
|
// noinspection DifferentKotlinGradleVersion
|
|
13
|
-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$
|
|
14
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
|
|
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
18
|
|
|
26
19
|
apply plugin: "com.android.library"
|
|
27
20
|
apply plugin: "kotlin-android"
|
|
28
21
|
|
|
29
|
-
|
|
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
|
-
}
|
|
22
|
+
apply plugin: "com.facebook.react"
|
|
36
23
|
|
|
37
24
|
def getExtOrIntegerDefault(name) {
|
|
38
|
-
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["
|
|
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
|
|
25
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["SnapshotView_" + name]).toInteger()
|
|
48
26
|
}
|
|
49
27
|
|
|
50
28
|
android {
|
|
51
|
-
|
|
52
|
-
namespace "com.azzapp.rnsnapshotview"
|
|
53
|
-
|
|
54
|
-
sourceSets {
|
|
55
|
-
main {
|
|
56
|
-
manifest.srcFile "src/main/AndroidManifestNew.xml"
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
29
|
+
namespace "com.azzapp.rnsnapshotview"
|
|
60
30
|
|
|
61
31
|
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
62
32
|
|
|
63
33
|
defaultConfig {
|
|
64
34
|
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
65
35
|
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
66
|
-
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
67
|
-
|
|
68
36
|
}
|
|
69
37
|
|
|
70
38
|
buildFeatures {
|
|
@@ -88,13 +56,10 @@ android {
|
|
|
88
56
|
|
|
89
57
|
sourceSets {
|
|
90
58
|
main {
|
|
91
|
-
|
|
92
|
-
java
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
} else {
|
|
96
|
-
java.srcDirs += ["src/oldarch"]
|
|
97
|
-
}
|
|
59
|
+
java.srcDirs += [
|
|
60
|
+
"generated/java",
|
|
61
|
+
"generated/jni"
|
|
62
|
+
]
|
|
98
63
|
}
|
|
99
64
|
}
|
|
100
65
|
}
|
|
@@ -107,17 +72,6 @@ repositories {
|
|
|
107
72
|
def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
108
73
|
|
|
109
74
|
dependencies {
|
|
110
|
-
|
|
111
|
-
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
|
|
112
|
-
//noinspection GradleDynamicVersion
|
|
113
|
-
implementation "com.facebook.react:react-native:+"
|
|
75
|
+
implementation "com.facebook.react:react-android"
|
|
114
76
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
115
77
|
}
|
|
116
|
-
|
|
117
|
-
if (isNewArchitectureEnabled()) {
|
|
118
|
-
react {
|
|
119
|
-
jsRootDir = file("../src/")
|
|
120
|
-
libraryName = "ReactNativeSnapshotViewView"
|
|
121
|
-
codegenJavaPackageName = "com.azzapp.rnsnapshotview"
|
|
122
|
-
}
|
|
123
|
-
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
ReactNativeSnapshotView_kotlinVersion=
|
|
2
|
-
ReactNativeSnapshotView_minSdkVersion=
|
|
3
|
-
ReactNativeSnapshotView_targetSdkVersion=
|
|
4
|
-
ReactNativeSnapshotView_compileSdkVersion=
|
|
5
|
-
|
|
1
|
+
ReactNativeSnapshotView_kotlinVersion=2.0.21
|
|
2
|
+
ReactNativeSnapshotView_minSdkVersion=24
|
|
3
|
+
ReactNativeSnapshotView_targetSdkVersion=34
|
|
4
|
+
ReactNativeSnapshotView_compileSdkVersion=35
|
|
5
|
+
ReactNativeSnapshotView_ndkVersion=27.1.12297006
|
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
package com.azzapp.rnsnapshotview
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
import android.graphics.Color
|
|
5
3
|
import com.facebook.react.module.annotations.ReactModule
|
|
4
|
+
import com.facebook.react.uimanager.SimpleViewManager
|
|
6
5
|
import com.facebook.react.uimanager.ThemedReactContext
|
|
6
|
+
import com.facebook.react.uimanager.ViewManagerDelegate
|
|
7
7
|
import com.facebook.react.uimanager.annotations.ReactProp
|
|
8
|
+
import com.facebook.react.viewmanagers.RNSnapshotRendererManagerInterface
|
|
9
|
+
import com.facebook.react.viewmanagers.RNSnapshotRendererManagerDelegate
|
|
8
10
|
|
|
9
11
|
@ReactModule(name = RNSnapshotRendererManager.NAME)
|
|
10
|
-
class RNSnapshotRendererManager :
|
|
11
|
-
|
|
12
|
+
class RNSnapshotRendererManager : SimpleViewManager<RNSnapshotRenderer>(),
|
|
13
|
+
RNSnapshotRendererManagerInterface<RNSnapshotRenderer> {
|
|
14
|
+
private val mDelegate: ViewManagerDelegate<RNSnapshotRenderer>
|
|
15
|
+
init {
|
|
16
|
+
mDelegate = RNSnapshotRendererManagerDelegate(this)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
override fun getDelegate(): ViewManagerDelegate<RNSnapshotRenderer>? {
|
|
20
|
+
return mDelegate
|
|
21
|
+
}
|
|
22
|
+
|
|
12
23
|
override fun getName(): String {
|
|
13
24
|
return NAME
|
|
14
25
|
}
|
|
@@ -19,10 +19,7 @@ import com.facebook.react.bridge.ReactApplicationContext
|
|
|
19
19
|
import com.facebook.react.bridge.ReactMethod
|
|
20
20
|
import com.facebook.react.common.annotations.UnstableReactNativeAPI
|
|
21
21
|
import com.facebook.react.fabric.FabricUIManager
|
|
22
|
-
import com.facebook.react.uimanager.NativeViewHierarchyManager
|
|
23
|
-
import com.facebook.react.uimanager.UIBlock
|
|
24
22
|
import com.facebook.react.uimanager.UIManagerHelper
|
|
25
|
-
import com.facebook.react.uimanager.UIManagerModule
|
|
26
23
|
import com.facebook.react.uimanager.common.UIManagerType
|
|
27
24
|
import java.util.Collections
|
|
28
25
|
import java.util.LinkedList
|
|
@@ -32,7 +29,7 @@ import java.util.concurrent.TimeUnit
|
|
|
32
29
|
|
|
33
30
|
|
|
34
31
|
class ReactNativeSnapshotViewModule internal constructor(context: ReactApplicationContext) :
|
|
35
|
-
|
|
32
|
+
NativeRNSnapshotViewSpec(context) {
|
|
36
33
|
|
|
37
34
|
override fun getName(): String {
|
|
38
35
|
return NAME
|
|
@@ -59,29 +56,15 @@ class ReactNativeSnapshotViewModule internal constructor(context: ReactApplicati
|
|
|
59
56
|
}
|
|
60
57
|
}
|
|
61
58
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
return
|
|
72
|
-
}
|
|
73
|
-
} else {
|
|
74
|
-
val uiManager = reactApplicationContext.getNativeModule(
|
|
75
|
-
UIManagerModule::class.java
|
|
76
|
-
)
|
|
77
|
-
if (uiManager == null) {
|
|
78
|
-
promise.reject("not_found", "Cannot obtain UIManager")
|
|
79
|
-
return
|
|
80
|
-
}
|
|
81
|
-
uiManager.addUIBlock(UIBlock { nativeViewHierarchyManager: NativeViewHierarchyManager ->
|
|
82
|
-
val view = nativeViewHierarchyManager.resolveView(viewTag.toInt())
|
|
83
|
-
handleView(view)
|
|
84
|
-
})
|
|
59
|
+
val uiManager = UIManagerHelper.getUIManager(reactApplicationContext, UIManagerType.FABRIC)
|
|
60
|
+
if (uiManager !is FabricUIManager) {
|
|
61
|
+
promise.reject("not_found", "Cannot obtain UIManager")
|
|
62
|
+
return
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
uiManager.addUIBlock { uiBlockViewResolver ->
|
|
66
|
+
val view = uiBlockViewResolver.resolveView(viewTag.toInt())
|
|
67
|
+
handleView(view)
|
|
85
68
|
}
|
|
86
69
|
}
|
|
87
70
|
|
|
@@ -6,7 +6,6 @@ import com.facebook.react.bridge.ReactApplicationContext
|
|
|
6
6
|
import com.facebook.react.module.model.ReactModuleInfo
|
|
7
7
|
import com.facebook.react.module.model.ReactModuleInfoProvider
|
|
8
8
|
import com.facebook.react.uimanager.ViewManager
|
|
9
|
-
import java.util.ArrayList
|
|
10
9
|
import java.util.HashMap
|
|
11
10
|
|
|
12
11
|
class ReactNativeSnapshotViewPackage : TurboReactPackage() {
|
|
@@ -21,7 +20,6 @@ class ReactNativeSnapshotViewPackage : TurboReactPackage() {
|
|
|
21
20
|
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
|
|
22
21
|
return ReactModuleInfoProvider {
|
|
23
22
|
val moduleInfos: MutableMap<String, ReactModuleInfo> = HashMap()
|
|
24
|
-
val isTurboModule: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
|
|
25
23
|
moduleInfos[ReactNativeSnapshotViewModule.NAME] = ReactModuleInfo(
|
|
26
24
|
ReactNativeSnapshotViewModule.NAME,
|
|
27
25
|
ReactNativeSnapshotViewModule.NAME,
|
|
@@ -29,14 +27,12 @@ class ReactNativeSnapshotViewPackage : TurboReactPackage() {
|
|
|
29
27
|
false, // needsEagerInit
|
|
30
28
|
true, // hasConstants
|
|
31
29
|
false, // isCxxModule
|
|
32
|
-
|
|
30
|
+
true // isTurboModule
|
|
33
31
|
)
|
|
34
32
|
moduleInfos
|
|
35
33
|
}
|
|
36
34
|
}
|
|
37
35
|
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
|
|
38
|
-
|
|
39
|
-
viewManagers.add(RNSnapshotRendererManager())
|
|
40
|
-
return viewManagers
|
|
36
|
+
return listOf(RNSnapshotRendererManager())
|
|
41
37
|
}
|
|
42
38
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
require "json"
|
|
2
2
|
|
|
3
3
|
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
-
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
|
5
4
|
|
|
6
5
|
Pod::Spec.new do |s|
|
|
7
6
|
s.name = "azzapp-react-native-snapshot-view"
|
|
@@ -15,28 +14,8 @@ Pod::Spec.new do |s|
|
|
|
15
14
|
s.source = { :git => "https://github.com/AzzappApp/react-native-snapshot-view.git", :tag => "#{s.version}" }
|
|
16
15
|
|
|
17
16
|
s.source_files = "ios/**/*.{h,m,mm,cpp}"
|
|
17
|
+
s.private_header_files = "ios/**/*.h"
|
|
18
18
|
|
|
19
|
-
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
|
|
20
|
-
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
|
|
21
|
-
if respond_to?(:install_modules_dependencies, true)
|
|
22
|
-
install_modules_dependencies(s)
|
|
23
|
-
else
|
|
24
|
-
s.dependency "React-Core"
|
|
25
19
|
|
|
26
|
-
|
|
27
|
-
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
|
28
|
-
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
|
|
29
|
-
s.pod_target_xcconfig = {
|
|
30
|
-
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
|
|
31
|
-
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
|
|
32
|
-
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
|
|
33
|
-
}
|
|
34
|
-
s.dependency "React-RCTFabric"
|
|
35
|
-
s.dependency "React-Codegen"
|
|
36
|
-
s.dependency "RCT-Folly"
|
|
37
|
-
s.dependency "RCTRequired"
|
|
38
|
-
s.dependency "RCTTypeSafety"
|
|
39
|
-
s.dependency "ReactCommon/turbomodule/core"
|
|
40
|
-
end
|
|
41
|
-
end
|
|
20
|
+
install_modules_dependencies(s)
|
|
42
21
|
end
|
package/ios/RNSnapshotRenderer.h
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// This guard prevent this file to be compiled in the old architecture.
|
|
2
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
3
1
|
#import <React/RCTViewComponentView.h>
|
|
4
2
|
#import <UIKit/UIKit.h>
|
|
5
3
|
|
|
@@ -14,4 +12,3 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
14
12
|
NS_ASSUME_NONNULL_END
|
|
15
13
|
|
|
16
14
|
#endif /* RNSnapshotRendererNativeComponent_h */
|
|
17
|
-
#endif /* RCT_NEW_ARCH_ENABLED */
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
2
1
|
#import "RNSnapshotRenderer.h"
|
|
3
2
|
|
|
4
3
|
#import <react/renderer/components/RNSnapshotViewSpec/ComponentDescriptors.h>
|
|
@@ -44,9 +43,14 @@ using namespace facebook::react;
|
|
|
44
43
|
const auto &newViewProps = *std::static_pointer_cast<RNSnapshotRendererProps const>(props);
|
|
45
44
|
|
|
46
45
|
if (oldViewProps.snapshotID != newViewProps.snapshotID) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
NSString *identifier = [NSString stringWithUTF8String:newViewProps.snapshotID.c_str()];
|
|
47
|
+
if (identifier.length == 0) {
|
|
48
|
+
self.contentView = nil;
|
|
49
|
+
} else {
|
|
50
|
+
UIView *snapshot = [RNSnapshotView getSnapShotMap][identifier];
|
|
51
|
+
[snapshot removeFromSuperview];
|
|
52
|
+
self.contentView = snapshot;
|
|
53
|
+
}
|
|
50
54
|
}
|
|
51
55
|
|
|
52
56
|
[super updateProps:props oldProps:oldProps];
|
|
@@ -57,5 +61,4 @@ Class<RCTComponentViewProtocol> RNSnapshotRendererCls(void)
|
|
|
57
61
|
return RNSnapshotRenderer.class;
|
|
58
62
|
}
|
|
59
63
|
|
|
60
|
-
@end
|
|
61
|
-
#endif
|
|
64
|
+
@end
|
package/ios/RNSnapshotView.h
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
3
2
|
#import "RNSnapshotViewSpec.h"
|
|
3
|
+
#import <UIKit/UIKit.h>
|
|
4
4
|
|
|
5
5
|
@interface RNSnapshotView : NSObject <NativeRNSnapshotViewSpec>
|
|
6
|
-
#else
|
|
7
|
-
#import <React/RCTBridgeModule.h>
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
#endif
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
+(NSDictionary<NSString*, UIView *> *)getSnapShotMap;
|
|
7
|
+
+ (NSMutableDictionary<NSString *, UIView *> *)getSnapShotMap;
|
|
14
8
|
|
|
15
9
|
@end
|
package/ios/RNSnapshotView.mm
CHANGED
|
@@ -1,71 +1,70 @@
|
|
|
1
1
|
#import "RNSnapshotView.h"
|
|
2
|
-
|
|
3
|
-
#if __has_include(<React/RCTUIManagerUtils.h>)
|
|
4
|
-
#import <React/RCTUIManagerUtils.h>
|
|
5
|
-
#endif
|
|
2
|
+
|
|
6
3
|
#import <React/RCTBridge.h>
|
|
4
|
+
#import <React/RCTBridge+Private.h>
|
|
5
|
+
#import <React/RCTUIManager.h>
|
|
7
6
|
|
|
8
7
|
@implementation RNSnapshotView
|
|
9
8
|
RCT_EXPORT_MODULE()
|
|
10
9
|
|
|
11
10
|
@synthesize bridge = _bridge;
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
{
|
|
15
|
-
return RCTGetUIManagerQueue();
|
|
16
|
-
}
|
|
12
|
+
static NSMutableDictionary<NSString *, UIView *> *snapshotMap;
|
|
17
13
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
+(NSDictionary<NSString *,UIView *> *)getSnapShotMap {
|
|
14
|
+
+ (NSMutableDictionary<NSString *, UIView *> *)getSnapShotMap
|
|
15
|
+
{
|
|
21
16
|
if (snapshotMap == nil) {
|
|
22
17
|
snapshotMap = [[NSMutableDictionary alloc] init];
|
|
23
18
|
}
|
|
24
19
|
return snapshotMap;
|
|
25
20
|
}
|
|
26
21
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
UIView *view =
|
|
33
|
-
if (view
|
|
34
|
-
UIView *snapshot = [view snapshotViewAfterScreenUpdates:NO];
|
|
35
|
-
if (snapshotMap == nil) {
|
|
36
|
-
snapshotMap = [[NSMutableDictionary alloc] init];
|
|
37
|
-
}
|
|
38
|
-
NSUUID *uuid = [NSUUID UUID];
|
|
39
|
-
NSString *str = [uuid UUIDString];
|
|
40
|
-
[snapshotMap setValue:snapshot forKey:str];
|
|
41
|
-
resolve(str);
|
|
42
|
-
} else {
|
|
22
|
+
- (void)captureSnapshot:(double)viewTag
|
|
23
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
24
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
25
|
+
{
|
|
26
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
27
|
+
UIView *view = [self viewForReactTag:viewTag];
|
|
28
|
+
if (view == nil) {
|
|
43
29
|
reject(@"not_found", @"View not found", nil);
|
|
30
|
+
return;
|
|
44
31
|
}
|
|
45
|
-
|
|
32
|
+
|
|
33
|
+
UIView *snapshot = [view snapshotViewAfterScreenUpdates:NO];
|
|
34
|
+
if (snapshot == nil) {
|
|
35
|
+
reject(@"snapshot_failed", @"Failed to capture snapshot", nil);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
NSString *identifier = [[NSUUID UUID] UUIDString];
|
|
40
|
+
[[RNSnapshotView getSnapShotMap] setObject:snapshot forKey:identifier];
|
|
41
|
+
resolve(identifier);
|
|
42
|
+
});
|
|
46
43
|
}
|
|
47
44
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
- (void)releaseSnapshot:(NSString *)uuid
|
|
46
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
47
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
48
|
+
{
|
|
52
49
|
if (uuid != nil) {
|
|
53
|
-
|
|
54
|
-
snapshotMap = [[NSMutableDictionary alloc] init];
|
|
55
|
-
}
|
|
56
|
-
[snapshotMap removeObjectForKey:uuid];
|
|
50
|
+
[[RNSnapshotView getSnapShotMap] removeObjectForKey:uuid];
|
|
57
51
|
}
|
|
58
52
|
resolve(nil);
|
|
59
53
|
}
|
|
60
54
|
|
|
61
|
-
|
|
62
|
-
|
|
55
|
+
- (UIView *)viewForReactTag:(double)viewTag
|
|
56
|
+
{
|
|
57
|
+
RCTUIManager* uiManager = self.bridge.uiManager;
|
|
58
|
+
if (uiManager == nil) {
|
|
59
|
+
return nil;
|
|
60
|
+
}
|
|
61
|
+
return [uiManager viewForReactTag:[NSNumber numberWithDouble:viewTag]];
|
|
62
|
+
}
|
|
63
|
+
|
|
63
64
|
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
64
65
|
(const facebook::react::ObjCTurboModule::InitParams &)params
|
|
65
66
|
{
|
|
66
|
-
|
|
67
|
+
return std::make_shared<facebook::react::NativeRNSnapshotViewSpecJSI>(params);
|
|
67
68
|
}
|
|
68
|
-
#endif
|
|
69
|
-
|
|
70
69
|
|
|
71
70
|
@end
|
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
|
-
var _RNSnapshotRendererNativeComponent = _interopRequireDefault(require("./RNSnapshotRendererNativeComponent
|
|
9
|
-
var
|
|
8
|
+
var _RNSnapshotRendererNativeComponent = _interopRequireDefault(require("./RNSnapshotRendererNativeComponent"));
|
|
9
|
+
var _ = require(".");
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
12
|
/**
|
|
@@ -23,7 +23,7 @@ const SnapshotRenderer = ({
|
|
|
23
23
|
}, [autoReleaseSnapshot]);
|
|
24
24
|
(0, _react.useEffect)(() => () => {
|
|
25
25
|
if (autoReleaseSnapshotRef.current && snapshotID) {
|
|
26
|
-
(0,
|
|
26
|
+
(0, _.releaseSnapshot)(snapshotID).catch(() => {});
|
|
27
27
|
}
|
|
28
28
|
}, [snapshotID]);
|
|
29
29
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_RNSnapshotRendererNativeComponent.default, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_RNSnapshotRendererNativeComponent","_interopRequireDefault","
|
|
1
|
+
{"version":3,"names":["_react","require","_RNSnapshotRendererNativeComponent","_interopRequireDefault","_","_jsxRuntime","e","__esModule","default","SnapshotRenderer","snapshotID","autoReleaseSnapshot","props","forwardedRef","autoReleaseSnapshotRef","useRef","useEffect","current","releaseSnapshot","catch","jsx","ref","_default","exports","forwardRef"],"sourceRoot":"../../src","sources":["SnapshotRenderer.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,kCAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,CAAA,GAAAH,OAAA;AAAoC,IAAAI,WAAA,GAAAJ,OAAA;AAAA,SAAAE,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAepC;AACA;AACA;AACA,MAAMG,gBAAgB,GAAGA,CACvB;EAAEC,UAAU;EAAEC,mBAAmB,GAAG,IAAI;EAAE,GAAGC;AAA6B,CAAC,EAC3EC,YAAgC,KAC7B;EACH,MAAMC,sBAAsB,GAAG,IAAAC,aAAM,EAACJ,mBAAmB,CAAC;EAC1D,IAAAK,gBAAS,EAAC,MAAM;IACdF,sBAAsB,CAACG,OAAO,GAAGN,mBAAmB;EACtD,CAAC,EAAE,CAACA,mBAAmB,CAAC,CAAC;EAEzB,IAAAK,gBAAS,EACP,MAAM,MAAM;IACV,IAAIF,sBAAsB,CAACG,OAAO,IAAIP,UAAU,EAAE;MAChD,IAAAQ,iBAAe,EAACR,UAAU,CAAC,CAACS,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAC7C;EACF,CAAC,EACD,CAACT,UAAU,CACb,CAAC;EACD,oBACE,IAAAL,WAAA,CAAAe,GAAA,EAAClB,kCAAA,CAAAM,OAAkB;IAACa,GAAG,EAAER,YAAa;IAACH,UAAU,EAAEA,UAAW;IAAA,GAAKE;EAAK,CAAG,CAAC;AAEhF,CAAC;AAAC,IAAAU,QAAA,GAAAC,OAAA,CAAAf,OAAA,gBAEa,IAAAgB,iBAAU,EAACf,gBAAgB,CAAC","ignoreList":[]}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "SnapshotRenderer", {
|
|
|
12
12
|
exports.captureSnapshot = captureSnapshot;
|
|
13
13
|
exports.releaseSnapshot = releaseSnapshot;
|
|
14
14
|
var _reactNative = require("react-native");
|
|
15
|
-
var _SnapshotRenderer = _interopRequireDefault(require("./SnapshotRenderer
|
|
15
|
+
var _SnapshotRenderer = _interopRequireDefault(require("./SnapshotRenderer"));
|
|
16
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
17
|
const LINKING_ERROR = `The package '@azzapp/react-native-snapshot-view' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
|
|
18
18
|
ios: "- You have run 'pod install'\n",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import RNSnapshotRenderer from
|
|
3
|
+
import { useEffect, useRef } from 'react';
|
|
4
|
+
import RNSnapshotRenderer from './RNSnapshotRendererNativeComponent';
|
|
5
5
|
import { releaseSnapshot } from "./index.js";
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
/**
|
|
@@ -11,7 +11,7 @@ const SnapshotRenderer = ({
|
|
|
11
11
|
snapshotID,
|
|
12
12
|
autoReleaseSnapshot = true,
|
|
13
13
|
...props
|
|
14
|
-
}
|
|
14
|
+
}) => {
|
|
15
15
|
const autoReleaseSnapshotRef = useRef(autoReleaseSnapshot);
|
|
16
16
|
useEffect(() => {
|
|
17
17
|
autoReleaseSnapshotRef.current = autoReleaseSnapshot;
|
|
@@ -22,10 +22,9 @@ const SnapshotRenderer = ({
|
|
|
22
22
|
}
|
|
23
23
|
}, [snapshotID]);
|
|
24
24
|
return /*#__PURE__*/_jsx(RNSnapshotRenderer, {
|
|
25
|
-
ref: forwardedRef,
|
|
26
25
|
snapshotID: snapshotID,
|
|
27
26
|
...props
|
|
28
27
|
});
|
|
29
28
|
};
|
|
30
|
-
export default
|
|
29
|
+
export default SnapshotRenderer;
|
|
31
30
|
//# sourceMappingURL=SnapshotRenderer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","RNSnapshotRenderer","releaseSnapshot","jsx","_jsx","SnapshotRenderer","snapshotID","autoReleaseSnapshot","props","autoReleaseSnapshotRef","current","catch"],"sourceRoot":"../../src","sources":["SnapshotRenderer.tsx"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAEzC,OAAOC,kBAAkB,MAAM,qCAAqC;AACpE,SAASC,eAAe,QAAQ,YAAG;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAepC;AACA;AACA;AACA,MAAMC,gBAAgB,GAAGA,CAAC;EACxBC,UAAU;EACVC,mBAAmB,GAAG,IAAI;EAC1B,GAAGC;AACkB,CAAC,KAAK;EAC3B,MAAMC,sBAAsB,GAAGT,MAAM,CAACO,mBAAmB,CAAC;EAC1DR,SAAS,CAAC,MAAM;IACdU,sBAAsB,CAACC,OAAO,GAAGH,mBAAmB;EACtD,CAAC,EAAE,CAACA,mBAAmB,CAAC,CAAC;EAEzBR,SAAS,CACP,MAAM,MAAM;IACV,IAAIU,sBAAsB,CAACC,OAAO,IAAIJ,UAAU,EAAE;MAChDJ,eAAe,CAACI,UAAU,CAAC,CAACK,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAC7C;EACF,CAAC,EACD,CAACL,UAAU,CACb,CAAC;EACD,oBAAOF,IAAA,CAACH,kBAAkB;IAACK,UAAU,EAAEA,UAAW;IAAA,GAAKE;EAAK,CAAG,CAAC;AAClE,CAAC;AAED,eAAeH,gBAAgB","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -1,19 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { findNodeHandle
|
|
4
|
-
|
|
5
|
-
ios: "- You have run 'pod install'\n",
|
|
6
|
-
default: ''
|
|
7
|
-
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
8
|
-
|
|
9
|
-
// @ts-expect-error
|
|
10
|
-
const isTurboModuleEnabled = global.__turboModuleProxy != null;
|
|
11
|
-
const RNSnapshotViewModule = isTurboModuleEnabled ? require('./NativeRNSnapshotView').default : NativeModules.RNSnapshotView;
|
|
12
|
-
const RNSnapshotView = RNSnapshotViewModule ? RNSnapshotViewModule : new Proxy({}, {
|
|
13
|
-
get() {
|
|
14
|
-
throw new Error(LINKING_ERROR);
|
|
15
|
-
}
|
|
16
|
-
});
|
|
3
|
+
import { findNodeHandle } from 'react-native';
|
|
4
|
+
import RNSnapshotView from "./NativeRNSnapshotView.js";
|
|
17
5
|
|
|
18
6
|
/**
|
|
19
7
|
* Captures a snapshot of a view. The snapshot can be rendered using the `SnapshotRenderer` component.
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["findNodeHandle","
|
|
1
|
+
{"version":3,"names":["findNodeHandle","RNSnapshotView","captureSnapshot","componentOrHandle","handle","Promise","reject","Error","releaseSnapshot","snapshotID","default","SnapshotRenderer"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,cAAc,QAAQ,cAAc;AAC7C,OAAOC,cAAc,MAAM,2BAAwB;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAC7BC,iBAI6B,EACZ;EACjB,MAAMC,MAAM,GAAGJ,cAAc,CAACG,iBAAiB,CAAC;EAChD,IAAIC,MAAM,IAAI,IAAI,EAAE;IAClB,OAAOC,OAAO,CAACC,MAAM,CAAC,IAAIC,KAAK,CAAC,qBAAqB,CAAC,CAAC;EACzD;EACA,OAAON,cAAc,CAACC,eAAe,CAACE,MAAM,CAAC;AAC/C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,eAAeA,CAACC,UAAkB,EAAiB;EACjE,OAAOR,cAAc,CAACO,eAAe,CAACC,UAAU,CAAC;AACnD;AAEA,SAASC,OAAO,IAAIC,gBAAgB,QAAQ,uBAAoB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeRNSnapshotView.d.ts","sourceRoot":"","sources":["../../../src/NativeRNSnapshotView.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACjD,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3C;;AAED,wBAAwE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ViewProps } from 'react-native';
|
|
2
|
+
interface NativeProps extends ViewProps {
|
|
3
|
+
snapshotID?: string | null;
|
|
4
|
+
}
|
|
5
|
+
declare const _default: import("react-native/types_generated/Libraries/Utilities/codegenNativeComponent").NativeComponentType<NativeProps>;
|
|
6
|
+
export default _default;
|
|
7
|
+
//# sourceMappingURL=RNSnapshotRendererNativeComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RNSnapshotRendererNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/RNSnapshotRendererNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAEtE,UAAU,WAAY,SAAQ,SAAS;IACrC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;;AAED,wBAAyE"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ViewProps } from 'react-native';
|
|
2
|
+
export type SnapshotRendererProps = Omit<ViewProps, 'children'> & {
|
|
3
|
+
/**
|
|
4
|
+
* The ID of the snapshot to render.
|
|
5
|
+
* This ID is returned by the `captureSnapshot` function.
|
|
6
|
+
*/
|
|
7
|
+
snapshotID: string | null;
|
|
8
|
+
/**
|
|
9
|
+
* Whether to automatically release the snapshot when no longer displayed.
|
|
10
|
+
* @default true
|
|
11
|
+
*/
|
|
12
|
+
autoReleaseSnapshot?: boolean;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* A view that renders a snapshot of a view.
|
|
16
|
+
*/
|
|
17
|
+
declare const SnapshotRenderer: ({ snapshotID, autoReleaseSnapshot, ...props }: SnapshotRendererProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export default SnapshotRenderer;
|
|
19
|
+
//# sourceMappingURL=SnapshotRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SnapshotRenderer.d.ts","sourceRoot":"","sources":["../../../src/SnapshotRenderer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAI9C,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG;IAChE;;;OAGG;IACH,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAC;AAEF;;GAEG;AACH,QAAA,MAAM,gBAAgB,GAAI,+CAIvB,qBAAqB,4CAevB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,iBAAiB,EACb,IAAI,GACJ,MAAM,GACN,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,GACzB,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,GAC5B,OAAO,CAAC,MAAM,CAAC,CAMjB;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEjE;AAED,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,23 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azzapp/react-native-snapshot-view",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Snapshot view for react-native",
|
|
5
|
-
"
|
|
5
|
+
"main": "lib/commonjs/index",
|
|
6
|
+
"module": "lib/module/index",
|
|
7
|
+
"types": "lib/typescript/src/index.d.ts",
|
|
6
8
|
"react-native": "src/index",
|
|
7
|
-
"
|
|
8
|
-
"module": "./lib/module/index.js",
|
|
9
|
-
"exports": {
|
|
10
|
-
".": {
|
|
11
|
-
"import": {
|
|
12
|
-
"types": "./lib/typescript/module/src/index.d.ts",
|
|
13
|
-
"default": "./lib/module/index.js"
|
|
14
|
-
},
|
|
15
|
-
"require": {
|
|
16
|
-
"types": "./lib/typescript/commonjs/src/index.d.ts",
|
|
17
|
-
"default": "./lib/commonjs/index.js"
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
},
|
|
9
|
+
"source": "src/index",
|
|
21
10
|
"files": [
|
|
22
11
|
"src",
|
|
23
12
|
"lib",
|
|
@@ -25,6 +14,7 @@
|
|
|
25
14
|
"ios",
|
|
26
15
|
"cpp",
|
|
27
16
|
"*.podspec",
|
|
17
|
+
"react-native.config.js",
|
|
28
18
|
"!ios/build",
|
|
29
19
|
"!android/build",
|
|
30
20
|
"!android/gradle",
|
|
@@ -37,13 +27,13 @@
|
|
|
37
27
|
"!**/.*"
|
|
38
28
|
],
|
|
39
29
|
"scripts": {
|
|
40
|
-
"example": "yarn workspace
|
|
30
|
+
"example": "yarn workspace react-native-snapshot-view-example",
|
|
41
31
|
"test": "jest",
|
|
42
32
|
"typecheck": "tsc",
|
|
43
33
|
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
44
34
|
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
45
35
|
"prepare": "bob build",
|
|
46
|
-
"release": "release-it"
|
|
36
|
+
"release": "release-it --only-version"
|
|
47
37
|
},
|
|
48
38
|
"keywords": [
|
|
49
39
|
"react-native",
|
|
@@ -65,29 +55,30 @@
|
|
|
65
55
|
"access": "public"
|
|
66
56
|
},
|
|
67
57
|
"devDependencies": {
|
|
68
|
-
"@commitlint/config-conventional": "^
|
|
69
|
-
"@
|
|
70
|
-
"@
|
|
71
|
-
"@
|
|
72
|
-
"@
|
|
73
|
-
"@
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
58
|
+
"@commitlint/config-conventional": "^19.8.1",
|
|
59
|
+
"@eslint/compat": "^1.3.2",
|
|
60
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
61
|
+
"@eslint/js": "^9.35.0",
|
|
62
|
+
"@evilmartians/lefthook": "^1.12.3",
|
|
63
|
+
"@react-native-community/cli": "20.0.1",
|
|
64
|
+
"@react-native/babel-preset": "0.81.1",
|
|
65
|
+
"@react-native/eslint-config": "^0.81.1",
|
|
66
|
+
"@release-it/conventional-changelog": "^10.0.1",
|
|
67
|
+
"@types/jest": "^29.5.14",
|
|
68
|
+
"@types/react": "^19.1.0",
|
|
69
|
+
"commitlint": "^19.8.1",
|
|
70
|
+
"del-cli": "^6.0.0",
|
|
71
|
+
"eslint": "^9.35.0",
|
|
72
|
+
"eslint-config-prettier": "^10.1.8",
|
|
73
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
79
74
|
"jest": "^29.7.0",
|
|
80
|
-
"prettier": "^3.
|
|
81
|
-
"react": "
|
|
82
|
-
"react-native": "0.
|
|
83
|
-
"react-native-builder-bob": "^0.
|
|
84
|
-
"release-it": "^
|
|
85
|
-
"turbo": "^
|
|
86
|
-
"typescript": "^5.
|
|
87
|
-
},
|
|
88
|
-
"resolutions": {
|
|
89
|
-
"@types/react": "^18.2.44",
|
|
90
|
-
"react-native-builder-bob@^0.30.2": "patch:react-native-builder-bob@npm%3A0.30.2#./.yarn/patches/react-native-builder-bob-npm-0.30.2-5e6e62dece.patch"
|
|
75
|
+
"prettier": "^3.6.2",
|
|
76
|
+
"react": "19.1.0",
|
|
77
|
+
"react-native": "0.81.1",
|
|
78
|
+
"react-native-builder-bob": "^0.40.13",
|
|
79
|
+
"release-it": "^19.0.4",
|
|
80
|
+
"turbo": "^2.5.6",
|
|
81
|
+
"typescript": "^5.9.2"
|
|
91
82
|
},
|
|
92
83
|
"peerDependencies": {
|
|
93
84
|
"react": "*",
|
|
@@ -126,30 +117,6 @@
|
|
|
126
117
|
}
|
|
127
118
|
}
|
|
128
119
|
},
|
|
129
|
-
"eslintConfig": {
|
|
130
|
-
"root": true,
|
|
131
|
-
"extends": [
|
|
132
|
-
"@react-native",
|
|
133
|
-
"prettier"
|
|
134
|
-
],
|
|
135
|
-
"rules": {
|
|
136
|
-
"react/react-in-jsx-scope": "off",
|
|
137
|
-
"prettier/prettier": [
|
|
138
|
-
"error",
|
|
139
|
-
{
|
|
140
|
-
"quoteProps": "consistent",
|
|
141
|
-
"singleQuote": true,
|
|
142
|
-
"tabWidth": 2,
|
|
143
|
-
"trailingComma": "es5",
|
|
144
|
-
"useTabs": false
|
|
145
|
-
}
|
|
146
|
-
]
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
"eslintIgnore": [
|
|
150
|
-
"node_modules/",
|
|
151
|
-
"lib/"
|
|
152
|
-
],
|
|
153
120
|
"prettier": {
|
|
154
121
|
"quoteProps": "consistent",
|
|
155
122
|
"singleQuote": true,
|
|
@@ -161,13 +128,6 @@
|
|
|
161
128
|
"source": "src",
|
|
162
129
|
"output": "lib",
|
|
163
130
|
"targets": [
|
|
164
|
-
"codegen",
|
|
165
|
-
[
|
|
166
|
-
"commonjs",
|
|
167
|
-
{
|
|
168
|
-
"esm": true
|
|
169
|
-
}
|
|
170
|
-
],
|
|
171
131
|
[
|
|
172
132
|
"module",
|
|
173
133
|
{
|
|
@@ -177,8 +137,7 @@
|
|
|
177
137
|
[
|
|
178
138
|
"typescript",
|
|
179
139
|
{
|
|
180
|
-
"project": "tsconfig.build.json"
|
|
181
|
-
"esm": true
|
|
140
|
+
"project": "tsconfig.build.json"
|
|
182
141
|
}
|
|
183
142
|
]
|
|
184
143
|
]
|
|
@@ -189,10 +148,16 @@
|
|
|
189
148
|
"jsSrcsDir": "src",
|
|
190
149
|
"android": {
|
|
191
150
|
"javaPackageName": "com.azzapp.rnsnapshotview"
|
|
151
|
+
},
|
|
152
|
+
"ios": {
|
|
153
|
+
"componentProvider": {
|
|
154
|
+
"RNSnapshotRenderer": "RNSnapshotRenderer"
|
|
155
|
+
}
|
|
192
156
|
}
|
|
193
157
|
},
|
|
194
158
|
"create-react-native-library": {
|
|
195
|
-
"
|
|
196
|
-
"
|
|
159
|
+
"languages": "kotlin-objc",
|
|
160
|
+
"type": "fabric-view",
|
|
161
|
+
"version": "0.54.3"
|
|
197
162
|
}
|
|
198
163
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import codegenNativeComponent from 'react-native
|
|
2
|
-
import type { ViewProps } from 'react-native';
|
|
1
|
+
import { codegenNativeComponent, type ViewProps } from 'react-native';
|
|
3
2
|
|
|
4
3
|
interface NativeProps extends ViewProps {
|
|
5
4
|
snapshotID?: string | null;
|
package/src/SnapshotRenderer.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
import type { ViewProps } from 'react-native';
|
|
3
3
|
import RNSnapshotRenderer from './RNSnapshotRendererNativeComponent';
|
|
4
4
|
import { releaseSnapshot } from '.';
|
|
5
5
|
|
|
@@ -19,10 +19,11 @@ export type SnapshotRendererProps = Omit<ViewProps, 'children'> & {
|
|
|
19
19
|
/**
|
|
20
20
|
* A view that renders a snapshot of a view.
|
|
21
21
|
*/
|
|
22
|
-
const SnapshotRenderer = (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
const SnapshotRenderer = ({
|
|
23
|
+
snapshotID,
|
|
24
|
+
autoReleaseSnapshot = true,
|
|
25
|
+
...props
|
|
26
|
+
}: SnapshotRendererProps) => {
|
|
26
27
|
const autoReleaseSnapshotRef = useRef(autoReleaseSnapshot);
|
|
27
28
|
useEffect(() => {
|
|
28
29
|
autoReleaseSnapshotRef.current = autoReleaseSnapshot;
|
|
@@ -36,9 +37,7 @@ const SnapshotRenderer = (
|
|
|
36
37
|
},
|
|
37
38
|
[snapshotID]
|
|
38
39
|
);
|
|
39
|
-
return
|
|
40
|
-
<RNSnapshotRenderer ref={forwardedRef} snapshotID={snapshotID} {...props} />
|
|
41
|
-
);
|
|
40
|
+
return <RNSnapshotRenderer snapshotID={snapshotID} {...props} />;
|
|
42
41
|
};
|
|
43
42
|
|
|
44
|
-
export default
|
|
43
|
+
export default SnapshotRenderer;
|
package/src/index.tsx
CHANGED
|
@@ -1,28 +1,5 @@
|
|
|
1
|
-
import { findNodeHandle
|
|
2
|
-
|
|
3
|
-
const LINKING_ERROR =
|
|
4
|
-
`The package '@azzapp/react-native-snapshot-view' doesn't seem to be linked. Make sure: \n\n` +
|
|
5
|
-
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
6
|
-
'- You rebuilt the app after installing the package\n' +
|
|
7
|
-
'- You are not using Expo Go\n';
|
|
8
|
-
|
|
9
|
-
// @ts-expect-error
|
|
10
|
-
const isTurboModuleEnabled = global.__turboModuleProxy != null;
|
|
11
|
-
|
|
12
|
-
const RNSnapshotViewModule = isTurboModuleEnabled
|
|
13
|
-
? require('./NativeRNSnapshotView').default
|
|
14
|
-
: NativeModules.RNSnapshotView;
|
|
15
|
-
|
|
16
|
-
const RNSnapshotView = RNSnapshotViewModule
|
|
17
|
-
? RNSnapshotViewModule
|
|
18
|
-
: new Proxy(
|
|
19
|
-
{},
|
|
20
|
-
{
|
|
21
|
-
get() {
|
|
22
|
-
throw new Error(LINKING_ERROR);
|
|
23
|
-
},
|
|
24
|
-
}
|
|
25
|
-
);
|
|
1
|
+
import { findNodeHandle } from 'react-native';
|
|
2
|
+
import RNSnapshotView from './NativeRNSnapshotView';
|
|
26
3
|
|
|
27
4
|
/**
|
|
28
5
|
* Captures a snapshot of a view. The snapshot can be rendered using the `SnapshotRenderer` component.
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
package com.azzapp.rnsnapshotview
|
|
2
|
-
|
|
3
|
-
import android.view.View
|
|
4
|
-
|
|
5
|
-
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
-
import com.facebook.react.uimanager.SimpleViewManager
|
|
7
|
-
import com.facebook.react.uimanager.ViewManagerDelegate
|
|
8
|
-
import com.facebook.react.viewmanagers.RNSnapshotRendererManagerDelegate
|
|
9
|
-
import com.facebook.react.viewmanagers.RNSnapshotRendererManagerInterface
|
|
10
|
-
|
|
11
|
-
abstract class RNSnapshotRendererManagerSpec<T : View> : SimpleViewManager<T>(), RNSnapshotRendererManagerInterface<T> {
|
|
12
|
-
private val mDelegate: ViewManagerDelegate<T>
|
|
13
|
-
|
|
14
|
-
init {
|
|
15
|
-
mDelegate = RNSnapshotRendererManagerDelegate(this)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
override fun getDelegate(): ViewManagerDelegate<T>? {
|
|
19
|
-
return mDelegate
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
package com.azzapp.rnsnapshotview
|
|
2
|
-
|
|
3
|
-
import android.view.View
|
|
4
|
-
import com.facebook.react.bridge.ReactApplicationContext
|
|
5
|
-
import com.facebook.react.uimanager.SimpleViewManager
|
|
6
|
-
|
|
7
|
-
abstract class RNSnapshotRendererManagerSpec<T : View> : SimpleViewManager<T>() {
|
|
8
|
-
abstract fun setSnapshotID(view: T?, snapshodID: String?)
|
|
9
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
package com.azzapp.rnsnapshotview
|
|
2
|
-
|
|
3
|
-
import com.facebook.react.bridge.ReactApplicationContext
|
|
4
|
-
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
5
|
-
import com.facebook.react.bridge.Promise
|
|
6
|
-
|
|
7
|
-
abstract class RNSnapshotViewSpec internal constructor(context: ReactApplicationContext) :
|
|
8
|
-
ReactContextBaseJavaModule(context) {
|
|
9
|
-
|
|
10
|
-
abstract fun captureSnapshot(viewTag: Double, promise: Promise)
|
|
11
|
-
abstract fun releaseSnapshot(snapshotID: String, promise: Promise)
|
|
12
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
#ifndef RCT_NEW_ARCH_ENABLED
|
|
2
|
-
#import <React/RCTViewManager.h>
|
|
3
|
-
#import <React/RCTUIManager.h>
|
|
4
|
-
#import "RCTBridge.h"
|
|
5
|
-
#import "Utils.h"
|
|
6
|
-
#import "RNSnapshotView.h"
|
|
7
|
-
|
|
8
|
-
@interface RNSnapshotRendererManager : RCTViewManager
|
|
9
|
-
@end
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
@interface RNSnapshotRenderer : UIView
|
|
13
|
-
|
|
14
|
-
@property (nonatomic, strong) NSString *snapshotID;
|
|
15
|
-
|
|
16
|
-
@end
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
@implementation RNSnapshotRenderer
|
|
20
|
-
|
|
21
|
-
{
|
|
22
|
-
UIView *_snapshotView;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
-(void)setSnapshotID:(NSString *)snapshotID {
|
|
27
|
-
if (![snapshotID isEqualToString:_snapshotID]) {
|
|
28
|
-
_snapshotID = snapshotID;
|
|
29
|
-
if(_snapshotView) {
|
|
30
|
-
[_snapshotView removeFromSuperview];
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
NSDictionary<NSString *, UIView *> *snapshotMap = [RNSnapshotView getSnapShotMap];
|
|
34
|
-
_snapshotView = snapshotMap[snapshotID];
|
|
35
|
-
if (_snapshotView != nil) {
|
|
36
|
-
self.autoresizesSubviews = YES;
|
|
37
|
-
_snapshotView.frame = self.bounds;
|
|
38
|
-
_snapshotView.autoresizingMask = (UIViewAutoresizingFlexibleWidth |
|
|
39
|
-
UIViewAutoresizingFlexibleHeight);
|
|
40
|
-
|
|
41
|
-
[self addSubview:_snapshotView];
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
@end
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
@implementation RNSnapshotRendererManager
|
|
50
|
-
|
|
51
|
-
RCT_EXPORT_MODULE(RNSnapshotRenderer)
|
|
52
|
-
|
|
53
|
-
- (UIView *)view
|
|
54
|
-
{
|
|
55
|
-
return [[RNSnapshotRenderer alloc] init];
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
RCT_EXPORT_VIEW_PROPERTY(snapshotID, NSString *)
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
@end
|
|
62
|
-
#endif
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["codegenNativeComponent"],"sourceRoot":"../../src","sources":["RNSnapshotRendererNativeComponent.ts"],"mappings":";;AAAA,OAAOA,sBAAsB,MAAM,yDAAyD;AAO5F,eAAeA,sBAAsB,CAAc,oBAAoB,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NativeRNSnapshotView.d.ts","sourceRoot":"","sources":["../../../../src/NativeRNSnapshotView.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACjD,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3C;;AAED,wBAAwE"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ViewProps } from 'react-native';
|
|
2
|
-
interface NativeProps extends ViewProps {
|
|
3
|
-
snapshotID?: string | null;
|
|
4
|
-
}
|
|
5
|
-
declare const _default: import("react-native/Libraries/Utilities/codegenNativeComponent").NativeComponentType<NativeProps>;
|
|
6
|
-
export default _default;
|
|
7
|
-
//# sourceMappingURL=RNSnapshotRendererNativeComponent.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RNSnapshotRendererNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/RNSnapshotRendererNativeComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,UAAU,WAAY,SAAQ,SAAS;IACrC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;;AAED,wBAAyE"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { View, ViewProps } from 'react-native';
|
|
2
|
-
export type SnapshotRendererProps = Omit<ViewProps, 'children'> & {
|
|
3
|
-
/**
|
|
4
|
-
* The ID of the snapshot to render.
|
|
5
|
-
* This ID is returned by the `captureSnapshot` function.
|
|
6
|
-
*/
|
|
7
|
-
snapshotID: string | null;
|
|
8
|
-
/**
|
|
9
|
-
* Whether to automatically release the snapshot when no longer displayed.
|
|
10
|
-
* @default true
|
|
11
|
-
*/
|
|
12
|
-
autoReleaseSnapshot?: boolean;
|
|
13
|
-
};
|
|
14
|
-
declare const _default: import("react").ForwardRefExoticComponent<Omit<ViewProps, "children"> & {
|
|
15
|
-
/**
|
|
16
|
-
* The ID of the snapshot to render.
|
|
17
|
-
* This ID is returned by the `captureSnapshot` function.
|
|
18
|
-
*/
|
|
19
|
-
snapshotID: string | null;
|
|
20
|
-
/**
|
|
21
|
-
* Whether to automatically release the snapshot when no longer displayed.
|
|
22
|
-
* @default true
|
|
23
|
-
*/
|
|
24
|
-
autoReleaseSnapshot?: boolean;
|
|
25
|
-
} & import("react").RefAttributes<View>>;
|
|
26
|
-
export default _default;
|
|
27
|
-
//# sourceMappingURL=SnapshotRenderer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SnapshotRenderer.d.ts","sourceRoot":"","sources":["../../../../src/SnapshotRenderer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAIpD,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG;IAChE;;;OAGG;IACH,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAC;;IAVA;;;OAGG;gBACS,MAAM,GAAG,IAAI;IACzB;;;OAGG;0BACmB,OAAO;;AA4B/B,wBAA4C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AA0BA;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,iBAAiB,EACb,IAAI,GACJ,MAAM,GACN,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,GACzB,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,GAC5B,OAAO,CAAC,MAAM,CAAC,CAMjB;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEjE;AAED,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { TurboModule } from 'react-native';
|
|
2
|
-
export interface Spec extends TurboModule {
|
|
3
|
-
captureSnapshot(target: number): Promise<string>;
|
|
4
|
-
releaseSnapshot(a: string): Promise<void>;
|
|
5
|
-
}
|
|
6
|
-
declare const _default: Spec;
|
|
7
|
-
export default _default;
|
|
8
|
-
//# sourceMappingURL=NativeRNSnapshotView.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NativeRNSnapshotView.d.ts","sourceRoot":"","sources":["../../../../src/NativeRNSnapshotView.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACjD,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3C;;AAED,wBAAwE"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ViewProps } from 'react-native';
|
|
2
|
-
interface NativeProps extends ViewProps {
|
|
3
|
-
snapshotID?: string | null;
|
|
4
|
-
}
|
|
5
|
-
declare const _default: import("react-native/Libraries/Utilities/codegenNativeComponent").NativeComponentType<NativeProps>;
|
|
6
|
-
export default _default;
|
|
7
|
-
//# sourceMappingURL=RNSnapshotRendererNativeComponent.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RNSnapshotRendererNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/RNSnapshotRendererNativeComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,UAAU,WAAY,SAAQ,SAAS;IACrC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;;AAED,wBAAyE"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { View, ViewProps } from 'react-native';
|
|
2
|
-
export type SnapshotRendererProps = Omit<ViewProps, 'children'> & {
|
|
3
|
-
/**
|
|
4
|
-
* The ID of the snapshot to render.
|
|
5
|
-
* This ID is returned by the `captureSnapshot` function.
|
|
6
|
-
*/
|
|
7
|
-
snapshotID: string | null;
|
|
8
|
-
/**
|
|
9
|
-
* Whether to automatically release the snapshot when no longer displayed.
|
|
10
|
-
* @default true
|
|
11
|
-
*/
|
|
12
|
-
autoReleaseSnapshot?: boolean;
|
|
13
|
-
};
|
|
14
|
-
declare const _default: import("react").ForwardRefExoticComponent<Omit<ViewProps, "children"> & {
|
|
15
|
-
/**
|
|
16
|
-
* The ID of the snapshot to render.
|
|
17
|
-
* This ID is returned by the `captureSnapshot` function.
|
|
18
|
-
*/
|
|
19
|
-
snapshotID: string | null;
|
|
20
|
-
/**
|
|
21
|
-
* Whether to automatically release the snapshot when no longer displayed.
|
|
22
|
-
* @default true
|
|
23
|
-
*/
|
|
24
|
-
autoReleaseSnapshot?: boolean;
|
|
25
|
-
} & import("react").RefAttributes<View>>;
|
|
26
|
-
export default _default;
|
|
27
|
-
//# sourceMappingURL=SnapshotRenderer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SnapshotRenderer.d.ts","sourceRoot":"","sources":["../../../../src/SnapshotRenderer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAIpD,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG;IAChE;;;OAGG;IACH,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAC;;IAVA;;;OAGG;gBACS,MAAM,GAAG,IAAI;IACzB;;;OAGG;0BACmB,OAAO;;AA4B/B,wBAA4C"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Captures a snapshot of a view. The snapshot can be rendered using the `SnapshotRenderer` component.
|
|
3
|
-
*
|
|
4
|
-
* @param componentOrHandle The view to capture. Can be a view ref or a native component handle.
|
|
5
|
-
* @returns A promise that resolves to the ID of the snapshot. The snapshot should be released when no longer needed.
|
|
6
|
-
*/
|
|
7
|
-
export declare function captureSnapshot(componentOrHandle: null | number | React.Component<any, any> | React.ComponentClass<any>): Promise<string>;
|
|
8
|
-
/**
|
|
9
|
-
* Releases a snapshot.
|
|
10
|
-
*
|
|
11
|
-
* @param snapshotID The ID of the snapshot to release.
|
|
12
|
-
* @returns A promise that resolves when the snapshot is released.
|
|
13
|
-
*/
|
|
14
|
-
export declare function releaseSnapshot(snapshotID: string): Promise<void>;
|
|
15
|
-
export { default as SnapshotRenderer } from './SnapshotRenderer';
|
|
16
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AA0BA;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,iBAAiB,EACb,IAAI,GACJ,MAAM,GACN,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,GACzB,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,GAC5B,OAAO,CAAC,MAAM,CAAC,CAMjB;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEjE;AAED,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|