react-native-nitro-modal 0.1.5 → 0.3.0-rc
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/README.md +65 -11
- package/android/src/main/java/com/margelo/nitro/nitromodal/BottomSheetPresenter.kt +335 -34
- package/android/src/main/java/com/margelo/nitro/nitromodal/HybridNitroModal.kt +63 -22
- package/android/src/main/java/com/margelo/nitro/nitromodal/ModalConfig.kt +31 -1
- package/android/src/main/java/com/margelo/nitro/nitromodal/ModalContentRoot.kt +48 -5
- package/android/src/main/java/com/margelo/nitro/nitromodal/ModalPresenter.kt +63 -4
- package/android/src/main/java/com/margelo/nitro/nitromodal/NitroModalHostView.kt +68 -8
- package/ios/HybridNitroModal.swift +111 -20
- package/ios/ModalConfig.swift +44 -2
- package/ios/NitroModalHostView.swift +73 -8
- package/ios/SheetView.swift +575 -0
- package/ios/SheetViewController.swift +19 -450
- package/lib/module/NitroModal.js +39 -7
- package/lib/module/NitroModal.js.map +1 -1
- package/lib/module/NitroModalView.js +4 -3
- package/lib/module/NitroModalView.js.map +1 -1
- package/lib/module/NitroModalView.native.js +3 -0
- package/lib/module/NitroModalView.native.js.map +1 -1
- package/lib/module/NitroModalView.web.js +159 -0
- package/lib/module/NitroModalView.web.js.map +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/web/AnimatedValue.js +126 -0
- package/lib/module/web/AnimatedValue.js.map +1 -0
- package/lib/module/web/ModalConfig.js +30 -0
- package/lib/module/web/ModalConfig.js.map +1 -0
- package/lib/module/web/ModalController.js +306 -0
- package/lib/module/web/ModalController.js.map +1 -0
- package/lib/module/web/ModalPresenter.js +280 -0
- package/lib/module/web/ModalPresenter.js.map +1 -0
- package/lib/module/web/PopupPresenter.js +117 -0
- package/lib/module/web/PopupPresenter.js.map +1 -0
- package/lib/module/web/SheetPresenter.js +494 -0
- package/lib/module/web/SheetPresenter.js.map +1 -0
- package/lib/module/web/dom.js +138 -0
- package/lib/module/web/dom.js.map +1 -0
- package/lib/typescript/src/NitroModal.d.ts +35 -4
- package/lib/typescript/src/NitroModal.d.ts.map +1 -1
- package/lib/typescript/src/NitroModal.nitro.d.ts +29 -2
- package/lib/typescript/src/NitroModal.nitro.d.ts.map +1 -1
- package/lib/typescript/src/NitroModalView.d.ts +2 -1
- package/lib/typescript/src/NitroModalView.d.ts.map +1 -1
- package/lib/typescript/src/NitroModalView.native.d.ts +1 -0
- package/lib/typescript/src/NitroModalView.native.d.ts.map +1 -1
- package/lib/typescript/src/NitroModalView.web.d.ts +6 -0
- package/lib/typescript/src/NitroModalView.web.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +2 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/web/AnimatedValue.d.ts +49 -0
- package/lib/typescript/src/web/AnimatedValue.d.ts.map +1 -0
- package/lib/typescript/src/web/ModalConfig.d.ts +30 -0
- package/lib/typescript/src/web/ModalConfig.d.ts.map +1 -0
- package/lib/typescript/src/web/ModalController.d.ts +70 -0
- package/lib/typescript/src/web/ModalController.d.ts.map +1 -0
- package/lib/typescript/src/web/ModalPresenter.d.ts +107 -0
- package/lib/typescript/src/web/ModalPresenter.d.ts.map +1 -0
- package/lib/typescript/src/web/PopupPresenter.d.ts +20 -0
- package/lib/typescript/src/web/PopupPresenter.d.ts.map +1 -0
- package/lib/typescript/src/web/SheetPresenter.d.ts +65 -0
- package/lib/typescript/src/web/SheetPresenter.d.ts.map +1 -0
- package/lib/typescript/src/web/dom.d.ts +42 -0
- package/lib/typescript/src/web/dom.d.ts.map +1 -0
- package/nitrogen/generated/android/c++/JHybridNitroModalSpec.cpp +60 -6
- package/nitrogen/generated/android/c++/JHybridNitroModalSpec.hpp +10 -2
- package/nitrogen/generated/android/c++/JNamedSheetDetent.hpp +64 -0
- package/nitrogen/generated/android/c++/JSheetDetent.cpp +26 -0
- package/nitrogen/generated/android/c++/JSheetDetent.hpp +42 -37
- package/nitrogen/generated/android/c++/views/JHybridNitroModalStateUpdater.cpp +20 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromodal/HybridNitroModalSpec.kt +40 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromodal/NamedSheetDetent.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromodal/SheetDetent.kt +47 -10
- package/nitrogen/generated/android/nitromodal+autolinking.cmake +1 -0
- package/nitrogen/generated/ios/NitroModal-Swift-Cxx-Bridge.hpp +53 -8
- package/nitrogen/generated/ios/NitroModal-Swift-Cxx-Umbrella.hpp +4 -3
- package/nitrogen/generated/ios/c++/HybridNitroModalSpecSwift.hpp +32 -5
- package/nitrogen/generated/ios/c++/views/HybridNitroModalComponent.mm +24 -0
- package/nitrogen/generated/ios/swift/HybridNitroModalSpec.swift +4 -0
- package/nitrogen/generated/ios/swift/HybridNitroModalSpec_cxx.swift +110 -5
- package/nitrogen/generated/ios/swift/NamedSheetDetent.swift +48 -0
- package/nitrogen/generated/ios/swift/SheetDetent.swift +15 -33
- package/nitrogen/generated/shared/c++/HybridNitroModalSpec.cpp +8 -0
- package/nitrogen/generated/shared/c++/HybridNitroModalSpec.hpp +14 -5
- package/nitrogen/generated/shared/c++/{SheetDetent.hpp → NamedSheetDetent.hpp} +17 -17
- package/nitrogen/generated/shared/c++/views/HybridNitroModalComponent.cpp +9 -1
- package/nitrogen/generated/shared/c++/views/HybridNitroModalComponent.hpp +15 -2
- package/nitrogen/generated/shared/json/NitroModalConfig.json +4 -0
- package/package.json +3 -2
- package/src/NitroModal.nitro.ts +30 -2
- package/src/NitroModal.tsx +71 -8
- package/src/NitroModalView.native.tsx +4 -0
- package/src/NitroModalView.tsx +9 -4
- package/src/NitroModalView.web.tsx +180 -0
- package/src/index.tsx +2 -0
- package/src/web/AnimatedValue.ts +193 -0
- package/src/web/ModalConfig.ts +67 -0
- package/src/web/ModalController.ts +338 -0
- package/src/web/ModalPresenter.ts +333 -0
- package/src/web/PopupPresenter.ts +129 -0
- package/src/web/SheetPresenter.ts +647 -0
- package/src/web/dom.ts +171 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModalPresenter.d.ts","sourceRoot":"","sources":["../../../../src/web/ModalPresenter.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type Insets, type Size } from './dom.js';
|
|
2
|
+
import { ModalPresenter } from './ModalPresenter.js';
|
|
3
|
+
/** Best guess of the content area before the popup is on screen. */
|
|
4
|
+
export declare function popupContentArea(viewport: Size, insets: Insets): Size;
|
|
5
|
+
/** `popup` mode: a centered card over the backdrop with a fade/scale transition. */
|
|
6
|
+
export declare class PopupPresenter extends ModalPresenter {
|
|
7
|
+
/** 0 hidden, 1 presented. */
|
|
8
|
+
private readonly progress;
|
|
9
|
+
protected didShow(): void;
|
|
10
|
+
protected animateIn(): void;
|
|
11
|
+
protected animateOut(onEnd: () => void): void;
|
|
12
|
+
protected configDidChange(): void;
|
|
13
|
+
protected viewportDidChange(): void;
|
|
14
|
+
protected contentSizeDidChange(): void;
|
|
15
|
+
protected stopAnimations(): void;
|
|
16
|
+
private get isAnimated();
|
|
17
|
+
private layout;
|
|
18
|
+
private render;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=PopupPresenter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PopupPresenter.d.ts","sourceRoot":"","sources":["../../../../src/web/PopupPresenter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAwB,KAAK,MAAM,EAAE,KAAK,IAAI,EAAE,MAAM,UAAO,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAkB,CAAC;AAmClD,oEAAoE;AACpE,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAGrE;AAED,oFAAoF;AACpF,qBAAa,cAAe,SAAQ,cAAc;IAChD,6BAA6B;IAC7B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAEvB;IAEF,SAAS,CAAC,OAAO;IAKjB,SAAS,CAAC,SAAS;IAMnB,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,IAAI;IAItC,SAAS,CAAC,eAAe;IAKzB,SAAS,CAAC,iBAAiB;IAI3B,SAAS,CAAC,oBAAoB;IAI9B,SAAS,CAAC,cAAc;IAIxB,OAAO,KAAK,UAAU,GAErB;IAED,OAAO,CAAC,MAAM;IA6Bd,OAAO,CAAC,MAAM;CAWf"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { SheetDetent } from '../NitroModal.nitro.js';
|
|
2
|
+
import { type Insets, type Size } from './dom.js';
|
|
3
|
+
import type { ModalConfig } from './ModalConfig.js';
|
|
4
|
+
import { ModalPresenter, type PresenterListener } from './ModalPresenter.js';
|
|
5
|
+
/** Best guess of the content area before the sheet is on screen. */
|
|
6
|
+
export declare function sheetContentArea(detents: SheetDetent[], viewport: Size, insets: Insets, isInline: boolean): Size;
|
|
7
|
+
/**
|
|
8
|
+
* `bottomSheet` mode: an edge-attached sheet with detents, dragging,
|
|
9
|
+
* swipe-to-dismiss and hand-off to scrollable content, like the iOS
|
|
10
|
+
* implementation.
|
|
11
|
+
*/
|
|
12
|
+
export declare class SheetPresenter extends ModalPresenter {
|
|
13
|
+
private selectedIndex;
|
|
14
|
+
/** The sheet sits below the viewport (before presenting / while dismissing). */
|
|
15
|
+
private isOffscreen;
|
|
16
|
+
private drag;
|
|
17
|
+
/** Vertical velocity of the swipe that requested the dismissal. */
|
|
18
|
+
private releaseVelocity;
|
|
19
|
+
/** The sheet's top edge in the viewport. */
|
|
20
|
+
private readonly top;
|
|
21
|
+
constructor(config: ModalConfig, listener: PresenterListener);
|
|
22
|
+
snapToDetent(index: number): void;
|
|
23
|
+
protected didShow(): void;
|
|
24
|
+
protected animateIn(): void;
|
|
25
|
+
protected animateOut(onEnd: () => void): void;
|
|
26
|
+
protected configDidChange(): void;
|
|
27
|
+
protected viewportDidChange(): void;
|
|
28
|
+
protected contentSizeDidChange(): void;
|
|
29
|
+
protected stopAnimations(): void;
|
|
30
|
+
protected teardown(): void;
|
|
31
|
+
private get detents();
|
|
32
|
+
private get maximumDetentValue();
|
|
33
|
+
private get keyboardLift();
|
|
34
|
+
private height;
|
|
35
|
+
/** Sheet top when resting on `detents[index]`. The bottom safe area is added below the content. */
|
|
36
|
+
private restingTop;
|
|
37
|
+
private get detentTops();
|
|
38
|
+
private layout;
|
|
39
|
+
private render;
|
|
40
|
+
/** Fully dimmed at every detent; fades out below the lowest one. */
|
|
41
|
+
private backdropAlpha;
|
|
42
|
+
private motion;
|
|
43
|
+
private settle;
|
|
44
|
+
private animateToRest;
|
|
45
|
+
private canDrag;
|
|
46
|
+
private beginDrag;
|
|
47
|
+
/** Decides who handles a gesture once it moves: the sheet, or the content (scrolling, horizontal swipes). */
|
|
48
|
+
private claim;
|
|
49
|
+
private activate;
|
|
50
|
+
private moveDrag;
|
|
51
|
+
private release;
|
|
52
|
+
/** Abandons the gesture without settling (the exit or the content takes over). */
|
|
53
|
+
private cancelDrag;
|
|
54
|
+
private stopTracking;
|
|
55
|
+
private velocity;
|
|
56
|
+
/** Rubber-bands above the tallest detent, and below the lowest one when swiping can't dismiss. */
|
|
57
|
+
private constrained;
|
|
58
|
+
private handleTouchStart;
|
|
59
|
+
private handleTouchMove;
|
|
60
|
+
private handleTouchEnd;
|
|
61
|
+
private handlePointerDown;
|
|
62
|
+
private handlePointerMove;
|
|
63
|
+
private handlePointerUp;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=SheetPresenter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SheetPresenter.d.ts","sourceRoot":"","sources":["../../../../src/web/SheetPresenter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAqB,CAAC;AAEvD,OAAO,EAKL,KAAK,MAAM,EACX,KAAK,IAAI,EACV,MAAM,UAAO,CAAC;AACf,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAe,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,KAAK,iBAAiB,EAAE,MAAM,qBAAkB,CAAC;AAgG1E,oEAAoE;AACpE,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,WAAW,EAAE,EACtB,QAAQ,EAAE,IAAI,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,OAAO,GAChB,IAAI,CAQN;AAcD;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,cAAc;IAChD,OAAO,CAAC,aAAa,CAAK;IAC1B,gFAAgF;IAChF,OAAO,CAAC,WAAW,CAAQ;IAC3B,OAAO,CAAC,IAAI,CAAqB;IACjC,mEAAmE;IACnE,OAAO,CAAC,eAAe,CAAK;IAC5B,4CAA4C;IAC5C,OAAO,CAAC,QAAQ,CAAC,GAAG,CAElB;gBAEU,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,iBAAiB;IAQ5D,YAAY,CAAC,KAAK,EAAE,MAAM;IAO1B,SAAS,CAAC,OAAO;IAejB,SAAS,CAAC,SAAS;IAKnB,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,IAAI;IAYtC,SAAS,CAAC,eAAe;IAMzB,SAAS,CAAC,iBAAiB;IAK3B,SAAS,CAAC,oBAAoB;IAM9B,SAAS,CAAC,cAAc;IAIxB,SAAS,CAAC,QAAQ;IAalB,OAAO,KAAK,OAAO,GAIlB;IAED,OAAO,KAAK,kBAAkB,GAM7B;IAED,OAAO,KAAK,YAAY,GAIvB;IAED,OAAO,CAAC,MAAM;IAQd,mGAAmG;IACnG,OAAO,CAAC,UAAU;IAelB,OAAO,KAAK,UAAU,GAErB;IAED,OAAO,CAAC,MAAM;IA0Bd,OAAO,CAAC,MAAM;IAMd,oEAAoE;IACpE,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,MAAM;IAId,OAAO,CAAC,MAAM;IAYd,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,SAAS;IAwBjB,6GAA6G;IAC7G,OAAO,CAAC,KAAK;IAoBb,OAAO,CAAC,QAAQ;IAqBhB,OAAO,CAAC,QAAQ;IA4ChB,OAAO,CAAC,OAAO;IA2Cf,kFAAkF;IAClF,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,YAAY;IASpB,OAAO,CAAC,QAAQ;IAWhB,kGAAkG;IAClG,OAAO,CAAC,WAAW;IAiBnB,OAAO,CAAC,gBAAgB,CAiBtB;IAEF,OAAO,CAAC,eAAe,CAqBrB;IAEF,OAAO,CAAC,cAAc,CAKpB;IAIF,OAAO,CAAC,iBAAiB,CAqBvB;IAEF,OAAO,CAAC,iBAAiB,CAkBvB;IAEF,OAAO,CAAC,eAAe,CAIrB;CACH"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export interface Size {
|
|
2
|
+
width: number;
|
|
3
|
+
height: number;
|
|
4
|
+
}
|
|
5
|
+
export interface Insets {
|
|
6
|
+
top: number;
|
|
7
|
+
right: number;
|
|
8
|
+
bottom: number;
|
|
9
|
+
left: number;
|
|
10
|
+
}
|
|
11
|
+
export declare const ZERO_INSETS: Insets;
|
|
12
|
+
export declare const canUseDOM: boolean;
|
|
13
|
+
/** Converts a color from `processColor` (0xAARRGGBB) to CSS, scaling its alpha by `opacity`. */
|
|
14
|
+
export declare function toCSSColor(argb: number, opacity?: number): string;
|
|
15
|
+
/**
|
|
16
|
+
* `env(safe-area-inset-*)`, read through a hidden probe element. Non-zero on
|
|
17
|
+
* notched devices when the page opts in with `viewport-fit=cover`.
|
|
18
|
+
*/
|
|
19
|
+
export declare function readSafeAreaInsets(): Insets;
|
|
20
|
+
/** The part of the safe area insets that `element` overlaps. */
|
|
21
|
+
export declare function inlineInsets(element: Element): Insets;
|
|
22
|
+
/**
|
|
23
|
+
* Height of the on-screen keyboard over a layout viewport `layoutHeight` tall.
|
|
24
|
+
* Mobile browsers keep the layout viewport and shrink the visual one.
|
|
25
|
+
*/
|
|
26
|
+
export declare function readKeyboardHeight(layoutHeight: number): number;
|
|
27
|
+
/** The size of the viewport before anything is on screen. */
|
|
28
|
+
export declare function estimateViewport(): Size;
|
|
29
|
+
/** The innermost element from `target` up to (not including) `root` that scrolls vertically. */
|
|
30
|
+
export declare function findVerticalScroller(target: EventTarget | null, root: Element): HTMLElement | null;
|
|
31
|
+
/** Whether a scroller between `target` and `root` can scroll further by `deltaY`. */
|
|
32
|
+
export declare function canScrollWithin(target: EventTarget | null, root: Element, deltaY: number): boolean;
|
|
33
|
+
export declare function isTextInput(target: EventTarget | null): boolean;
|
|
34
|
+
/** Swallows the click that follows a mouse drag, so the content under the pointer isn't pressed. */
|
|
35
|
+
export declare function suppressNextClick(): void;
|
|
36
|
+
export declare function prefersReducedMotion(): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* `overflow: clip` rounds the corners without making the element a scroll
|
|
39
|
+
* container, which focusing an input could otherwise scroll.
|
|
40
|
+
*/
|
|
41
|
+
export declare function clipOverflow(): string;
|
|
42
|
+
//# sourceMappingURL=dom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../../../src/web/dom.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,IAAI;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,MAAM;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,WAAW,EAAE,MAAiD,CAAC;AAE5E,eAAO,MAAM,SAAS,SAC4C,CAAC;AAEnE,gGAAgG;AAChG,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,SAAI,GAAG,MAAM,CAM5D;AAID;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAmB3C;AAED,gEAAgE;AAChE,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAcrD;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAM/D;AAED,6DAA6D;AAC7D,wBAAgB,gBAAgB,IAAI,IAAI,CAKvC;AASD,gGAAgG;AAChG,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,WAAW,GAAG,IAAI,EAC1B,IAAI,EAAE,OAAO,GACZ,WAAW,GAAG,IAAI,CAMpB;AAED,qFAAqF;AACrF,wBAAgB,eAAe,CAC7B,MAAM,EAAE,WAAW,GAAG,IAAI,EAC1B,IAAI,EAAE,OAAO,EACb,MAAM,EAAE,MAAM,GACb,OAAO,CAWT;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,GAAG,OAAO,CAO/D;AAED,oGAAoG;AACpG,wBAAgB,iBAAiB,SAUhC;AAED,wBAAgB,oBAAoB,IAAI,OAAO,CAK9C;AAID;;;GAGG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAMrC"}
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
|
|
10
10
|
// Forward declaration of `ModalMode` to properly resolve imports.
|
|
11
11
|
namespace margelo::nitro::nitromodal { enum class ModalMode; }
|
|
12
|
-
// Forward declaration of `
|
|
13
|
-
namespace margelo::nitro::nitromodal { enum class
|
|
12
|
+
// Forward declaration of `NamedSheetDetent` to properly resolve imports.
|
|
13
|
+
namespace margelo::nitro::nitromodal { enum class NamedSheetDetent; }
|
|
14
14
|
// Forward declaration of `KeyboardBehavior` to properly resolve imports.
|
|
15
15
|
namespace margelo::nitro::nitromodal { enum class KeyboardBehavior; }
|
|
16
16
|
// Forward declaration of `PopupAnimation` to properly resolve imports.
|
|
@@ -22,9 +22,11 @@ namespace margelo::nitro::nitromodal { struct ModalContentArea; }
|
|
|
22
22
|
|
|
23
23
|
#include "ModalMode.hpp"
|
|
24
24
|
#include "JModalMode.hpp"
|
|
25
|
-
#include "
|
|
25
|
+
#include "NamedSheetDetent.hpp"
|
|
26
|
+
#include <variant>
|
|
26
27
|
#include <vector>
|
|
27
28
|
#include "JSheetDetent.hpp"
|
|
29
|
+
#include "JNamedSheetDetent.hpp"
|
|
28
30
|
#include <optional>
|
|
29
31
|
#include "KeyboardBehavior.hpp"
|
|
30
32
|
#include "JKeyboardBehavior.hpp"
|
|
@@ -89,12 +91,21 @@ namespace margelo::nitro::nitromodal {
|
|
|
89
91
|
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JModalMode> /* mode */)>("setMode");
|
|
90
92
|
method(_javaPart, JModalMode::fromCpp(mode));
|
|
91
93
|
}
|
|
92
|
-
|
|
94
|
+
bool JHybridNitroModalSpec::getIsInline() {
|
|
95
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jboolean()>("isInline");
|
|
96
|
+
auto __result = method(_javaPart);
|
|
97
|
+
return static_cast<bool>(__result);
|
|
98
|
+
}
|
|
99
|
+
void JHybridNitroModalSpec::setIsInline(bool isInline) {
|
|
100
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jboolean /* isInline */)>("setInline");
|
|
101
|
+
method(_javaPart, isInline);
|
|
102
|
+
}
|
|
103
|
+
std::vector<std::variant<NamedSheetDetent, double>> JHybridNitroModalSpec::getDetents() {
|
|
93
104
|
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JArrayClass<JSheetDetent>>()>("getDetents");
|
|
94
105
|
auto __result = method(_javaPart);
|
|
95
106
|
return [&](auto&& __input) {
|
|
96
107
|
size_t __size = __input->size();
|
|
97
|
-
std::vector<
|
|
108
|
+
std::vector<std::variant<NamedSheetDetent, double>> __vector;
|
|
98
109
|
__vector.reserve(__size);
|
|
99
110
|
for (size_t __i = 0; __i < __size; __i++) {
|
|
100
111
|
auto __element = __input->getElement(__i);
|
|
@@ -103,7 +114,7 @@ namespace margelo::nitro::nitromodal {
|
|
|
103
114
|
return __vector;
|
|
104
115
|
}(__result);
|
|
105
116
|
}
|
|
106
|
-
void JHybridNitroModalSpec::setDetents(const std::vector<
|
|
117
|
+
void JHybridNitroModalSpec::setDetents(const std::vector<std::variant<NamedSheetDetent, double>>& detents) {
|
|
107
118
|
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JArrayClass<JSheetDetent>> /* detents */)>("setDetents");
|
|
108
119
|
method(_javaPart, [&](auto&& __input) {
|
|
109
120
|
size_t __size = __input.size();
|
|
@@ -224,6 +235,15 @@ namespace margelo::nitro::nitromodal {
|
|
|
224
235
|
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JPopupAnimation> /* popupAnimation */)>("setPopupAnimation");
|
|
225
236
|
method(_javaPart, JPopupAnimation::fromCpp(popupAnimation));
|
|
226
237
|
}
|
|
238
|
+
bool JHybridNitroModalSpec::getPullToRefreshEnabled() {
|
|
239
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jboolean()>("getPullToRefreshEnabled");
|
|
240
|
+
auto __result = method(_javaPart);
|
|
241
|
+
return static_cast<bool>(__result);
|
|
242
|
+
}
|
|
243
|
+
void JHybridNitroModalSpec::setPullToRefreshEnabled(bool pullToRefreshEnabled) {
|
|
244
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jboolean /* pullToRefreshEnabled */)>("setPullToRefreshEnabled");
|
|
245
|
+
method(_javaPart, pullToRefreshEnabled);
|
|
246
|
+
}
|
|
227
247
|
std::optional<std::function<void()>> JHybridNitroModalSpec::getOnPresent() {
|
|
228
248
|
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JFunc_void::javaobject>()>("getOnPresent_cxx");
|
|
229
249
|
auto __result = method(_javaPart);
|
|
@@ -326,6 +346,40 @@ namespace margelo::nitro::nitromodal {
|
|
|
326
346
|
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_ModalContentArea::javaobject> /* onContentAreaChange */)>("setOnContentAreaChange_cxx");
|
|
327
347
|
method(_javaPart, onContentAreaChange.has_value() ? JFunc_void_ModalContentArea_cxx::fromCpp(onContentAreaChange.value()) : nullptr);
|
|
328
348
|
}
|
|
349
|
+
std::optional<std::function<void()>> JHybridNitroModalSpec::getOnPullToRefresh() {
|
|
350
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JFunc_void::javaobject>()>("getOnPullToRefresh_cxx");
|
|
351
|
+
auto __result = method(_javaPart);
|
|
352
|
+
return __result != nullptr ? std::make_optional([&]() -> std::function<void()> {
|
|
353
|
+
if (__result->isInstanceOf(JFunc_void_cxx::javaClassStatic())) [[likely]] {
|
|
354
|
+
auto downcast = jni::static_ref_cast<JFunc_void_cxx::javaobject>(__result);
|
|
355
|
+
return downcast->cthis()->getFunction();
|
|
356
|
+
} else {
|
|
357
|
+
auto __resultRef = jni::make_global(__result);
|
|
358
|
+
return JNICallable<JFunc_void, void()>(std::move(__resultRef));
|
|
359
|
+
}
|
|
360
|
+
}()) : std::nullopt;
|
|
361
|
+
}
|
|
362
|
+
void JHybridNitroModalSpec::setOnPullToRefresh(const std::optional<std::function<void()>>& onPullToRefresh) {
|
|
363
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void::javaobject> /* onPullToRefresh */)>("setOnPullToRefresh_cxx");
|
|
364
|
+
method(_javaPart, onPullToRefresh.has_value() ? JFunc_void_cxx::fromCpp(onPullToRefresh.value()) : nullptr);
|
|
365
|
+
}
|
|
366
|
+
std::optional<std::function<void(double /* top */)>> JHybridNitroModalSpec::getOnRestingTopChange() {
|
|
367
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JFunc_void_double::javaobject>()>("getOnRestingTopChange_cxx");
|
|
368
|
+
auto __result = method(_javaPart);
|
|
369
|
+
return __result != nullptr ? std::make_optional([&]() -> std::function<void(double /* top */)> {
|
|
370
|
+
if (__result->isInstanceOf(JFunc_void_double_cxx::javaClassStatic())) [[likely]] {
|
|
371
|
+
auto downcast = jni::static_ref_cast<JFunc_void_double_cxx::javaobject>(__result);
|
|
372
|
+
return downcast->cthis()->getFunction();
|
|
373
|
+
} else {
|
|
374
|
+
auto __resultRef = jni::make_global(__result);
|
|
375
|
+
return JNICallable<JFunc_void_double, void(double)>(std::move(__resultRef));
|
|
376
|
+
}
|
|
377
|
+
}()) : std::nullopt;
|
|
378
|
+
}
|
|
379
|
+
void JHybridNitroModalSpec::setOnRestingTopChange(const std::optional<std::function<void(double /* top */)>>& onRestingTopChange) {
|
|
380
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_double::javaobject> /* onRestingTopChange */)>("setOnRestingTopChange_cxx");
|
|
381
|
+
method(_javaPart, onRestingTopChange.has_value() ? JFunc_void_double_cxx::fromCpp(onRestingTopChange.value()) : nullptr);
|
|
382
|
+
}
|
|
329
383
|
|
|
330
384
|
// Methods
|
|
331
385
|
void JHybridNitroModalSpec::present() {
|
|
@@ -54,8 +54,10 @@ namespace margelo::nitro::nitromodal {
|
|
|
54
54
|
void setIsOpen(bool isOpen) override;
|
|
55
55
|
ModalMode getMode() override;
|
|
56
56
|
void setMode(ModalMode mode) override;
|
|
57
|
-
|
|
58
|
-
void
|
|
57
|
+
bool getIsInline() override;
|
|
58
|
+
void setIsInline(bool isInline) override;
|
|
59
|
+
std::vector<std::variant<NamedSheetDetent, double>> getDetents() override;
|
|
60
|
+
void setDetents(const std::vector<std::variant<NamedSheetDetent, double>>& detents) override;
|
|
59
61
|
double getInitialDetentIndex() override;
|
|
60
62
|
void setInitialDetentIndex(double initialDetentIndex) override;
|
|
61
63
|
double getBackdropColor() override;
|
|
@@ -80,6 +82,8 @@ namespace margelo::nitro::nitromodal {
|
|
|
80
82
|
void setKeyboardBehavior(KeyboardBehavior keyboardBehavior) override;
|
|
81
83
|
PopupAnimation getPopupAnimation() override;
|
|
82
84
|
void setPopupAnimation(PopupAnimation popupAnimation) override;
|
|
85
|
+
bool getPullToRefreshEnabled() override;
|
|
86
|
+
void setPullToRefreshEnabled(bool pullToRefreshEnabled) override;
|
|
83
87
|
std::optional<std::function<void()>> getOnPresent() override;
|
|
84
88
|
void setOnPresent(const std::optional<std::function<void()>>& onPresent) override;
|
|
85
89
|
std::optional<std::function<void(DismissReason /* reason */)>> getOnDismiss() override;
|
|
@@ -92,6 +96,10 @@ namespace margelo::nitro::nitromodal {
|
|
|
92
96
|
void setOnBackButtonPress(const std::optional<std::function<void()>>& onBackButtonPress) override;
|
|
93
97
|
std::optional<std::function<void(const ModalContentArea& /* area */)>> getOnContentAreaChange() override;
|
|
94
98
|
void setOnContentAreaChange(const std::optional<std::function<void(const ModalContentArea& /* area */)>>& onContentAreaChange) override;
|
|
99
|
+
std::optional<std::function<void()>> getOnPullToRefresh() override;
|
|
100
|
+
void setOnPullToRefresh(const std::optional<std::function<void()>>& onPullToRefresh) override;
|
|
101
|
+
std::optional<std::function<void(double /* top */)>> getOnRestingTopChange() override;
|
|
102
|
+
void setOnRestingTopChange(const std::optional<std::function<void(double /* top */)>>& onRestingTopChange) override;
|
|
95
103
|
|
|
96
104
|
public:
|
|
97
105
|
// Methods
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JNamedSheetDetent.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include "NamedSheetDetent.hpp"
|
|
12
|
+
|
|
13
|
+
namespace margelo::nitro::nitromodal {
|
|
14
|
+
|
|
15
|
+
using namespace facebook;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The C++ JNI bridge between the C++ enum "NamedSheetDetent" and the Kotlin enum "NamedSheetDetent".
|
|
19
|
+
*/
|
|
20
|
+
struct JNamedSheetDetent final: public jni::JavaClass<JNamedSheetDetent> {
|
|
21
|
+
public:
|
|
22
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nitromodal/NamedSheetDetent;";
|
|
23
|
+
|
|
24
|
+
public:
|
|
25
|
+
/**
|
|
26
|
+
* Convert this Java/Kotlin-based enum to the C++ enum NamedSheetDetent.
|
|
27
|
+
*/
|
|
28
|
+
[[maybe_unused]]
|
|
29
|
+
[[nodiscard]]
|
|
30
|
+
NamedSheetDetent toCpp() const {
|
|
31
|
+
static const auto clazz = javaClassStatic();
|
|
32
|
+
static const auto fieldOrdinal = clazz->getField<int>("value");
|
|
33
|
+
int ordinal = this->getFieldValue(fieldOrdinal);
|
|
34
|
+
return static_cast<NamedSheetDetent>(ordinal);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public:
|
|
38
|
+
/**
|
|
39
|
+
* Create a Java/Kotlin-based enum with the given C++ enum's value.
|
|
40
|
+
*/
|
|
41
|
+
[[maybe_unused]]
|
|
42
|
+
static jni::alias_ref<JNamedSheetDetent> fromCpp(NamedSheetDetent value) {
|
|
43
|
+
static const auto clazz = javaClassStatic();
|
|
44
|
+
switch (value) {
|
|
45
|
+
case NamedSheetDetent::SMALL:
|
|
46
|
+
static const auto fieldSMALL = clazz->getStaticField<JNamedSheetDetent>("SMALL");
|
|
47
|
+
return clazz->getStaticFieldValue(fieldSMALL);
|
|
48
|
+
case NamedSheetDetent::MEDIUM:
|
|
49
|
+
static const auto fieldMEDIUM = clazz->getStaticField<JNamedSheetDetent>("MEDIUM");
|
|
50
|
+
return clazz->getStaticFieldValue(fieldMEDIUM);
|
|
51
|
+
case NamedSheetDetent::LARGE:
|
|
52
|
+
static const auto fieldLARGE = clazz->getStaticField<JNamedSheetDetent>("LARGE");
|
|
53
|
+
return clazz->getStaticFieldValue(fieldLARGE);
|
|
54
|
+
case NamedSheetDetent::FITCONTENT:
|
|
55
|
+
static const auto fieldFITCONTENT = clazz->getStaticField<JNamedSheetDetent>("FITCONTENT");
|
|
56
|
+
return clazz->getStaticFieldValue(fieldFITCONTENT);
|
|
57
|
+
default:
|
|
58
|
+
std::string stringValue = std::to_string(static_cast<int>(value));
|
|
59
|
+
throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
} // namespace margelo::nitro::nitromodal
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JSheetDetent.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "JSheetDetent.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::nitromodal {
|
|
11
|
+
/**
|
|
12
|
+
* Converts JSheetDetent to std::variant<NamedSheetDetent, double>
|
|
13
|
+
*/
|
|
14
|
+
std::variant<NamedSheetDetent, double> JSheetDetent::toCpp() const {
|
|
15
|
+
if (isInstanceOf(JSheetDetent_impl::First::javaClassStatic())) {
|
|
16
|
+
// It's a `NamedSheetDetent`
|
|
17
|
+
auto jniValue = static_cast<const JSheetDetent_impl::First*>(this)->getValue();
|
|
18
|
+
return jniValue->toCpp();
|
|
19
|
+
} else if (isInstanceOf(JSheetDetent_impl::Second::javaClassStatic())) {
|
|
20
|
+
// It's a `double`
|
|
21
|
+
auto jniValue = static_cast<const JSheetDetent_impl::Second*>(this)->getValue();
|
|
22
|
+
return jniValue;
|
|
23
|
+
}
|
|
24
|
+
throw std::invalid_argument("Variant is unknown Kotlin instance!");
|
|
25
|
+
}
|
|
26
|
+
} // namespace margelo::nitro::nitromodal
|
|
@@ -8,57 +8,62 @@
|
|
|
8
8
|
#pragma once
|
|
9
9
|
|
|
10
10
|
#include <fbjni/fbjni.h>
|
|
11
|
-
#include
|
|
11
|
+
#include <variant>
|
|
12
|
+
|
|
13
|
+
#include "NamedSheetDetent.hpp"
|
|
14
|
+
#include <variant>
|
|
15
|
+
#include "JNamedSheetDetent.hpp"
|
|
12
16
|
|
|
13
17
|
namespace margelo::nitro::nitromodal {
|
|
14
18
|
|
|
15
19
|
using namespace facebook;
|
|
16
20
|
|
|
17
21
|
/**
|
|
18
|
-
* The C++ JNI bridge between the C++
|
|
22
|
+
* The C++ JNI bridge between the C++ std::variant and the Java class "SheetDetent".
|
|
19
23
|
*/
|
|
20
|
-
|
|
24
|
+
class JSheetDetent: public jni::JavaClass<JSheetDetent> {
|
|
21
25
|
public:
|
|
22
26
|
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nitromodal/SheetDetent;";
|
|
23
27
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
static const auto clazz = javaClassStatic();
|
|
32
|
-
static const auto fieldOrdinal = clazz->getField<int>("value");
|
|
33
|
-
int ordinal = this->getFieldValue(fieldOrdinal);
|
|
34
|
-
return static_cast<SheetDetent>(ordinal);
|
|
28
|
+
static jni::local_ref<JSheetDetent> create_0(jni::alias_ref<JNamedSheetDetent> value) {
|
|
29
|
+
static const auto method = javaClassStatic()->getStaticMethod<JSheetDetent(jni::alias_ref<JNamedSheetDetent>)>("create");
|
|
30
|
+
return method(javaClassStatic(), value);
|
|
31
|
+
}
|
|
32
|
+
static jni::local_ref<JSheetDetent> create_1(double value) {
|
|
33
|
+
static const auto method = javaClassStatic()->getStaticMethod<JSheetDetent(double)>("create");
|
|
34
|
+
return method(javaClassStatic(), value);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
static jni::alias_ref<JSheetDetent> fromCpp(SheetDetent value) {
|
|
43
|
-
static const auto clazz = javaClassStatic();
|
|
44
|
-
switch (value) {
|
|
45
|
-
case SheetDetent::SMALL:
|
|
46
|
-
static const auto fieldSMALL = clazz->getStaticField<JSheetDetent>("SMALL");
|
|
47
|
-
return clazz->getStaticFieldValue(fieldSMALL);
|
|
48
|
-
case SheetDetent::MEDIUM:
|
|
49
|
-
static const auto fieldMEDIUM = clazz->getStaticField<JSheetDetent>("MEDIUM");
|
|
50
|
-
return clazz->getStaticFieldValue(fieldMEDIUM);
|
|
51
|
-
case SheetDetent::LARGE:
|
|
52
|
-
static const auto fieldLARGE = clazz->getStaticField<JSheetDetent>("LARGE");
|
|
53
|
-
return clazz->getStaticFieldValue(fieldLARGE);
|
|
54
|
-
case SheetDetent::FITCONTENT:
|
|
55
|
-
static const auto fieldFITCONTENT = clazz->getStaticField<JSheetDetent>("FITCONTENT");
|
|
56
|
-
return clazz->getStaticFieldValue(fieldFITCONTENT);
|
|
57
|
-
default:
|
|
58
|
-
std::string stringValue = std::to_string(static_cast<int>(value));
|
|
59
|
-
throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
|
|
37
|
+
static jni::local_ref<JSheetDetent> fromCpp(const std::variant<NamedSheetDetent, double>& variant) {
|
|
38
|
+
switch (variant.index()) {
|
|
39
|
+
case 0: return create_0(JNamedSheetDetent::fromCpp(std::get<0>(variant)));
|
|
40
|
+
case 1: return create_1(std::get<1>(variant));
|
|
41
|
+
default: throw std::invalid_argument("Variant holds unknown index! (" + std::to_string(variant.index()) + ")");
|
|
60
42
|
}
|
|
61
43
|
}
|
|
44
|
+
|
|
45
|
+
[[nodiscard]] std::variant<NamedSheetDetent, double> toCpp() const;
|
|
62
46
|
};
|
|
63
47
|
|
|
48
|
+
namespace JSheetDetent_impl {
|
|
49
|
+
class First final: public jni::JavaClass<First, JSheetDetent> {
|
|
50
|
+
public:
|
|
51
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nitromodal/SheetDetent$First;";
|
|
52
|
+
|
|
53
|
+
[[nodiscard]] jni::local_ref<JNamedSheetDetent> getValue() const {
|
|
54
|
+
static const auto field = javaClassStatic()->getField<JNamedSheetDetent>("value");
|
|
55
|
+
return getFieldValue(field);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
class Second final: public jni::JavaClass<Second, JSheetDetent> {
|
|
60
|
+
public:
|
|
61
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nitromodal/SheetDetent$Second;";
|
|
62
|
+
|
|
63
|
+
[[nodiscard]] double getValue() const {
|
|
64
|
+
static const auto field = javaClassStatic()->getField<double>("value");
|
|
65
|
+
return getFieldValue(field);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
} // namespace JSheetDetent_impl
|
|
64
69
|
} // namespace margelo::nitro::nitromodal
|
|
@@ -63,6 +63,11 @@ void JHybridNitroModalStateUpdater::updateViewProps(jni::alias_ref<jni::JClass>
|
|
|
63
63
|
: !newProps->mode.hasSameValue(oldProps->mode)) {
|
|
64
64
|
hybridView->setMode(newProps->mode.get());
|
|
65
65
|
}
|
|
66
|
+
if (oldProps == nullptr
|
|
67
|
+
? newProps->isInline.isProvided()
|
|
68
|
+
: !newProps->isInline.hasSameValue(oldProps->isInline)) {
|
|
69
|
+
hybridView->setIsInline(newProps->isInline.get());
|
|
70
|
+
}
|
|
66
71
|
if (oldProps == nullptr
|
|
67
72
|
? newProps->detents.isProvided()
|
|
68
73
|
: !newProps->detents.hasSameValue(oldProps->detents)) {
|
|
@@ -128,6 +133,11 @@ void JHybridNitroModalStateUpdater::updateViewProps(jni::alias_ref<jni::JClass>
|
|
|
128
133
|
: !newProps->popupAnimation.hasSameValue(oldProps->popupAnimation)) {
|
|
129
134
|
hybridView->setPopupAnimation(newProps->popupAnimation.get());
|
|
130
135
|
}
|
|
136
|
+
if (oldProps == nullptr
|
|
137
|
+
? newProps->pullToRefreshEnabled.isProvided()
|
|
138
|
+
: !newProps->pullToRefreshEnabled.hasSameValue(oldProps->pullToRefreshEnabled)) {
|
|
139
|
+
hybridView->setPullToRefreshEnabled(newProps->pullToRefreshEnabled.get());
|
|
140
|
+
}
|
|
131
141
|
if (oldProps == nullptr
|
|
132
142
|
? newProps->onPresent.isProvided()
|
|
133
143
|
: !newProps->onPresent.hasSameValue(oldProps->onPresent)) {
|
|
@@ -158,6 +168,16 @@ void JHybridNitroModalStateUpdater::updateViewProps(jni::alias_ref<jni::JClass>
|
|
|
158
168
|
: !newProps->onContentAreaChange.hasSameValue(oldProps->onContentAreaChange)) {
|
|
159
169
|
hybridView->setOnContentAreaChange(newProps->onContentAreaChange.get());
|
|
160
170
|
}
|
|
171
|
+
if (oldProps == nullptr
|
|
172
|
+
? newProps->onPullToRefresh.isProvided()
|
|
173
|
+
: !newProps->onPullToRefresh.hasSameValue(oldProps->onPullToRefresh)) {
|
|
174
|
+
hybridView->setOnPullToRefresh(newProps->onPullToRefresh.get());
|
|
175
|
+
}
|
|
176
|
+
if (oldProps == nullptr
|
|
177
|
+
? newProps->onRestingTopChange.isProvided()
|
|
178
|
+
: !newProps->onRestingTopChange.hasSameValue(oldProps->onRestingTopChange)) {
|
|
179
|
+
hybridView->setOnRestingTopChange(newProps->onRestingTopChange.get());
|
|
180
|
+
}
|
|
161
181
|
|
|
162
182
|
// Update hybridRef if it changed
|
|
163
183
|
if (oldProps == nullptr
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromodal/HybridNitroModalSpec.kt
CHANGED
|
@@ -39,6 +39,12 @@ abstract class HybridNitroModalSpec: HybridView() {
|
|
|
39
39
|
@set:Keep
|
|
40
40
|
abstract var mode: ModalMode
|
|
41
41
|
|
|
42
|
+
@get:DoNotStrip
|
|
43
|
+
@get:Keep
|
|
44
|
+
@set:DoNotStrip
|
|
45
|
+
@set:Keep
|
|
46
|
+
abstract var isInline: Boolean
|
|
47
|
+
|
|
42
48
|
@get:DoNotStrip
|
|
43
49
|
@get:Keep
|
|
44
50
|
@set:DoNotStrip
|
|
@@ -117,6 +123,12 @@ abstract class HybridNitroModalSpec: HybridView() {
|
|
|
117
123
|
@set:Keep
|
|
118
124
|
abstract var popupAnimation: PopupAnimation
|
|
119
125
|
|
|
126
|
+
@get:DoNotStrip
|
|
127
|
+
@get:Keep
|
|
128
|
+
@set:DoNotStrip
|
|
129
|
+
@set:Keep
|
|
130
|
+
abstract var pullToRefreshEnabled: Boolean
|
|
131
|
+
|
|
120
132
|
abstract var onPresent: (() -> Unit)?
|
|
121
133
|
|
|
122
134
|
private var onPresent_cxx: Func_void?
|
|
@@ -200,6 +212,34 @@ abstract class HybridNitroModalSpec: HybridView() {
|
|
|
200
212
|
set(value) {
|
|
201
213
|
onContentAreaChange = value?.let { it }
|
|
202
214
|
}
|
|
215
|
+
|
|
216
|
+
abstract var onPullToRefresh: (() -> Unit)?
|
|
217
|
+
|
|
218
|
+
private var onPullToRefresh_cxx: Func_void?
|
|
219
|
+
@Keep
|
|
220
|
+
@DoNotStrip
|
|
221
|
+
get() {
|
|
222
|
+
return onPullToRefresh?.let { Func_void_java(it) }
|
|
223
|
+
}
|
|
224
|
+
@Keep
|
|
225
|
+
@DoNotStrip
|
|
226
|
+
set(value) {
|
|
227
|
+
onPullToRefresh = value?.let { it }
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
abstract var onRestingTopChange: ((top: Double) -> Unit)?
|
|
231
|
+
|
|
232
|
+
private var onRestingTopChange_cxx: Func_void_double?
|
|
233
|
+
@Keep
|
|
234
|
+
@DoNotStrip
|
|
235
|
+
get() {
|
|
236
|
+
return onRestingTopChange?.let { Func_void_double_java(it) }
|
|
237
|
+
}
|
|
238
|
+
@Keep
|
|
239
|
+
@DoNotStrip
|
|
240
|
+
set(value) {
|
|
241
|
+
onRestingTopChange = value?.let { it }
|
|
242
|
+
}
|
|
203
243
|
|
|
204
244
|
// Methods
|
|
205
245
|
@DoNotStrip
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NamedSheetDetent.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.nitromodal
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Represents the JavaScript enum/union "NamedSheetDetent".
|
|
15
|
+
*/
|
|
16
|
+
@DoNotStrip
|
|
17
|
+
@Keep
|
|
18
|
+
enum class NamedSheetDetent(@DoNotStrip @Keep val value: Int) {
|
|
19
|
+
SMALL(0),
|
|
20
|
+
MEDIUM(1),
|
|
21
|
+
LARGE(2),
|
|
22
|
+
FITCONTENT(3);
|
|
23
|
+
|
|
24
|
+
companion object
|
|
25
|
+
}
|