react-native-sheet2 1.1.19

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.
Files changed (74) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +79 -0
  3. package/android/build.gradle +83 -0
  4. package/android/gradle.properties +6 -0
  5. package/android/src/main/AndroidManifest.xml +12 -0
  6. package/android/src/main/java/com/behavior/BottomSheetBehavior.java +2329 -0
  7. package/android/src/main/java/com/behavior/InsetsAnimationCallback.java +83 -0
  8. package/android/src/main/java/com/modal/FullScreenDialog.kt +100 -0
  9. package/android/src/main/java/com/modal/TopModalView.kt +77 -0
  10. package/android/src/main/java/com/modal/TopModalViewManager.kt +83 -0
  11. package/android/src/main/java/com/modal/TopModalViewModule.kt +36 -0
  12. package/android/src/main/java/com/sheet/AppFittedSheet.kt +149 -0
  13. package/android/src/main/java/com/sheet/BaseRNView.kt +73 -0
  14. package/android/src/main/java/com/sheet/CustomBottomSheetDialog.java +238 -0
  15. package/android/src/main/java/com/sheet/DialogRootViewGroup.kt +159 -0
  16. package/android/src/main/java/com/sheet/FragmentModalBottomSheet.kt +54 -0
  17. package/android/src/main/java/com/sheet/ReactNativeReflection.java +24 -0
  18. package/android/src/main/java/com/sheet/SheetPackage.kt +20 -0
  19. package/android/src/main/java/com/sheet/SheetViewManager.kt +144 -0
  20. package/android/src/main/java/com/sheet/SheetViewModule.kt +43 -0
  21. package/android/src/main/java/com/sheet/utils.kt +71 -0
  22. package/android/src/main/java/com/transparent/activity/ActivityModalView.kt +71 -0
  23. package/android/src/main/java/com/transparent/activity/TransparentActivity.kt +48 -0
  24. package/android/src/main/java/com/transparent/activity/TransparentActivityManager.kt +63 -0
  25. package/android/src/main/java/com/transparent/activity/TransparentActivityModule.kt +28 -0
  26. package/android/src/main/res/anim/fade_in.xml +8 -0
  27. package/android/src/main/res/anim/fade_out.xml +11 -0
  28. package/android/src/main/res/anim/slide_down.xml +8 -0
  29. package/android/src/main/res/anim/slide_up.xml +8 -0
  30. package/android/src/main/res/layout/dialog_bottom_sheet.xml +64 -0
  31. package/android/src/main/res/layout/item_full.xml +14 -0
  32. package/android/src/main/res/values/colors.xml +15 -0
  33. package/android/src/main/res/values/styles.xml +75 -0
  34. package/ios/FittedSheets/Compatible.swift +55 -0
  35. package/ios/FittedSheets/InitialTouchPanGestureRecognizer.swift +19 -0
  36. package/ios/FittedSheets/SheetContentViewController.swift +326 -0
  37. package/ios/FittedSheets/SheetContentViewDelegate.swift +17 -0
  38. package/ios/FittedSheets/SheetOptions.swift +100 -0
  39. package/ios/FittedSheets/SheetSize.swift +20 -0
  40. package/ios/FittedSheets/SheetTransition.swift +153 -0
  41. package/ios/FittedSheets/SheetView.swift +21 -0
  42. package/ios/FittedSheets/SheetViewController.swift +761 -0
  43. package/ios/FittedSheets/SheetViewDelegate.swift +16 -0
  44. package/ios/FittedSheets/UIColorExtension.swift +59 -0
  45. package/ios/FittedSheets/UIViewControllerExtension.swift +27 -0
  46. package/ios/FittedSheets/Yalta.swift +420 -0
  47. package/ios/LBBottomSheet/BottomSheetConstant.swift +48 -0
  48. package/ios/LBBottomSheet/Model/BottomSheetController+Behavior.swift +262 -0
  49. package/ios/LBBottomSheet/Model/BottomSheetController+Theme.swift +156 -0
  50. package/ios/LBBottomSheet/Protocols/BottomSheetInteractionDelegate.swift +29 -0
  51. package/ios/LBBottomSheet/Protocols/BottomSheetPositionDelegate.swift +31 -0
  52. package/ios/LBBottomSheet/UI/BottomSheet.storyboard +105 -0
  53. package/ios/LBBottomSheet/UI/BottomSheetController.swift +601 -0
  54. package/ios/LBBottomSheet/Utils/Components/ForwardingEventsView.swift +60 -0
  55. package/ios/LBBottomSheet/Utils/Extensions/CACornerMask+Extension.swift +33 -0
  56. package/ios/LBBottomSheet/Utils/Extensions/Mirror+Extension.swift +47 -0
  57. package/ios/LBBottomSheet/Utils/Extensions/UIApplication+Extension.swift +35 -0
  58. package/ios/LBBottomSheet/Utils/Extensions/UIColor+Extension.swift +61 -0
  59. package/ios/LBBottomSheet/Utils/Extensions/UIGestureRecognizer+Extensions.swift +28 -0
  60. package/ios/LBBottomSheet/Utils/Extensions/UIScreen+Extension.swift +28 -0
  61. package/ios/LBBottomSheet/Utils/Extensions/UIScrollView+Extension.swift +25 -0
  62. package/ios/LBBottomSheet/Utils/Extensions/UIView+Extension.swift +52 -0
  63. package/ios/LBBottomSheet/Utils/Extensions/UIViewController+Extension.swift +104 -0
  64. package/ios/Sheet-Bridging-Header.h +1 -0
  65. package/ios/Sheet.xcodeproj/project.pbxproj +377 -0
  66. package/ios/SheetViewManager.m +27 -0
  67. package/ios/SheetViewManager.swift +351 -0
  68. package/ios/TopModalViewManager.swift +196 -0
  69. package/package.json +103 -0
  70. package/react-native-sheet.podspec +21 -0
  71. package/src/FittedSheet.tsx +177 -0
  72. package/src/TopModal.tsx +94 -0
  73. package/src/TransparentActivity.tsx +98 -0
  74. package/src/index.tsx +16 -0
@@ -0,0 +1,71 @@
1
+ package com.sheet
2
+
3
+ import android.content.Context
4
+ import android.graphics.Color
5
+ import android.view.View
6
+ import android.view.Window
7
+ import com.facebook.react.bridge.ColorPropConverter
8
+ import com.facebook.react.bridge.ReactContext
9
+ import com.facebook.react.bridge.ReadableMap
10
+ import com.facebook.react.uimanager.PixelUtil
11
+ import com.facebook.react.uimanager.UIManagerHelper
12
+ import com.facebook.react.uimanager.UIManagerModule
13
+ import com.facebook.react.uimanager.common.UIManagerType
14
+
15
+
16
+ fun Int.toDP(): Int {
17
+ return PixelUtil.toDIPFromPixel(this.toFloat()).toInt()
18
+ }
19
+
20
+ fun Double.toDP(): Int {
21
+ return PixelUtil.toDIPFromPixel(this.toFloat()).toInt()
22
+ }
23
+
24
+ fun Float.toDP(): Float {
25
+ return PixelUtil.toDIPFromPixel(this)
26
+ }
27
+
28
+ fun Double.toPxD(): Double {
29
+ return PixelUtil.toPixelFromDIP(this.toFloat()).toDouble()
30
+ }
31
+
32
+ fun ReadableMap?.bool(value: String, default: Boolean): Boolean {
33
+ if (this == null) return default
34
+ if (!hasKey(value)) return default
35
+ return getBoolean(value)
36
+ }
37
+
38
+ fun ReadableMap?.float(value: String, default: Float): Float {
39
+ if (this == null) return default
40
+ if (!hasKey(value)) return default
41
+ return getDouble(value).toFloat()
42
+ }
43
+
44
+ fun ReadableMap?.double(value: String, default: Double): Double {
45
+ if (this == null) return default
46
+ if (!hasKey(value)) return default
47
+ return getDouble(value)
48
+ }
49
+
50
+ fun ReadableMap.color(value: String, context: Context): Int {
51
+ if (!hasKey(value)) return Color.TRANSPARENT
52
+ return ColorPropConverter.getColor(getDouble("backgroundColor"), context)
53
+ }
54
+
55
+ fun View.setNewShadowSize(width: Int, height: Int) {
56
+ val module = UIManagerHelper.getUIManager(context as ReactContext?, UIManagerType.DEFAULT) as UIManagerModule
57
+ UIManagerHelper.getReactContext(this).runOnNativeModulesQueueThread {
58
+ val id = module.uiImplementation.resolveShadowNode(this.id).getChildAt(0).reactTag
59
+ module.updateNodeSize(id, width, height)
60
+ }
61
+ }
62
+
63
+ fun Window.updateStatusBar(isLight: Boolean) {
64
+ if (isLight) {
65
+ decorView.systemUiVisibility =
66
+ decorView.systemUiVisibility or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
67
+ } else {
68
+ decorView.systemUiVisibility =
69
+ decorView.systemUiVisibility and View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR.inv()
70
+ }
71
+ }
@@ -0,0 +1,71 @@
1
+ package com.transparent.activity
2
+
3
+ import android.content.Context
4
+ import android.content.Intent
5
+ import android.view.View
6
+ import android.view.WindowManager
7
+ import android.view.accessibility.AccessibilityEvent
8
+ import androidx.appcompat.app.AppCompatActivity
9
+ import com.facebook.react.bridge.Arguments
10
+ import com.facebook.react.bridge.ReactContext
11
+ import com.facebook.react.bridge.UiThreadUtil
12
+ import com.facebook.react.uimanager.events.RCTEventEmitter
13
+ import com.facebook.react.views.view.ReactViewGroup
14
+ import com.modal.TopModalView
15
+ import com.sheet.BaseRNView
16
+ import java.lang.ref.WeakReference
17
+
18
+ fun ActivityModalView.onActivityDismiss() {
19
+ (context as ReactContext).getJSModule(RCTEventEmitter::class.java)
20
+ .receiveEvent(id, "onActivityDismiss", Arguments.createMap())
21
+ }
22
+
23
+ class ActivityModalView(context: Context?) : ReactViewGroup(context) {
24
+ private var rnView = BaseRNView(context)
25
+ init {
26
+ println("🗡️ init")
27
+ TransparentActivity.parentView = WeakReference(this)
28
+ val intent = Intent(getCurrentActivity()!!, TransparentActivity::class.java)
29
+ getCurrentActivity()?.startActivity(intent)
30
+
31
+ }
32
+
33
+ fun getCurrentActivity(): AppCompatActivity? {
34
+ return (context as? ReactContext)?.currentActivity as? AppCompatActivity
35
+ }
36
+
37
+ override fun addView(child: View, index: Int) {
38
+ rnView.addView(child)
39
+ if (TransparentActivity.presentedInstance == null) {
40
+ TransparentActivity.deferredView = WeakReference(rnView)
41
+ }
42
+ val activity = TransparentActivity.presentedInstance?.get() ?: return
43
+ activity.setContentView(rnView)
44
+ }
45
+
46
+ override fun addChildrenForAccessibility(outChildren: ArrayList<View?>?) {}
47
+ override fun dispatchPopulateAccessibilityEvent(event: AccessibilityEvent?) = false
48
+
49
+
50
+ override fun removeView(child: View?) {
51
+ println("🗡️️ removeView")
52
+ UiThreadUtil.assertOnUiThread()
53
+ dismiss()
54
+ }
55
+
56
+ override fun removeViewAt(index: Int) {
57
+ println("🗡️️ removeViewAt: $index")
58
+ UiThreadUtil.assertOnUiThread()
59
+ dismiss()
60
+ }
61
+
62
+ fun onDismiss() {
63
+ println("🗡️ onDismiss")
64
+ onActivityDismiss()
65
+ }
66
+
67
+ fun dismiss() {
68
+ println("🗡️️ dismiss")
69
+ TransparentActivity.presentedInstance?.get()?.finish();
70
+ }
71
+ }
@@ -0,0 +1,48 @@
1
+ package com.transparent.activity
2
+
3
+ import android.os.Bundle
4
+ import android.view.View
5
+ import android.view.WindowManager
6
+ import androidx.appcompat.app.AppCompatActivity
7
+ import java.lang.ref.WeakReference
8
+
9
+ class TransparentActivity : AppCompatActivity() {
10
+ init {
11
+ println("🗡️ TransparentActivity.init")
12
+ presentedInstance = WeakReference(this)
13
+ }
14
+
15
+ override fun onCreate(savedInstanceState: Bundle?) {
16
+ window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN)
17
+ super.onCreate(savedInstanceState)
18
+ println("🗡️ TransparentActivity.onCreate")
19
+ parentView?.get()?.getCurrentActivity()?.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING)
20
+ deferredView?.get()?.let { setContentView(it) }
21
+ deferredView = null
22
+ }
23
+
24
+ private fun dismiss() {
25
+ println("🗡️ TransparentActivity.dismiss")
26
+ parentView?.get()?.onDismiss()
27
+ parentView?.get()?.getCurrentActivity()?.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)
28
+ presentedInstance = null
29
+ }
30
+
31
+ override fun finish() {
32
+ super.finish()
33
+ println("🗡️ TransparentActivity.finish")
34
+ dismiss()
35
+ }
36
+
37
+ override fun onBackPressed() {
38
+ super.onBackPressed()
39
+ println("🗡️ TransparentActivity.onBackPressed")
40
+ dismiss()
41
+ }
42
+
43
+ companion object {
44
+ var presentedInstance: WeakReference<TransparentActivity>? = null
45
+ var deferredView: WeakReference<View>? = null
46
+ var parentView: WeakReference<ActivityModalView>? = null
47
+ }
48
+ }
@@ -0,0 +1,63 @@
1
+ package com.transparent.activity
2
+
3
+ import android.content.res.Resources
4
+ import android.view.View
5
+ import com.facebook.react.bridge.ReactApplicationContext
6
+ import com.facebook.react.common.MapBuilder
7
+ import com.facebook.react.uimanager.LayoutShadowNode
8
+ import com.facebook.react.uimanager.ReactShadowNodeImpl
9
+ import com.facebook.react.uimanager.ThemedReactContext
10
+ import com.facebook.react.uimanager.ViewGroupManager
11
+ import com.facebook.yoga.YogaPositionType
12
+
13
+ private class ModalHostShadowNode : LayoutShadowNode() {
14
+ override fun addChildAt(child: ReactShadowNodeImpl, i: Int) {
15
+ super.addChildAt(child, i)
16
+ val display = Resources.getSystem().displayMetrics
17
+ child.setStyleWidth(display.widthPixels.toFloat())
18
+ child.setStyleHeight(display.heightPixels.toFloat())
19
+ child.setPositionType(YogaPositionType.ABSOLUTE)
20
+ }
21
+ }
22
+
23
+ class TransparentActivityManager : ViewGroupManager<ActivityModalView>() {
24
+ override fun getName() = "TransparentActivity"
25
+
26
+ override fun createViewInstance(reactContext: ThemedReactContext): ActivityModalView {
27
+ return ActivityModalView(reactContext)
28
+ }
29
+
30
+ override fun getExportedCustomDirectEventTypeConstants(): Map<String, Any>? {
31
+ return MapBuilder.builder<String, Any>()
32
+ .put("onActivityDismiss", MapBuilder.of("registrationName", "onActivityDismiss"))
33
+ .build()
34
+ }
35
+
36
+ override fun getShadowNodeClass(): Class<LayoutShadowNode> {
37
+ return ModalHostShadowNode::class.java as Class<LayoutShadowNode>
38
+ }
39
+
40
+ override fun createShadowNodeInstance(): LayoutShadowNode {
41
+ return ModalHostShadowNode()
42
+ }
43
+
44
+ override fun createShadowNodeInstance(context: ReactApplicationContext): LayoutShadowNode {
45
+ println("⚽️ createShadowNodeInstance")
46
+ return ModalHostShadowNode()
47
+ }
48
+
49
+ override fun removeView(parent: ActivityModalView?, view: View?) {
50
+ super.removeView(parent, view)
51
+ println("⚽️ removeView")
52
+ }
53
+
54
+ override fun removeViewAt(parent: ActivityModalView?, index: Int) {
55
+ super.removeViewAt(parent, index)
56
+ println("⚽️ removeViewAt")
57
+ }
58
+
59
+ override fun onDropViewInstance(view: ActivityModalView) {
60
+ super.onDropViewInstance(view)
61
+ view.dismiss()
62
+ }
63
+ }
@@ -0,0 +1,28 @@
1
+ package com.transparent.activity
2
+
3
+ import android.os.Handler
4
+ import android.os.Looper
5
+ import android.util.Log
6
+ import com.facebook.react.bridge.ReactApplicationContext
7
+ import com.facebook.react.bridge.ReactContextBaseJavaModule
8
+ import com.facebook.react.bridge.ReactMethod
9
+ import com.facebook.react.module.annotations.ReactModule
10
+ import com.facebook.react.uimanager.UIManagerHelper
11
+
12
+ @ReactModule(name = TransparentActivityModule.TAG)
13
+ class TransparentActivityModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) {
14
+ companion object {
15
+ const val TAG = "TransparentActivity"
16
+ }
17
+
18
+ override fun getName(): String {
19
+ return TAG
20
+ }
21
+
22
+ @ReactMethod
23
+ fun dismiss(viewTag: Int) {
24
+ Handler(Looper.getMainLooper()).post {
25
+ TransparentActivity.presentedInstance?.get()?.finish()
26
+ }
27
+ }
28
+ }
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <set xmlns:android="http://schemas.android.com/apk/res/android">
3
+ <alpha
4
+ android:duration="@android:integer/config_shortAnimTime"
5
+ android:interpolator="@android:anim/accelerate_interpolator"
6
+ android:fromAlpha="0.0"
7
+ android:toAlpha="1.0"/>
8
+ </set>
@@ -0,0 +1,11 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!--
3
+ courtesy of http://adilatwork.blogspot.com/2012/11/android-dialogfragment-enter-and-exit.html
4
+ file location: src/main/res/anim
5
+ -->
6
+ <alpha
7
+ xmlns:android="http://schemas.android.com/apk/res/android"
8
+ android:interpolator="@android:anim/accelerate_interpolator"
9
+ android:fromAlpha="0.0"
10
+ android:toAlpha="1.0"
11
+ android:duration="400" />
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <set xmlns:android="http://schemas.android.com/apk/res/android">
3
+ <translate
4
+ android:duration="@android:integer/config_shortAnimTime"
5
+ android:fromYDelta="0%p"
6
+ android:interpolator="@android:anim/accelerate_interpolator"
7
+ android:toYDelta="100%p" />
8
+ </set>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <set xmlns:android="http://schemas.android.com/apk/res/android">
3
+ <translate
4
+ android:duration="@android:integer/config_shortAnimTime"
5
+ android:fromYDelta="100%"
6
+ android:interpolator="@android:anim/accelerate_interpolator"
7
+ android:toXDelta="0" />
8
+ </set>
@@ -0,0 +1,64 @@
1
+ <?xml version="1.0" encoding="utf-8"?><!--
2
+ ~ Copyright (C) 2015 The Android Open Source Project
3
+ ~
4
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
5
+ ~ you may not use this file except in compliance with the License.
6
+ ~ You may obtain a copy of the License at
7
+ ~
8
+ ~ http://www.apache.org/licenses/LICENSE-2.0
9
+ ~
10
+ ~ Unless required by applicable law or agreed to in writing, software
11
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
12
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ ~ See the License for the specific language governing permissions and
14
+ ~ limitations under the License.
15
+ -->
16
+ <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
17
+ xmlns:app="http://schemas.android.com/apk/res-auto"
18
+ xmlns:tools="http://schemas.android.com/tools"
19
+ android:id="@+id/container"
20
+ android:layout_width="match_parent"
21
+ android:layout_height="match_parent"
22
+ android:fitsSystemWindows="true">
23
+
24
+ <androidx.coordinatorlayout.widget.CoordinatorLayout
25
+ android:id="@+id/coordinator"
26
+ android:layout_width="match_parent"
27
+ android:layout_height="match_parent"
28
+ android:fitsSystemWindows="true">
29
+
30
+ <View
31
+ android:id="@+id/touch_outside"
32
+ android:layout_width="match_parent"
33
+ android:layout_height="match_parent"
34
+ android:focusable="false"
35
+ android:importantForAccessibility="no"
36
+ android:soundEffectsEnabled="false"
37
+ tools:ignore="UnusedAttribute" />
38
+
39
+ <FrameLayout
40
+ android:id="@+id/design_bottom_sheet"
41
+ style="?attr/bottomSheetStyle"
42
+ android:layout_width="match_parent"
43
+ android:layout_height="wrap_content"
44
+ android:layout_gravity="center_horizontal|top"
45
+ app:layout_behavior="com.behavior.BottomSheetBehavior">
46
+
47
+ <LinearLayout
48
+ android:id="@+id/dialog_bottom_sheet_content_decorator"
49
+ android:layout_width="match_parent"
50
+ android:layout_height="match_parent"
51
+ android:orientation="vertical">
52
+
53
+ <FrameLayout
54
+ android:id="@+id/dialog_bottom_sheet_content_container"
55
+ android:layout_width="match_parent"
56
+ android:layout_height="0dp"
57
+ android:background="@android:color/white"
58
+ android:layout_weight="1" />
59
+ </LinearLayout>
60
+ </FrameLayout>
61
+
62
+ </androidx.coordinatorlayout.widget.CoordinatorLayout>
63
+
64
+ </FrameLayout>
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <androidx.coordinatorlayout.widget.CoordinatorLayout
3
+ xmlns:android="http://schemas.android.com/apk/res/android"
4
+ android:layout_width="match_parent"
5
+ android:layout_height="match_parent"
6
+ android:background="@color/transparent">
7
+
8
+ <FrameLayout
9
+ android:id="@+id/container"
10
+ android:layout_width="match_parent"
11
+ android:layout_height="match_parent"
12
+ android:background="@color/transparent"/>
13
+
14
+ </androidx.coordinatorlayout.widget.CoordinatorLayout>
@@ -0,0 +1,15 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <resources>
3
+ <color name="transparent" />
4
+ <color name="purple_200">#0073D1</color>
5
+ <color name="purple_500">#272C3A</color>
6
+ <color name="purple_700">#1E212C</color>
7
+ <color name="teal_200">#FF03DAC5</color>
8
+ <color name="teal_700">#FF018786</color>
9
+ <color name="black">#FF000000</color>
10
+ <color name="white">#FFFFFFFF</color>
11
+ <color name="overlay_dark_30">#4D000000</color>
12
+ <color name="overlay_dark_50">#80000000</color>
13
+ <color name="overlay_dark_70">#E61E212C</color>
14
+ <color name="overlay_dark_90">#CE000000</color>
15
+ </resources>
@@ -0,0 +1,75 @@
1
+ <resources xmlns:tools="http://schemas.android.com/tools">
2
+
3
+
4
+ <style name="BottomSheet.Theme" parent="Theme.MaterialComponents.Light.NoActionBar"/>
5
+
6
+ <style name="AppBottomSheetDialog" parent="Theme.AppCompat.Dialog">
7
+ <item name="android:windowBackground">@android:color/transparent</item>
8
+ <item name="android:windowAnimationStyle">@style/Animation.Design.BottomSheetDialog</item>
9
+ <item name="bottomSheetStyle">@style/AppBottomSheetModalBehavior</item>
10
+ <item name="android:windowIsFloating">false</item>
11
+ <item name="statusBarBackground">@android:color/transparent</item>
12
+ <item name="android:statusBarColor">@android:color/transparent</item>
13
+ <item name="android:windowSoftInputMode">adjustNothing</item>
14
+ </style>
15
+
16
+ <style name="AppBottomSheetDialog.Dark">
17
+ <item name="android:navigationBarColor">@android:color/black</item>
18
+ </style>
19
+
20
+ <style name="AppBottomSheetModalBehavior" parent="android:Widget">
21
+ <item name="android:background">@android:color/transparent</item>
22
+ <item name="android:elevation" tools:ignore="NewApi">16dp</item>
23
+ <item name="behavior_hideable">true</item>
24
+ <item name="behavior_skipCollapsed">true</item>
25
+ </style>
26
+
27
+
28
+
29
+
30
+
31
+ <style name="Custom.Theme.FullScreenDialog" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
32
+ <item name="android:windowFrame">@null</item>
33
+ <item name="android:windowIsFloating">true</item>
34
+ <item name="android:windowContentOverlay">@null</item>
35
+ <item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
36
+ <item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
37
+ </style>
38
+
39
+ <style name="Custom.Theme.EdgeToEdgeDialog" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
40
+ <item name="android:windowFrame">@null</item>
41
+ <item name="android:windowContentOverlay">@null</item>
42
+ <item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
43
+
44
+ <item name="android:windowBackground">@android:color/transparent</item>
45
+ <item name="android:windowIsFloating">false</item>
46
+ <item name="android:statusBarColor">@android:color/transparent</item>
47
+ <item name="android:windowSoftInputMode">adjustNothing</item>
48
+ </style>
49
+
50
+
51
+ <style name="Custom.Theme.FullScreenDialog.Slide">
52
+ <item name="android:windowEnterAnimation">@anim/slide_up</item>
53
+ <item name="android:windowExitAnimation">@anim/slide_down</item>
54
+ </style>
55
+
56
+ <style name="Custom.Theme.FullScreenDialog.Fade">
57
+ <item name="android:windowEnterAnimation">@anim/fade_in</item>
58
+ <item name="android:windowExitAnimation">@anim/fade_out</item>
59
+ </style>
60
+
61
+ <style name="Custom.Theme.FullScreenDialog.NoAnimation">
62
+ <item name="android:windowEnterAnimation">@null</item>
63
+ <item name="android:windowExitAnimation">@null</item>
64
+ </style>
65
+
66
+
67
+ <style name="Theme.Transparent" parent="Theme.AppCompat.NoActionBar">
68
+ <item name="android:windowIsTranslucent">true</item>
69
+ <item name="android:windowBackground">@android:color/transparent</item>
70
+ <item name="android:windowContentOverlay">@null</item>
71
+ <item name="android:backgroundDimEnabled">false</item>
72
+ <item name="android:windowFullscreen">false</item>
73
+ <item name="android:windowAnimationStyle">@null</item>
74
+ </style>
75
+ </resources>
@@ -0,0 +1,55 @@
1
+ //
2
+ // File.swift
3
+ //
4
+ //
5
+ // Created by Nhuan Vu on 8/25/21.
6
+ //
7
+
8
+ #if os(iOS) || os(tvOS) || os(watchOS)
9
+ import UIKit
10
+
11
+ extension UIView {
12
+ public var compatibleSafeAreaInsets: UIEdgeInsets {
13
+ if #available(iOS 11.0, *) {
14
+ return self.safeAreaInsets
15
+ } else {
16
+ return .zero
17
+ }
18
+ }
19
+ }
20
+
21
+ extension CALayer {
22
+ public var compatibleMaskedCorners: CACornerMask {
23
+ get {
24
+ if #available(iOS 11.0, *) {
25
+ return self.maskedCorners
26
+ } else {
27
+ return []
28
+ }
29
+ }
30
+ set {
31
+ if #available(iOS 11.0, *) {
32
+ self.maskedCorners = newValue
33
+ }
34
+ }
35
+ }
36
+ }
37
+
38
+ extension UIViewController {
39
+ public var compatibleAdditionalSafeAreaInsets: UIEdgeInsets {
40
+ get {
41
+ if #available(iOS 11.0, *) {
42
+ return self.additionalSafeAreaInsets
43
+ } else {
44
+ return .zero
45
+ }
46
+ }
47
+ set {
48
+ if #available(iOS 11.0, *) {
49
+ self.additionalSafeAreaInsets = newValue
50
+ }
51
+ }
52
+ }
53
+ }
54
+
55
+ #endif // os(iOS) || os(tvOS) || os(watchOS)
@@ -0,0 +1,19 @@
1
+ //
2
+ // InitialTouchPanGestureRecognizer.swift
3
+ // FittedSheets
4
+ //
5
+ // Created by Gordon Tucker on 8/27/18.
6
+ // Copyright © 2018 Gordon Tucker. All rights reserved.
7
+ //
8
+ #if os(iOS) || os(tvOS) || os(watchOS)
9
+ import UIKit.UIGestureRecognizerSubclass
10
+
11
+ class InitialTouchPanGestureRecognizer: UIPanGestureRecognizer {
12
+ var initialTouchLocation: CGPoint?
13
+
14
+ override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent) {
15
+ super.touchesBegan(touches, with: event)
16
+ initialTouchLocation = touches.first?.location(in: view)
17
+ }
18
+ }
19
+ #endif