react-native-sheet2 7.12.4 → 7.12.5
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/src/main/java/com/sheet2/AppFittedSheet.kt +3 -2
- package/android/src/main/java/com/sheet2/CustomBottomSheetDialog.java +5 -0
- package/android/src/main/java/com/sheet2/FragmentModalBottomSheet.kt +9 -0
- package/android/src/main/java/com/sheet2/Sheet2ViewManager.kt +1 -1
- package/package.json +1 -1
|
@@ -383,7 +383,7 @@ open class AppFittedSheet(context: Context) :
|
|
|
383
383
|
dismiss()
|
|
384
384
|
}
|
|
385
385
|
|
|
386
|
-
fun dismiss() {
|
|
386
|
+
fun dismiss(animated: Boolean = false) {
|
|
387
387
|
UiThreadUtil.assertOnUiThread()
|
|
388
388
|
if (centeredDialog != null) {
|
|
389
389
|
centeredDialog?.dismiss()
|
|
@@ -399,7 +399,8 @@ open class AppFittedSheet(context: Context) :
|
|
|
399
399
|
inlinePresenter.dismiss()
|
|
400
400
|
return
|
|
401
401
|
}
|
|
402
|
-
this.sheet
|
|
402
|
+
val sheet = this.sheet
|
|
403
|
+
if (animated) sheet?.hideAnimated() else sheet?.dismissAllowingStateLoss()
|
|
403
404
|
}
|
|
404
405
|
|
|
405
406
|
override fun addChildrenForAccessibility(outChildren: ArrayList<View?>?) {}
|
|
@@ -33,6 +33,11 @@ public class CustomBottomSheetDialog extends AppCompatDialog {
|
|
|
33
33
|
behavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
public void hideAnimated() {
|
|
37
|
+
behavior.setHideable(true);
|
|
38
|
+
behavior.setState(BottomSheetBehavior.STATE_HIDDEN);
|
|
39
|
+
}
|
|
40
|
+
|
|
36
41
|
public void expand() {
|
|
37
42
|
behavior.setState(BottomSheetBehavior.STATE_EXPANDED);
|
|
38
43
|
}
|
|
@@ -140,6 +140,15 @@ class FragmentModalBottomSheet() : BottomSheetDialogFragment() {
|
|
|
140
140
|
(dialog as CustomBottomSheetDialog).collapse()
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
+
fun hideAnimated() {
|
|
144
|
+
val sheetDialog = dialog as? CustomBottomSheetDialog
|
|
145
|
+
if (sheetDialog == null) {
|
|
146
|
+
dismissAllowingStateLoss()
|
|
147
|
+
return
|
|
148
|
+
}
|
|
149
|
+
sheetDialog.hideAnimated()
|
|
150
|
+
}
|
|
151
|
+
|
|
143
152
|
fun expand() {
|
|
144
153
|
(dialog as CustomBottomSheetDialog).expand()
|
|
145
154
|
}
|
|
@@ -38,7 +38,7 @@ class Sheet2ViewManager(reactContext: ReactApplicationContext) : ViewGroupManage
|
|
|
38
38
|
|
|
39
39
|
override fun dismissSheet(view: Sheet2View) {
|
|
40
40
|
SheetTreeLog.debug("dismissSheet")
|
|
41
|
-
view.dismiss()
|
|
41
|
+
view.dismiss(animated = true)
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
override fun setUniqueId(view: Sheet2View, value: String?) {
|