@onekeyfe/react-native-tab-view 1.1.31
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/android/build.gradle +119 -0
- package/android/gradle.properties +4 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/rcttabview/ImageSource.kt +86 -0
- package/android/src/main/java/com/rcttabview/RCTTabView.kt +529 -0
- package/android/src/main/java/com/rcttabview/RCTTabViewManager.kt +204 -0
- package/android/src/main/java/com/rcttabview/RCTTabViewPackage.kt +16 -0
- package/android/src/main/java/com/rcttabview/TabInfo.kt +12 -0
- package/android/src/main/java/com/rcttabview/Utils.kt +31 -0
- package/android/src/main/java/com/rcttabview/events/OnNativeLayoutEvent.kt +20 -0
- package/android/src/main/java/com/rcttabview/events/OnTabBarMeasuredEvent.kt +19 -0
- package/android/src/main/java/com/rcttabview/events/PageSelectedEvent.kt +21 -0
- package/android/src/main/java/com/rcttabview/events/TabLongPressedEvent.kt +19 -0
- package/common/cpp/react/renderer/components/RNCTabView/RNCTabViewComponentDescriptor.h +32 -0
- package/common/cpp/react/renderer/components/RNCTabView/RNCTabViewShadowNode.cpp +18 -0
- package/common/cpp/react/renderer/components/RNCTabView/RNCTabViewShadowNode.h +35 -0
- package/common/cpp/react/renderer/components/RNCTabView/RNCTabViewState.cpp +15 -0
- package/common/cpp/react/renderer/components/RNCTabView/RNCTabViewState.h +25 -0
- package/ios/Extensions.swift +46 -0
- package/ios/RCTBottomAccessoryComponentView.h +12 -0
- package/ios/RCTBottomAccessoryComponentView.mm +67 -0
- package/ios/RCTBottomAccessoryContainerView.swift +51 -0
- package/ios/RCTTabViewComponentView.h +12 -0
- package/ios/RCTTabViewComponentView.mm +325 -0
- package/ios/RCTTabViewContainerView.swift +768 -0
- package/ios/RCTTabViewLog.h +7 -0
- package/ios/RCTTabViewLog.m +32 -0
- package/ios/SVG/CoreSVG.h +13 -0
- package/ios/SVG/CoreSVG.mm +177 -0
- package/ios/SVG/SvgDecoder.h +10 -0
- package/ios/SVG/SvgDecoder.mm +32 -0
- package/ios/TabBarFontSize.swift +55 -0
- package/lib/module/BottomAccessoryView.js +45 -0
- package/lib/module/BottomAccessoryView.js.map +1 -0
- package/lib/module/BottomAccessoryViewNativeComponent.ts +27 -0
- package/lib/module/DelayedFreeze.js +26 -0
- package/lib/module/DelayedFreeze.js.map +1 -0
- package/lib/module/NativeSVGDecoder.js +5 -0
- package/lib/module/NativeSVGDecoder.js.map +1 -0
- package/lib/module/SceneMap.js +28 -0
- package/lib/module/SceneMap.js.map +1 -0
- package/lib/module/TabView.js +263 -0
- package/lib/module/TabView.js.map +1 -0
- package/lib/module/TabViewNativeComponent.ts +68 -0
- package/lib/module/codegen-types.d.js +2 -0
- package/lib/module/codegen-types.d.js.map +1 -0
- package/lib/module/index.js +20 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/types.js +4 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/utils/BottomTabBarHeightContext.js +5 -0
- package/lib/module/utils/BottomTabBarHeightContext.js.map +1 -0
- package/lib/module/utils/useBottomTabBarHeight.js +12 -0
- package/lib/module/utils/useBottomTabBarHeight.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/BottomAccessoryView.d.ts +8 -0
- package/lib/typescript/src/BottomAccessoryView.d.ts.map +1 -0
- package/lib/typescript/src/BottomAccessoryViewNativeComponent.d.ts +16 -0
- package/lib/typescript/src/BottomAccessoryViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/DelayedFreeze.d.ts +8 -0
- package/lib/typescript/src/DelayedFreeze.d.ts.map +1 -0
- package/lib/typescript/src/NativeSVGDecoder.d.ts +6 -0
- package/lib/typescript/src/NativeSVGDecoder.d.ts.map +1 -0
- package/lib/typescript/src/SceneMap.d.ts +10 -0
- package/lib/typescript/src/SceneMap.d.ts.map +1 -0
- package/lib/typescript/src/TabView.d.ts +178 -0
- package/lib/typescript/src/TabView.d.ts.map +1 -0
- package/lib/typescript/src/TabViewNativeComponent.d.ts +55 -0
- package/lib/typescript/src/TabViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +16 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +29 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/lib/typescript/src/utils/BottomTabBarHeightContext.d.ts +3 -0
- package/lib/typescript/src/utils/BottomTabBarHeightContext.d.ts.map +1 -0
- package/lib/typescript/src/utils/useBottomTabBarHeight.d.ts +2 -0
- package/lib/typescript/src/utils/useBottomTabBarHeight.d.ts.map +1 -0
- package/package.json +114 -0
- package/react-native-tab-view.podspec +36 -0
- package/react-native.config.js +13 -0
- package/src/BottomAccessoryView.tsx +58 -0
- package/src/BottomAccessoryViewNativeComponent.ts +27 -0
- package/src/DelayedFreeze.tsx +27 -0
- package/src/NativeSVGDecoder.ts +5 -0
- package/src/SceneMap.tsx +34 -0
- package/src/TabView.tsx +466 -0
- package/src/TabViewNativeComponent.ts +68 -0
- package/src/codegen-types.d.ts +28 -0
- package/src/index.tsx +18 -0
- package/src/types.ts +31 -0
- package/src/utils/BottomTabBarHeightContext.ts +5 -0
- package/src/utils/useBottomTabBarHeight.ts +15 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
ext.getExtOrDefault = {name ->
|
|
3
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['RCTTabView_' + name]
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["RCTTabView_kotlinVersion"]
|
|
7
|
+
|
|
8
|
+
repositories {
|
|
9
|
+
google()
|
|
10
|
+
mavenCentral()
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
dependencies {
|
|
14
|
+
classpath "com.android.tools.build:gradle:8.7.2"
|
|
15
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
def isNewArchitectureEnabled() {
|
|
20
|
+
return true
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
def reactNativeArchitectures() {
|
|
24
|
+
def value = rootProject.getProperties().get("reactNativeArchitectures")
|
|
25
|
+
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
apply plugin: "com.android.library"
|
|
29
|
+
apply plugin: "kotlin-android"
|
|
30
|
+
|
|
31
|
+
if (isNewArchitectureEnabled()) {
|
|
32
|
+
apply plugin: "com.facebook.react"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
def getExtOrIntegerDefault(name) {
|
|
36
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["RCTTabView_" + name]).toInteger()
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
def supportsNamespace() {
|
|
40
|
+
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
|
|
41
|
+
def major = parsed[0].toInteger()
|
|
42
|
+
def minor = parsed[1].toInteger()
|
|
43
|
+
return (major == 7 && minor >= 3) || major >= 8
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
android {
|
|
47
|
+
if (supportsNamespace()) {
|
|
48
|
+
namespace "com.rcttabview"
|
|
49
|
+
|
|
50
|
+
sourceSets {
|
|
51
|
+
main {
|
|
52
|
+
manifest.srcFile "src/main/AndroidManifestNew.xml"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
58
|
+
|
|
59
|
+
defaultConfig {
|
|
60
|
+
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
61
|
+
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
62
|
+
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
buildFeatures {
|
|
66
|
+
buildConfig true
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
buildTypes {
|
|
70
|
+
release {
|
|
71
|
+
minifyEnabled false
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
lintOptions {
|
|
76
|
+
disable "GradleCompatible"
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
compileOptions {
|
|
80
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
81
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
sourceSets {
|
|
85
|
+
main {
|
|
86
|
+
java.srcDirs += [
|
|
87
|
+
// Codegen specs
|
|
88
|
+
"generated/java",
|
|
89
|
+
"generated/jni"
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
repositories {
|
|
96
|
+
mavenCentral()
|
|
97
|
+
google()
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
101
|
+
def COIL_VERSION = "3.0.2"
|
|
102
|
+
|
|
103
|
+
dependencies {
|
|
104
|
+
implementation "com.facebook.react:react-android"
|
|
105
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
106
|
+
implementation 'com.google.android.material:material:1.14.0-alpha05'
|
|
107
|
+
|
|
108
|
+
implementation("io.coil-kt.coil3:coil:${COIL_VERSION}")
|
|
109
|
+
implementation("io.coil-kt.coil3:coil-network-okhttp:${COIL_VERSION}")
|
|
110
|
+
implementation("io.coil-kt.coil3:coil-svg:${COIL_VERSION}")
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (isNewArchitectureEnabled()) {
|
|
114
|
+
react {
|
|
115
|
+
jsRootDir = file("../src/")
|
|
116
|
+
libraryName = "RNCTabView"
|
|
117
|
+
codegenJavaPackageName = "com.rcttabview"
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
package com.rcttabview
|
|
2
|
+
|
|
3
|
+
import android.annotation.SuppressLint
|
|
4
|
+
import android.content.Context
|
|
5
|
+
import android.net.Uri
|
|
6
|
+
import com.facebook.react.views.imagehelper.ResourceDrawableIdHelper
|
|
7
|
+
import java.util.Locale
|
|
8
|
+
|
|
9
|
+
data class ImageSource(
|
|
10
|
+
val context: Context,
|
|
11
|
+
val uri: String? = null,
|
|
12
|
+
) {
|
|
13
|
+
private fun isLocalResourceUri(uri: Uri?) = uri?.scheme?.startsWith("res") ?: false
|
|
14
|
+
|
|
15
|
+
fun getUri(context: Context): Uri? {
|
|
16
|
+
val uri = computeUri(context)
|
|
17
|
+
|
|
18
|
+
if (isLocalResourceUri(uri)) {
|
|
19
|
+
return Uri.parse(
|
|
20
|
+
uri!!.toString().replace("res:/", "android.resource://" + context.packageName + "/")
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return uri
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
private fun computeUri(context: Context): Uri? {
|
|
28
|
+
val stringUri = uri ?: return null
|
|
29
|
+
return try {
|
|
30
|
+
val uri: Uri = Uri.parse(stringUri)
|
|
31
|
+
// Verify scheme is set, so that relative uri (used by static resources) are not handled.
|
|
32
|
+
if (uri.scheme == null) {
|
|
33
|
+
computeLocalUri(stringUri, context)
|
|
34
|
+
} else {
|
|
35
|
+
uri
|
|
36
|
+
}
|
|
37
|
+
} catch (e: Exception) {
|
|
38
|
+
computeLocalUri(stringUri, context)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
private fun computeLocalUri(stringUri: String, context: Context): Uri? {
|
|
43
|
+
return ResourceIdHelper.getResourceUri(context, stringUri)
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Taken from https://github.com/expo/expo/blob/sdk-52/packages/expo-image/android/src/main/java/expo/modules/image/ResourceIdHelper.kt
|
|
48
|
+
object ResourceIdHelper {
|
|
49
|
+
private val idMap = mutableMapOf<String, Int>()
|
|
50
|
+
|
|
51
|
+
@SuppressLint("DiscouragedApi")
|
|
52
|
+
private fun getResourceRawId(context: Context, name: String): Int {
|
|
53
|
+
if (name.isEmpty()) {
|
|
54
|
+
return -1
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
val normalizedName = name.lowercase(Locale.ROOT).replace("-", "_")
|
|
58
|
+
synchronized(this) {
|
|
59
|
+
val id = idMap[normalizedName]
|
|
60
|
+
if (id != null) {
|
|
61
|
+
return id
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return context
|
|
65
|
+
.resources
|
|
66
|
+
.getIdentifier(normalizedName, "raw", context.packageName)
|
|
67
|
+
.also {
|
|
68
|
+
idMap[normalizedName] = it
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
fun getResourceUri(context: Context, name: String): Uri? {
|
|
74
|
+
val drawableUri = ResourceDrawableIdHelper.getInstance().getResourceDrawableUri(context, name)
|
|
75
|
+
if (drawableUri != Uri.EMPTY) {
|
|
76
|
+
return drawableUri
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
val resId = getResourceRawId(context, name)
|
|
80
|
+
return if (resId > 0) {
|
|
81
|
+
Uri.Builder().scheme("res").path(resId.toString()).build()
|
|
82
|
+
} else {
|
|
83
|
+
null
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|