1
- import { action , makeAutoObservable , observable } from 'mobx' ;
1
+ import { action , makeAutoObservable } from 'mobx' ;
2
2
import { Keyboard , ViewStyle } from 'react-native' ;
3
3
import { AnimatedStyle , SharedValue } from 'react-native-reanimated' ;
4
4
import metrics from '../constants/metrics' ;
@@ -33,38 +33,32 @@ export interface UiStore {
33
33
class UiClass {
34
34
// ---------------- BottomSheet ----------------
35
35
bottomSheetContentRenderer : UiStore [ 'bottomSheetContentRenderer' ] ;
36
- @ observable bottomSheetDebouncedDelay = false ;
37
- @ observable bottomSheetBottomInset = 0 ;
38
- @ observable isBottomSheetOpen : UiStore [ 'isBottomSheetOpen' ] = false ;
36
+ bottomSheetDebouncedDelay = false ;
37
+ bottomSheetBottomInset = 0 ;
38
+ isBottomSheetOpen : UiStore [ 'isBottomSheetOpen' ] = false ;
39
39
40
- @observable bottomSheetSharedValue : UiStore [ 'bottomSheetSharedValue' ] =
41
- undefined ;
40
+ bottomSheetSharedValue : UiStore [ 'bottomSheetSharedValue' ] = undefined ;
42
41
43
- @ observable bottomSheetSnapPoints : UiStore [ 'bottomSheetSnapPoints' ] =
42
+ bottomSheetSnapPoints : UiStore [ 'bottomSheetSnapPoints' ] =
44
43
DEFAULT_BOTTOM_SHEET_SNAP_POINTS ;
45
- @observable containerStyle : UiStore [ 'containerStyle' ] = { } ;
46
- @observable bottomSheetGorhomProps : UiStore [ 'bottomSheetGorhomProps' ] = { } ;
47
- @observable bottomSheetStyle : OpenBottomSheetOps [ 'bottomSheetStyle' ] =
48
- undefined ;
49
-
50
- @action
51
- setBottomSheetSharedValue : UiStore [ 'setBottomSheetSharedValue' ] = (
52
- sharedValue ,
53
- ) => {
54
- this . bottomSheetSharedValue = sharedValue ;
55
- } ;
56
-
57
- @observable
44
+ containerStyle : UiStore [ 'containerStyle' ] = { } ;
45
+ bottomSheetGorhomProps : UiStore [ 'bottomSheetGorhomProps' ] = { } ;
46
+ bottomSheetStyle : OpenBottomSheetOps [ 'bottomSheetStyle' ] = undefined ;
47
+
48
+ setBottomSheetSharedValue : UiStore [ 'setBottomSheetSharedValue' ] = action (
49
+ ( sharedValue ) => {
50
+ this . bottomSheetSharedValue = sharedValue ;
51
+ } ,
52
+ ) ;
53
+
58
54
bottomSheetTargetSharedValue : UiStore [ 'bottomSheetTargetSharedValue' ] = 0 ;
59
55
60
- @action
61
56
setBottomSheetTargetSharedValue : UiStore [ 'setBottomSheetTargetSharedValue' ] =
62
- ( targetSharedValue ) => {
57
+ action ( ( targetSharedValue ) => {
63
58
this . bottomSheetTargetSharedValue = targetSharedValue ;
64
- } ;
59
+ } ) ;
65
60
66
- @action
67
- openBottomSheet : UiStore [ 'openBottomSheet' ] = ( options ) => {
61
+ openBottomSheet : UiStore [ 'openBottomSheet' ] = action ( ( options ) => {
68
62
if ( ! this . isBottomSheetOpen && ! this . bottomSheetDebouncedDelay ) {
69
63
Keyboard . dismiss ( ) ;
70
64
this . bottomSheetDebouncedDelay = true ;
@@ -86,10 +80,9 @@ class UiClass {
86
80
87
81
this . isBottomSheetOpen = true ;
88
82
}
89
- } ;
83
+ } ) ;
90
84
91
- @action
92
- closeBottomSheet : UiStore [ 'closeBottomSheet' ] = ( ) => {
85
+ closeBottomSheet : UiStore [ 'closeBottomSheet' ] = action ( ( ) => {
93
86
if ( this . isBottomSheetOpen ) {
94
87
this . isBottomSheetOpen = false ;
95
88
@@ -106,7 +99,7 @@ class UiClass {
106
99
this . bottomSheetBottomInset = 0 ;
107
100
} , BOTTOM_SHEET_POPUP_ANIMATION_TIME + 350 ) ;
108
101
}
109
- } ;
102
+ } ) ;
110
103
111
104
// ---------------- ----------------
112
105
0 commit comments