react-native-sheet2 1.2.6 → 6.1.16
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 +1 -1
- package/README.md +51 -32
- package/{react-native-sheet.podspec → Sheet.podspec} +7 -6
- package/android/build.gradle +43 -25
- package/android/generated/java/com/facebook/react/viewmanagers/SheetViewManagerDelegate.java +67 -0
- package/android/generated/java/com/facebook/react/viewmanagers/SheetViewManagerInterface.java +27 -0
- package/android/generated/java/com/sheet/NativeSheetSpec.java +78 -0
- package/android/generated/jni/CMakeLists.txt +36 -0
- package/android/generated/jni/RNSheetViewSpec-generated.cpp +50 -0
- package/android/generated/jni/RNSheetViewSpec.h +31 -0
- package/android/generated/jni/react/renderer/components/RNSheetViewSpec/ComponentDescriptors.cpp +22 -0
- package/android/generated/jni/react/renderer/components/RNSheetViewSpec/ComponentDescriptors.h +24 -0
- package/android/generated/jni/react/renderer/components/RNSheetViewSpec/EventEmitters.cpp +24 -0
- package/android/generated/jni/react/renderer/components/RNSheetViewSpec/EventEmitters.h +25 -0
- package/android/generated/jni/react/renderer/components/RNSheetViewSpec/Props.cpp +33 -0
- package/android/generated/jni/react/renderer/components/RNSheetViewSpec/Props.h +36 -0
- package/android/generated/jni/react/renderer/components/RNSheetViewSpec/RNSheetViewSpecJSI-generated.cpp +46 -0
- package/android/generated/jni/react/renderer/components/RNSheetViewSpec/RNSheetViewSpecJSI.h +98 -0
- package/android/generated/jni/react/renderer/components/RNSheetViewSpec/ShadowNodes.cpp +17 -0
- package/android/generated/jni/react/renderer/components/RNSheetViewSpec/ShadowNodes.h +32 -0
- package/android/generated/jni/react/renderer/components/RNSheetViewSpec/States.cpp +16 -0
- package/android/generated/jni/react/renderer/components/RNSheetViewSpec/States.h +29 -0
- package/android/gradle.properties +4 -5
- package/android/src/main/AndroidManifest.xml +0 -9
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/behavior/BottomSheetBehavior.java +10 -17
- package/android/src/main/java/com/sheet/AppFittedSheet.kt +107 -39
- package/android/src/main/java/com/sheet/BaseRNView.kt +81 -33
- package/android/src/main/java/com/sheet/CustomBottomSheetDialog.java +8 -0
- package/android/src/main/java/com/sheet/DialogRootViewGroup.kt +44 -33
- package/android/src/main/java/com/sheet/FragmentModalBottomSheet.kt +12 -2
- package/android/src/main/java/com/sheet/SafeAreaUtils.kt +90 -0
- package/android/src/main/java/com/sheet/SheetDismissEvent.kt +20 -0
- package/android/src/main/java/com/sheet/SheetModule.kt +37 -0
- package/android/src/main/java/com/sheet/SheetPackage.kt +32 -6
- package/android/src/main/java/com/sheet/SheetView.kt +5 -0
- package/android/src/main/java/com/sheet/SheetViewManager.kt +77 -56
- package/android/src/main/java/com/sheet/utils.kt +2 -10
- package/android/src/main/res/layout/dialog_bottom_sheet.xml +2 -2
- package/android/src/main/res/values/styles.xml +9 -0
- package/ios/FittedSheets/SheetContentViewController.swift +4 -4
- package/ios/FittedSheets/SheetViewController.swift +29 -100
- package/ios/HostFittedSheet.swift +271 -0
- package/ios/Sheet-Bridging-Header.h +1 -0
- package/ios/SheetModule.h +10 -0
- package/ios/SheetModule.mm +67 -0
- package/ios/SheetView.h +14 -0
- package/ios/SheetView.mm +124 -0
- package/ios/generated/RNSheetViewSpec/ComponentDescriptors.cpp +22 -0
- package/ios/generated/RNSheetViewSpec/ComponentDescriptors.h +24 -0
- package/ios/generated/RNSheetViewSpec/EventEmitters.cpp +24 -0
- package/ios/generated/RNSheetViewSpec/EventEmitters.h +25 -0
- package/ios/generated/RNSheetViewSpec/Props.cpp +33 -0
- package/ios/generated/RNSheetViewSpec/Props.h +36 -0
- package/ios/generated/RNSheetViewSpec/RCTComponentViewHelpers.h +44 -0
- package/ios/generated/RNSheetViewSpec/RNSheetViewSpec-generated.mm +60 -0
- package/ios/generated/RNSheetViewSpec/RNSheetViewSpec.h +100 -0
- package/ios/generated/RNSheetViewSpec/ShadowNodes.cpp +17 -0
- package/ios/generated/RNSheetViewSpec/ShadowNodes.h +32 -0
- package/ios/generated/RNSheetViewSpec/States.cpp +16 -0
- package/ios/generated/RNSheetViewSpec/States.h +29 -0
- package/ios/generated/RNSheetViewSpecJSI-generated.cpp +46 -0
- package/ios/generated/RNSheetViewSpecJSI.h +98 -0
- package/lib/module/FittedSheet.js +153 -0
- package/lib/module/FittedSheet.js.map +1 -0
- package/lib/module/NativeSheet.ts +17 -0
- package/lib/module/PublicSheetView.js +48 -0
- package/lib/module/PublicSheetView.js.map +1 -0
- package/lib/module/SheetViewNativeComponent.ts +31 -0
- package/lib/module/index.js +13 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/FittedSheet.d.ts +51 -0
- package/lib/typescript/src/FittedSheet.d.ts.map +1 -0
- package/lib/typescript/src/NativeSheet.d.ts +16 -0
- package/lib/typescript/src/NativeSheet.d.ts.map +1 -0
- package/lib/typescript/src/PublicSheetView.d.ts +12 -0
- package/lib/typescript/src/PublicSheetView.d.ts.map +1 -0
- package/lib/typescript/src/SheetViewNativeComponent.d.ts +22 -0
- package/lib/typescript/src/SheetViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +8 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +109 -42
- package/react-native.config.js +12 -0
- package/src/FittedSheet.tsx +118 -95
- package/src/NativeSheet.ts +17 -0
- package/src/PublicSheetView.tsx +66 -0
- package/src/SheetViewNativeComponent.ts +31 -0
- package/src/index.tsx +26 -8
- package/android/src/main/java/com/modal/FullScreenDialog.kt +0 -100
- package/android/src/main/java/com/modal/TopModalView.kt +0 -77
- package/android/src/main/java/com/modal/TopModalViewManager.kt +0 -83
- package/android/src/main/java/com/modal/TopModalViewModule.kt +0 -40
- package/android/src/main/java/com/sheet/SheetViewModule.kt +0 -41
- package/ios/LBBottomSheet/BottomSheetConstant.swift +0 -48
- package/ios/LBBottomSheet/Model/BottomSheetController+Behavior.swift +0 -262
- package/ios/LBBottomSheet/Model/BottomSheetController+Theme.swift +0 -156
- package/ios/LBBottomSheet/Protocols/BottomSheetInteractionDelegate.swift +0 -29
- package/ios/LBBottomSheet/Protocols/BottomSheetPositionDelegate.swift +0 -31
- package/ios/LBBottomSheet/UI/BottomSheet.storyboard +0 -105
- package/ios/LBBottomSheet/UI/BottomSheetController.swift +0 -601
- package/ios/LBBottomSheet/Utils/Components/ForwardingEventsView.swift +0 -60
- package/ios/LBBottomSheet/Utils/Extensions/CACornerMask+Extension.swift +0 -33
- package/ios/LBBottomSheet/Utils/Extensions/Mirror+Extension.swift +0 -47
- package/ios/LBBottomSheet/Utils/Extensions/UIApplication+Extension.swift +0 -35
- package/ios/LBBottomSheet/Utils/Extensions/UIColor+Extension.swift +0 -61
- package/ios/LBBottomSheet/Utils/Extensions/UIGestureRecognizer+Extensions.swift +0 -28
- package/ios/LBBottomSheet/Utils/Extensions/UIScreen+Extension.swift +0 -28
- package/ios/LBBottomSheet/Utils/Extensions/UIScrollView+Extension.swift +0 -25
- package/ios/LBBottomSheet/Utils/Extensions/UIView+Extension.swift +0 -52
- package/ios/LBBottomSheet/Utils/Extensions/UIViewController+Extension.swift +0 -104
- package/ios/Sheet.xcodeproj/project.pbxproj +0 -377
- package/ios/SheetViewManager.m +0 -25
- package/ios/SheetViewManager.swift +0 -324
- package/ios/TopModalViewManager.swift +0 -196
- package/src/TopModal.tsx +0 -94
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2025 SergeyMild
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
5
|
of this software and associated documentation files (the "Software"), to deal
|
|
6
6
|
in the Software without restriction, including without limitation the rights
|
package/README.md
CHANGED
|
@@ -7,59 +7,83 @@ Native implementation of Bottom sheet
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
9
9
|
```sh
|
|
10
|
-
"react-native-sheet": "1.
|
|
10
|
+
"react-native-sheet": "sergeymild/react-native-sheet#6.1.10"
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
## Usage
|
|
14
14
|
|
|
15
15
|
```typescript
|
|
16
16
|
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
FittedSheet,
|
|
18
|
+
attachScrollViewToFittedSheet,
|
|
19
|
+
FittedSheetRef,
|
|
20
|
+
presentFittedSheet,
|
|
21
|
+
dismissFittedSheetsAll,
|
|
22
|
+
dismissFittedPresented,
|
|
20
23
|
} from 'react-native-sheet';
|
|
21
24
|
import { ScrollView, TouchableOpacity } from 'react-native';
|
|
22
25
|
|
|
23
26
|
|
|
24
27
|
const RenderSheetComponent: React.FC = () => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
const [isLoading, setLoading] = useState(true)
|
|
29
|
+
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
setTimeout(() => setLoading(false), 1000)
|
|
32
|
+
}, [])
|
|
33
|
+
|
|
34
|
+
if (isLoading) {
|
|
35
|
+
return <View style={{height: 200}}/>
|
|
36
|
+
}
|
|
29
37
|
|
|
30
38
|
return (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
/>
|
|
39
|
+
// if scrollView creates dynamically in bottom sheet (for example after loading)
|
|
40
|
+
// you have call attachScrollViewToFittedSheet to enable nestedScroll
|
|
41
|
+
<ScrollView onLayout={() => attachScrollViewToFittedSheet("textSheet")}/>
|
|
35
42
|
)
|
|
36
43
|
}
|
|
37
44
|
|
|
38
45
|
const App: React.FC = () => {
|
|
39
|
-
const sheetRef = useRef<
|
|
40
|
-
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
// if scrollView creates dynamically in bottom sheet (for example after loading)
|
|
43
|
-
// you have to pass nativeID of scroll view by calling passScrollViewReactTag
|
|
44
|
-
sheetRef.current?.passScrollViewReactTag('scrollView')
|
|
45
|
-
}, [])
|
|
46
|
+
const sheetRef = useRef<FittedSheetRef>(null);
|
|
46
47
|
|
|
47
48
|
return (
|
|
48
49
|
<>
|
|
49
|
-
<TouchableOpacity
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
<TouchableOpacity
|
|
51
|
+
onPress={() => {
|
|
52
|
+
// show also accept params which will be passed to render function
|
|
53
|
+
sheetRef.current?.show()
|
|
54
|
+
// or you can call just pass the name of sheet which want to show
|
|
55
|
+
// in this case there is no need to store ref on Sheet
|
|
56
|
+
presentFittedSheet("textSheet")
|
|
57
|
+
}}
|
|
58
|
+
children={<Text children="Show sheet</"/>}
|
|
59
|
+
/>
|
|
60
|
+
|
|
61
|
+
<TouchableOpacity
|
|
62
|
+
onPress={() => {
|
|
63
|
+
// dismiss presented and all in queue sheets without animation
|
|
64
|
+
dismissFittedSheetsAll()
|
|
65
|
+
|
|
66
|
+
// dismiss top presented sheet
|
|
67
|
+
dismissFittedPresented()
|
|
68
|
+
}}
|
|
69
|
+
children={<Text children="Dismiss sheet</"/>}
|
|
70
|
+
/>
|
|
55
71
|
|
|
56
72
|
|
|
57
73
|
<FittedSheet
|
|
74
|
+
// can be any string.
|
|
75
|
+
// with this name sheet can be dismissed or presented via methods by passing that name
|
|
76
|
+
// `presentFittedSheet`, `dismissFittedSheet`
|
|
77
|
+
name="textSheet"
|
|
58
78
|
ref={sheetRef}
|
|
59
79
|
onSheetDismiss={(paramsPassedToHideMethod) => {
|
|
60
80
|
// called when sheet completely hided
|
|
61
81
|
}}
|
|
62
82
|
params={{
|
|
83
|
+
// if max min should be setted as max height
|
|
84
|
+
applyMaxHeightToMinHeight: true | false,
|
|
85
|
+
// allow to dismiss
|
|
86
|
+
dismissable: false | true,
|
|
63
87
|
// top left right corner sheet view radius
|
|
64
88
|
topLeftRightCornerRadius: 20,
|
|
65
89
|
// background color of sheet view
|
|
@@ -76,13 +100,8 @@ const App: React.FC = () => {
|
|
|
76
100
|
isSystemUILight: false
|
|
77
101
|
}}
|
|
78
102
|
>
|
|
79
|
-
// data which was passed to .show() method
|
|
80
|
-
{(data) =>
|
|
81
|
-
return (
|
|
82
|
-
<RenderSheetComponent/>
|
|
83
|
-
);
|
|
84
|
-
}}
|
|
85
|
-
|
|
103
|
+
// data which was passed to .show() method or in presentFittedSheet methods
|
|
104
|
+
{(data) => <RenderSheetComponent/>)}
|
|
86
105
|
// if you do not need data you can omit render function and pass just component
|
|
87
106
|
<RenderSheetComponent/>
|
|
88
107
|
</FittedSheet>
|
|
@@ -1,21 +1,22 @@
|
|
|
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
|
-
s.name = "
|
|
6
|
+
s.name = "Sheet"
|
|
8
7
|
s.version = package["version"]
|
|
9
8
|
s.summary = package["description"]
|
|
10
9
|
s.homepage = package["homepage"]
|
|
11
10
|
s.license = package["license"]
|
|
12
11
|
s.authors = package["author"]
|
|
13
12
|
|
|
14
|
-
s.platforms = { :ios =>
|
|
13
|
+
s.platforms = { :ios => min_ios_version_supported }
|
|
15
14
|
s.source = { :git => "https://github.com/sergeymild/react-native-sheet.git", :tag => "#{s.version}" }
|
|
16
15
|
|
|
17
|
-
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
18
|
-
s.
|
|
16
|
+
s.source_files = "ios/**/*.{h,m,mm,cpp,swift}"
|
|
17
|
+
s.public_header_files = 'ios/Sheet-Bridging-Header.h'
|
|
18
|
+
s.swift_version = '5.0'
|
|
19
|
+
|
|
20
|
+
install_modules_dependencies(s)
|
|
19
21
|
|
|
20
|
-
s.dependency "React-Core"
|
|
21
22
|
end
|
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['Sheet_' + name]
|
|
4
|
+
}
|
|
4
5
|
|
|
5
6
|
repositories {
|
|
6
7
|
google()
|
|
@@ -8,39 +9,53 @@ 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 isNewArchitectureEnabled() {
|
|
18
|
-
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
19
|
-
}
|
|
20
18
|
|
|
21
19
|
apply plugin: "com.android.library"
|
|
22
20
|
apply plugin: "kotlin-android"
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
apply plugin: "com.facebook.react"
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
def getExtOrDefault(name) {
|
|
29
|
-
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["Sheet_" + name]
|
|
30
|
-
}
|
|
22
|
+
apply plugin: "com.facebook.react"
|
|
31
23
|
|
|
32
24
|
def getExtOrIntegerDefault(name) {
|
|
33
25
|
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["Sheet_" + name]).toInteger()
|
|
34
26
|
}
|
|
35
27
|
|
|
28
|
+
def supportsNamespace() {
|
|
29
|
+
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
|
|
30
|
+
def major = parsed[0].toInteger()
|
|
31
|
+
def minor = parsed[1].toInteger()
|
|
32
|
+
|
|
33
|
+
// Namespace support was added in 7.3.0
|
|
34
|
+
return (major == 7 && minor >= 3) || major >= 8
|
|
35
|
+
}
|
|
36
|
+
|
|
36
37
|
android {
|
|
38
|
+
if (supportsNamespace()) {
|
|
39
|
+
namespace "com.sheet"
|
|
40
|
+
|
|
41
|
+
sourceSets {
|
|
42
|
+
main {
|
|
43
|
+
manifest.srcFile "src/main/AndroidManifestNew.xml"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
37
48
|
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
38
49
|
|
|
39
50
|
defaultConfig {
|
|
40
51
|
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
41
52
|
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
42
|
-
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
43
53
|
}
|
|
54
|
+
|
|
55
|
+
buildFeatures {
|
|
56
|
+
buildConfig true
|
|
57
|
+
}
|
|
58
|
+
|
|
44
59
|
buildTypes {
|
|
45
60
|
release {
|
|
46
61
|
minifyEnabled false
|
|
@@ -56,6 +71,14 @@ android {
|
|
|
56
71
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
57
72
|
}
|
|
58
73
|
|
|
74
|
+
sourceSets {
|
|
75
|
+
main {
|
|
76
|
+
java.srcDirs += [
|
|
77
|
+
"generated/java",
|
|
78
|
+
"generated/jni"
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
}
|
|
59
82
|
}
|
|
60
83
|
|
|
61
84
|
repositories {
|
|
@@ -66,18 +89,13 @@ repositories {
|
|
|
66
89
|
def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
67
90
|
|
|
68
91
|
dependencies {
|
|
69
|
-
|
|
70
|
-
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
|
|
71
|
-
//noinspection GradleDynamicVersion
|
|
72
|
-
implementation "com.facebook.react:react-native"
|
|
92
|
+
implementation "com.facebook.react:react-android"
|
|
73
93
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
74
94
|
implementation 'com.google.android.material:material:1.9.0'
|
|
75
95
|
}
|
|
76
96
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
codegenJavaPackageName = "com.sheet"
|
|
82
|
-
}
|
|
97
|
+
react {
|
|
98
|
+
jsRootDir = file("../src/")
|
|
99
|
+
libraryName = "SheetView"
|
|
100
|
+
codegenJavaPackageName = "com.sheet"
|
|
83
101
|
}
|
|
@@ -0,0 +1,67 @@
|
|
|
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.bridge.ColorPropConverter;
|
|
15
|
+
import com.facebook.react.bridge.ReadableArray;
|
|
16
|
+
import com.facebook.react.uimanager.BaseViewManager;
|
|
17
|
+
import com.facebook.react.uimanager.BaseViewManagerDelegate;
|
|
18
|
+
import com.facebook.react.uimanager.LayoutShadowNode;
|
|
19
|
+
|
|
20
|
+
public class SheetViewManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & SheetViewManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
|
|
21
|
+
public SheetViewManagerDelegate(U viewManager) {
|
|
22
|
+
super(viewManager);
|
|
23
|
+
}
|
|
24
|
+
@Override
|
|
25
|
+
public void setProperty(T view, String propName, @Nullable Object value) {
|
|
26
|
+
switch (propName) {
|
|
27
|
+
case "dismissable":
|
|
28
|
+
mViewManager.setDismissable(view, value == null ? false : (boolean) value);
|
|
29
|
+
break;
|
|
30
|
+
case "maxWidth":
|
|
31
|
+
mViewManager.setMaxWidth(view, value == null ? 0f : ((Double) value).doubleValue());
|
|
32
|
+
break;
|
|
33
|
+
case "maxHeight":
|
|
34
|
+
mViewManager.setMaxHeight(view, value == null ? 0f : ((Double) value).doubleValue());
|
|
35
|
+
break;
|
|
36
|
+
case "minHeight":
|
|
37
|
+
mViewManager.setMinHeight(view, value == null ? 0f : ((Double) value).doubleValue());
|
|
38
|
+
break;
|
|
39
|
+
case "calculatedHeight":
|
|
40
|
+
mViewManager.setCalculatedHeight(view, value == null ? 0f : ((Double) value).doubleValue());
|
|
41
|
+
break;
|
|
42
|
+
case "topLeftRightCornerRadius":
|
|
43
|
+
mViewManager.setTopLeftRightCornerRadius(view, value == null ? 0f : ((Double) value).doubleValue());
|
|
44
|
+
break;
|
|
45
|
+
case "isSystemUILight":
|
|
46
|
+
mViewManager.setIsSystemUILight(view, value == null ? false : (boolean) value);
|
|
47
|
+
break;
|
|
48
|
+
case "passScrollViewReactTag":
|
|
49
|
+
mViewManager.setPassScrollViewReactTag(view, value == null ? null : (String) value);
|
|
50
|
+
break;
|
|
51
|
+
case "sheetBackgroundColor":
|
|
52
|
+
mViewManager.setSheetBackgroundColor(view, ColorPropConverter.getColor(value, view.getContext()));
|
|
53
|
+
break;
|
|
54
|
+
default:
|
|
55
|
+
super.setProperty(view, propName, value);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@Override
|
|
60
|
+
public void receiveCommand(T view, String commandName, @Nullable ReadableArray args) {
|
|
61
|
+
switch (commandName) {
|
|
62
|
+
case "dismissSheet":
|
|
63
|
+
mViewManager.dismissSheet(view);
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
|
|
15
|
+
|
|
16
|
+
public interface SheetViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
|
|
17
|
+
void setDismissable(T view, boolean value);
|
|
18
|
+
void setMaxWidth(T view, double value);
|
|
19
|
+
void setMaxHeight(T view, double value);
|
|
20
|
+
void setMinHeight(T view, double value);
|
|
21
|
+
void setCalculatedHeight(T view, double value);
|
|
22
|
+
void setTopLeftRightCornerRadius(T view, double value);
|
|
23
|
+
void setIsSystemUILight(T view, boolean value);
|
|
24
|
+
void setPassScrollViewReactTag(T view, @Nullable String value);
|
|
25
|
+
void setSheetBackgroundColor(T view, @Nullable Integer value);
|
|
26
|
+
void dismissSheet(T view);
|
|
27
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
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.sheet;
|
|
14
|
+
|
|
15
|
+
import com.facebook.proguard.annotations.DoNotStrip;
|
|
16
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
17
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
18
|
+
import com.facebook.react.bridge.ReactMethod;
|
|
19
|
+
import com.facebook.react.bridge.WritableMap;
|
|
20
|
+
import com.facebook.react.common.build.ReactBuildConfig;
|
|
21
|
+
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
|
|
22
|
+
import java.util.Arrays;
|
|
23
|
+
import java.util.HashSet;
|
|
24
|
+
import java.util.Map;
|
|
25
|
+
import java.util.Set;
|
|
26
|
+
import javax.annotation.Nonnull;
|
|
27
|
+
import javax.annotation.Nullable;
|
|
28
|
+
|
|
29
|
+
public abstract class NativeSheetSpec extends ReactContextBaseJavaModule implements TurboModule {
|
|
30
|
+
public static final String NAME = "Sheet";
|
|
31
|
+
|
|
32
|
+
public NativeSheetSpec(ReactApplicationContext reactContext) {
|
|
33
|
+
super(reactContext);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@Override
|
|
37
|
+
public @Nonnull String getName() {
|
|
38
|
+
return NAME;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
protected abstract Map<String, Object> getTypedExportedConstants();
|
|
42
|
+
|
|
43
|
+
@Override
|
|
44
|
+
@DoNotStrip
|
|
45
|
+
public final @Nullable Map<String, Object> getConstants() {
|
|
46
|
+
Map<String, Object> constants = getTypedExportedConstants();
|
|
47
|
+
if (ReactBuildConfig.DEBUG || ReactBuildConfig.IS_INTERNAL_BUILD) {
|
|
48
|
+
Set<String> obligatoryFlowConstants = new HashSet<>(Arrays.asList(
|
|
49
|
+
"insets"
|
|
50
|
+
));
|
|
51
|
+
Set<String> optionalFlowConstants = new HashSet<>();
|
|
52
|
+
Set<String> undeclaredConstants = new HashSet<>(constants.keySet());
|
|
53
|
+
undeclaredConstants.removeAll(obligatoryFlowConstants);
|
|
54
|
+
undeclaredConstants.removeAll(optionalFlowConstants);
|
|
55
|
+
if (!undeclaredConstants.isEmpty()) {
|
|
56
|
+
throw new IllegalStateException(String.format("Native Module Flow doesn't declare constants: %s", undeclaredConstants));
|
|
57
|
+
}
|
|
58
|
+
undeclaredConstants = obligatoryFlowConstants;
|
|
59
|
+
undeclaredConstants.removeAll(constants.keySet());
|
|
60
|
+
if (!undeclaredConstants.isEmpty()) {
|
|
61
|
+
throw new IllegalStateException(String.format("Native Module doesn't fill in constants: %s", undeclaredConstants));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return constants;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
68
|
+
@DoNotStrip
|
|
69
|
+
public abstract WritableMap viewportSize();
|
|
70
|
+
|
|
71
|
+
@ReactMethod
|
|
72
|
+
@DoNotStrip
|
|
73
|
+
public abstract void dismissAll();
|
|
74
|
+
|
|
75
|
+
@ReactMethod
|
|
76
|
+
@DoNotStrip
|
|
77
|
+
public abstract void dismissPresented();
|
|
78
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
#
|
|
3
|
+
# This source code is licensed under the MIT license found in the
|
|
4
|
+
# LICENSE file in the root directory of this source tree.
|
|
5
|
+
|
|
6
|
+
cmake_minimum_required(VERSION 3.13)
|
|
7
|
+
set(CMAKE_VERBOSE_MAKEFILE on)
|
|
8
|
+
|
|
9
|
+
file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/RNSheetViewSpec/*.cpp)
|
|
10
|
+
|
|
11
|
+
add_library(
|
|
12
|
+
react_codegen_RNSheetViewSpec
|
|
13
|
+
OBJECT
|
|
14
|
+
${react_codegen_SRCS}
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
target_include_directories(react_codegen_RNSheetViewSpec PUBLIC . react/renderer/components/RNSheetViewSpec)
|
|
18
|
+
|
|
19
|
+
target_link_libraries(
|
|
20
|
+
react_codegen_RNSheetViewSpec
|
|
21
|
+
fbjni
|
|
22
|
+
jsi
|
|
23
|
+
# We need to link different libraries based on whether we are building rncore or not, that's necessary
|
|
24
|
+
# because we want to break a circular dependency between react_codegen_rncore and reactnative
|
|
25
|
+
reactnative
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
target_compile_options(
|
|
29
|
+
react_codegen_RNSheetViewSpec
|
|
30
|
+
PRIVATE
|
|
31
|
+
-DLOG_TAG=\"ReactNative\"
|
|
32
|
+
-fexceptions
|
|
33
|
+
-frtti
|
|
34
|
+
-std=c++20
|
|
35
|
+
-Wall
|
|
36
|
+
)
|
|
@@ -0,0 +1,50 @@
|
|
|
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 "RNSheetViewSpec.h"
|
|
12
|
+
|
|
13
|
+
namespace facebook::react {
|
|
14
|
+
|
|
15
|
+
static facebook::jsi::Value __hostFunction_NativeSheetSpecJSI_getConstants(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, ObjectKind, "getConstants", "()Ljava/util/Map;", args, count, cachedMethodId);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static facebook::jsi::Value __hostFunction_NativeSheetSpecJSI_viewportSize(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, ObjectKind, "viewportSize", "()Lcom/facebook/react/bridge/WritableMap;", args, count, cachedMethodId);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
static facebook::jsi::Value __hostFunction_NativeSheetSpecJSI_dismissAll(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
26
|
+
static jmethodID cachedMethodId = nullptr;
|
|
27
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "dismissAll", "()V", args, count, cachedMethodId);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static facebook::jsi::Value __hostFunction_NativeSheetSpecJSI_dismissPresented(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
31
|
+
static jmethodID cachedMethodId = nullptr;
|
|
32
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "dismissPresented", "()V", args, count, cachedMethodId);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
NativeSheetSpecJSI::NativeSheetSpecJSI(const JavaTurboModule::InitParams ¶ms)
|
|
36
|
+
: JavaTurboModule(params) {
|
|
37
|
+
methodMap_["getConstants"] = MethodMetadata {0, __hostFunction_NativeSheetSpecJSI_getConstants};
|
|
38
|
+
methodMap_["viewportSize"] = MethodMetadata {0, __hostFunction_NativeSheetSpecJSI_viewportSize};
|
|
39
|
+
methodMap_["dismissAll"] = MethodMetadata {0, __hostFunction_NativeSheetSpecJSI_dismissAll};
|
|
40
|
+
methodMap_["dismissPresented"] = MethodMetadata {0, __hostFunction_NativeSheetSpecJSI_dismissPresented};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
std::shared_ptr<TurboModule> RNSheetViewSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms) {
|
|
44
|
+
if (moduleName == "Sheet") {
|
|
45
|
+
return std::make_shared<NativeSheetSpecJSI>(params);
|
|
46
|
+
}
|
|
47
|
+
return nullptr;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
} // 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 'NativeSheet'
|
|
21
|
+
*/
|
|
22
|
+
class JSI_EXPORT NativeSheetSpecJSI : public JavaTurboModule {
|
|
23
|
+
public:
|
|
24
|
+
NativeSheetSpecJSI(const JavaTurboModule::InitParams ¶ms);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
JSI_EXPORT
|
|
29
|
+
std::shared_ptr<TurboModule> RNSheetViewSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms);
|
|
30
|
+
|
|
31
|
+
} // namespace facebook::react
|
package/android/generated/jni/react/renderer/components/RNSheetViewSpec/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 RNSheetViewSpec_registerComponentDescriptorsFromCodegen(
|
|
18
|
+
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry) {
|
|
19
|
+
registry->add(concreteComponentDescriptorProvider<SheetViewComponentDescriptor>());
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
} // namespace facebook::react
|
package/android/generated/jni/react/renderer/components/RNSheetViewSpec/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 SheetViewComponentDescriptor = ConcreteComponentDescriptor<SheetViewShadowNode>;
|
|
20
|
+
|
|
21
|
+
void RNSheetViewSpec_registerComponentDescriptorsFromCodegen(
|
|
22
|
+
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry);
|
|
23
|
+
|
|
24
|
+
} // namespace facebook::react
|
|
@@ -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: GenerateEventEmitterCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include "EventEmitters.h"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
namespace facebook::react {
|
|
15
|
+
|
|
16
|
+
void SheetViewEventEmitter::onSheetDismiss(OnSheetDismiss $event) const {
|
|
17
|
+
dispatchEvent("sheetDismiss", [](jsi::Runtime &runtime) {
|
|
18
|
+
auto $payload = jsi::Object(runtime);
|
|
19
|
+
|
|
20
|
+
return $payload;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
} // 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: GenerateEventEmitterH.js
|
|
9
|
+
*/
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
#include <react/renderer/components/view/ViewEventEmitter.h>
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
class SheetViewEventEmitter : public ViewEventEmitter {
|
|
17
|
+
public:
|
|
18
|
+
using ViewEventEmitter::ViewEventEmitter;
|
|
19
|
+
|
|
20
|
+
struct OnSheetDismiss {
|
|
21
|
+
|
|
22
|
+
};
|
|
23
|
+
void onSheetDismiss(OnSheetDismiss value) const;
|
|
24
|
+
};
|
|
25
|
+
} // namespace facebook::react
|