concentric-sheet 0.0.2

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 (45) hide show
  1. package/LICENSE +21 -0
  2. package/NitroConcentricSheet.podspec +31 -0
  3. package/README.md +118 -0
  4. package/ios/Bridge.h +8 -0
  5. package/ios/SheetModalController.swift +912 -0
  6. package/lib/NativeSheetModal.d.ts +10 -0
  7. package/lib/NativeSheetModal.js +243 -0
  8. package/lib/index.d.ts +3 -0
  9. package/lib/index.js +1 -0
  10. package/lib/specs/SheetModalController.nitro.d.ts +46 -0
  11. package/lib/specs/SheetModalController.nitro.js +1 -0
  12. package/nitro.json +23 -0
  13. package/nitrogen/generated/.gitattributes +1 -0
  14. package/nitrogen/generated/ios/NitroConcentricSheet+autolinking.rb +60 -0
  15. package/nitrogen/generated/ios/NitroConcentricSheet-Swift-Cxx-Bridge.cpp +33 -0
  16. package/nitrogen/generated/ios/NitroConcentricSheet-Swift-Cxx-Bridge.hpp +269 -0
  17. package/nitrogen/generated/ios/NitroConcentricSheet-Swift-Cxx-Umbrella.hpp +69 -0
  18. package/nitrogen/generated/ios/NitroConcentricSheetAutolinking.mm +33 -0
  19. package/nitrogen/generated/ios/NitroConcentricSheetAutolinking.swift +26 -0
  20. package/nitrogen/generated/ios/c++/HybridSheetModalControllerSpecSwift.cpp +11 -0
  21. package/nitrogen/generated/ios/c++/HybridSheetModalControllerSpecSwift.hpp +130 -0
  22. package/nitrogen/generated/ios/swift/HybridSheetModalControllerSpec.swift +58 -0
  23. package/nitrogen/generated/ios/swift/HybridSheetModalControllerSpec_cxx.swift +181 -0
  24. package/nitrogen/generated/ios/swift/ModalCornerConfiguration.swift +83 -0
  25. package/nitrogen/generated/ios/swift/ModalCornerConfigurationType.swift +48 -0
  26. package/nitrogen/generated/ios/swift/ModalViewBackground.swift +40 -0
  27. package/nitrogen/generated/ios/swift/PresentedModalConfig.swift +129 -0
  28. package/nitrogen/generated/ios/swift/PresentedModalDetent.swift +71 -0
  29. package/nitrogen/generated/ios/swift/SheetDetentIdentifier.swift +40 -0
  30. package/nitrogen/generated/ios/swift/SheetPresentationConfig.swift +238 -0
  31. package/nitrogen/generated/ios/swift/Variant_NullType_PresentedModalDetent.swift +18 -0
  32. package/nitrogen/generated/shared/c++/HybridSheetModalControllerSpec.cpp +24 -0
  33. package/nitrogen/generated/shared/c++/HybridSheetModalControllerSpec.hpp +71 -0
  34. package/nitrogen/generated/shared/c++/ModalCornerConfiguration.hpp +97 -0
  35. package/nitrogen/generated/shared/c++/ModalCornerConfigurationType.hpp +84 -0
  36. package/nitrogen/generated/shared/c++/ModalViewBackground.hpp +76 -0
  37. package/nitrogen/generated/shared/c++/PresentedModalConfig.hpp +115 -0
  38. package/nitrogen/generated/shared/c++/PresentedModalDetent.hpp +94 -0
  39. package/nitrogen/generated/shared/c++/SheetDetentIdentifier.hpp +76 -0
  40. package/nitrogen/generated/shared/c++/SheetPresentationConfig.hpp +130 -0
  41. package/package.json +103 -0
  42. package/react-native.config.js +13 -0
  43. package/src/NativeSheetModal.tsx +343 -0
  44. package/src/index.ts +16 -0
  45. package/src/specs/SheetModalController.nitro.ts +54 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Vercel
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,31 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = "NitroConcentricSheet"
7
+ s.version = package["version"]
8
+ s.summary = package["description"]
9
+ s.homepage = package["homepage"]
10
+ s.license = package["license"]
11
+ s.authors = package["author"]
12
+
13
+ s.platforms = { :ios => '15.0', :visionos => 1.0 }
14
+ s.source = { :git => "https://github.com/mrousavy/nitro.git", :tag => "#{s.version}" }
15
+
16
+ s.source_files = [
17
+ # Implementation (Swift)
18
+ "ios/**/*.{swift}",
19
+ # Autolinking/Registration (Objective-C++)
20
+ "ios/**/*.{m,mm}",
21
+ # Implementation (C++ objects)
22
+ "cpp/**/*.{hpp,cpp}",
23
+ ]
24
+
25
+ load 'nitrogen/generated/ios/NitroConcentricSheet+autolinking.rb'
26
+ add_nitrogen_files(s)
27
+
28
+ s.dependency 'React-jsi'
29
+ s.dependency 'React-callinvoker'
30
+ install_modules_dependencies(s)
31
+ end
package/README.md ADDED
@@ -0,0 +1,118 @@
1
+ # Concentric Sheet
2
+
3
+ <video src="https://github.com/user-attachments/assets/b6e97bdf-80fc-4425-ae6c-e52ebae5ac67" width=1600 height=900 style="width: 100%; height: auto"></video>
4
+
5
+ React Native `Modal` replacement for iOS sheet presentation.
6
+
7
+ This package keeps React Native's `Modal` behavior, and adds runtime access to
8
+ native `UIViewController` / `UISheetPresentationController` options such as:
9
+
10
+ - Detents (`medium`, `large`)
11
+ - Custom detent heights (`[78, 350]`)
12
+ - Grabber visibility
13
+ - Preferred corner radius
14
+ - Selected detent
15
+ - Largest undimmed detent
16
+ - Edge-attached behavior
17
+ - Interactive dismissal lock (`isModalInPresentation`)
18
+ - Preferred content width/height
19
+
20
+ ## Install
21
+
22
+ ```sh
23
+ bun add concentric-sheet react-native-nitro-modules
24
+ ```
25
+
26
+ Then install iOS pods in your app:
27
+
28
+ ```sh
29
+ bunx pod-install ./ios
30
+ ```
31
+
32
+ ## Usage
33
+
34
+ ```tsx
35
+ import React from 'react'
36
+ import { View, Text, Button } from 'react-native'
37
+ import { Modal } from 'concentric-sheet'
38
+
39
+ export function Example() {
40
+ const [visible, setVisible] = React.useState(false)
41
+
42
+ return (
43
+ <>
44
+ <Button title="Open" onPress={() => setVisible(true)} />
45
+ <Modal
46
+ visible={visible}
47
+ onRequestClose={() => setVisible(false)}
48
+ detents={['medium', 'large']}
49
+ prefersGrabberVisible
50
+ preferredCornerRadius={24}
51
+ >
52
+ <View style={{ flex: 1, padding: 20 }}>
53
+ <Text>Native sheet modal</Text>
54
+ <Button title="Close" onPress={() => setVisible(false)} />
55
+ </View>
56
+ </Modal>
57
+ </>
58
+ )
59
+ }
60
+ ```
61
+
62
+ ## API
63
+
64
+ `Modal` accepts all React Native `Modal` props, plus:
65
+
66
+ - `detents?: ('medium' | 'large')[]`
67
+ - `customDetentHeights?: number[]` (iOS 16+)
68
+ - `selectedDetentIdentifier?: 'medium' | 'large'`
69
+ - `selectedCustomDetentHeight?: number` (iOS 16+)
70
+ - `largestUndimmedDetentIdentifier?: 'medium' | 'large'`
71
+ - `largestUndimmedCustomDetentHeight?: number` (iOS 16+)
72
+ - `prefersGrabberVisible?: boolean`
73
+ - `preferredCornerRadius?: number`
74
+ - `prefersScrollingExpandsWhenScrolledToEdge?: boolean`
75
+ - `prefersEdgeAttachedInCompactHeight?: boolean`
76
+ - `widthFollowsPreferredContentSizeWhenEdgeAttached?: boolean`
77
+ - `isModalInPresentation?: boolean`
78
+ - `preferredContentWidth?: number`
79
+ - `preferredContentHeight?: number`
80
+ - `modalViewBackground?: 'clear' | 'systemBackground'`
81
+ - `cornerConfiguration?: { type: 'none' | 'fixed' | 'containerConcentric' | 'capsule', radius?: number, minimumRadius?: number, maximumRadius?: number }`
82
+
83
+ Imperative helpers:
84
+
85
+ - `applyPresentedModalConfig(config)`
86
+ - `dismissPresentedNativeModal(animated?)`
87
+
88
+ ## TODO
89
+
90
+ - [ ] Android support
91
+
92
+ ## Contributing
93
+
94
+ The native Swift implementation lives in [`ios/SheetModalController.swift`](ios/SheetModalController.swift).
95
+
96
+ The Nitro TypeScript API is defined in [`src/`](src/). When you change props or the spec, regenerate the native bridge code by running:
97
+
98
+ ```sh
99
+ bunx nitrogen
100
+ ```
101
+
102
+ Commit the generated files in [`nitrogen/`](nitrogen/) alongside your changes.
103
+
104
+ ### DCO
105
+
106
+ All commits must be signed off per the [Developer Certificate of Origin](DCO). Use the `-s` flag when committing:
107
+
108
+ ```sh
109
+ git commit -s -m "your commit message"
110
+ ```
111
+
112
+ ## Notes
113
+
114
+ - iOS-only native implementation.
115
+ - `UISheetPresentationController` options require iOS 15+.
116
+ - `cornerConfiguration` requires iOS 26+.
117
+ - For sheet behavior, use `presentationStyle="pageSheet"` or `formSheet`.
118
+ - Setting `largestUndimmedDetentIdentifier` can disable outside-tap dismissal at/under that detent because the dimming view is removed.
package/ios/Bridge.h ADDED
@@ -0,0 +1,8 @@
1
+ //
2
+ // Bridge.h
3
+ // NitroConcentricSheet
4
+ //
5
+ // Created by Marc Rousavy on 22.07.24.
6
+ //
7
+
8
+ #pragma once