@lodev09/react-native-true-sheet 0.7.0 → 0.8.0

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 (32) hide show
  1. package/README.md +34 -18
  2. package/android/src/main/java/com/lodev09/truesheet/{core/TrueSheetBehavior.kt → TrueSheetBehavior.kt} +69 -39
  3. package/android/src/main/java/com/lodev09/truesheet/TrueSheetDialog.kt +84 -0
  4. package/android/src/main/java/com/lodev09/truesheet/TrueSheetView.kt +82 -61
  5. package/android/src/main/java/com/lodev09/truesheet/core/Events.kt +1 -0
  6. package/android/src/main/java/com/lodev09/truesheet/core/KeyboardManager.kt +53 -0
  7. package/android/src/main/java/com/lodev09/truesheet/core/RootViewGroup.kt +1 -1
  8. package/android/src/main/java/com/lodev09/truesheet/core/Utils.kt +5 -37
  9. package/ios/Extensions/UIView+pinTo.swift +54 -10
  10. package/ios/TrueSheetView.swift +56 -22
  11. package/ios/TrueSheetViewController.swift +36 -0
  12. package/lib/commonjs/TrueSheet.js +4 -1
  13. package/lib/commonjs/TrueSheet.js.map +1 -1
  14. package/lib/commonjs/TrueSheetGrabber.js +56 -0
  15. package/lib/commonjs/TrueSheetGrabber.js.map +1 -0
  16. package/lib/commonjs/index.js +11 -0
  17. package/lib/commonjs/index.js.map +1 -1
  18. package/lib/module/TrueSheet.js +4 -1
  19. package/lib/module/TrueSheet.js.map +1 -1
  20. package/lib/module/TrueSheetGrabber.js +48 -0
  21. package/lib/module/TrueSheetGrabber.js.map +1 -0
  22. package/lib/module/index.js +1 -0
  23. package/lib/module/index.js.map +1 -1
  24. package/lib/typescript/src/TrueSheet.d.ts.map +1 -1
  25. package/lib/typescript/src/TrueSheetGrabber.d.ts +31 -0
  26. package/lib/typescript/src/TrueSheetGrabber.d.ts.map +1 -0
  27. package/lib/typescript/src/index.d.ts +1 -0
  28. package/lib/typescript/src/index.d.ts.map +1 -1
  29. package/package.json +1 -1
  30. package/src/TrueSheet.tsx +2 -0
  31. package/src/TrueSheetGrabber.tsx +74 -0
  32. package/src/index.ts +1 -0
@@ -0,0 +1,74 @@
1
+ import React from 'react'
2
+ import { View, type ColorValue, type ViewProps, type ViewStyle } from 'react-native'
3
+
4
+ const GRABBER_WRAPPER_HEIGHT = 24
5
+ const GRABBER_DEFAULT_HEIGHT = 4
6
+ const GRABBER_DEFAULT_WIDTH = 32
7
+ const GRABBER_DEFAULT_COLOR = '#49454F'
8
+
9
+ interface TrueSheetGrabberProps extends ViewProps {
10
+ /**
11
+ * Is grabber visible
12
+ * @default true
13
+ */
14
+ visible?: boolean
15
+
16
+ /**
17
+ * Grabber color according to M3 specs
18
+ * @default #49454F
19
+ */
20
+ color?: ColorValue
21
+
22
+ /**
23
+ * Grabber height according to M3 specs
24
+ * @default 4
25
+ */
26
+ height?: number
27
+
28
+ /**
29
+ * Grabber width according to M3 specs
30
+ * @default 32
31
+ */
32
+ width?: number
33
+ }
34
+
35
+ /**
36
+ * Little Grabber component.
37
+ * Used by defualt for Android but feel free to re-use.
38
+ */
39
+ export const TrueSheetGrabber = (props: TrueSheetGrabberProps) => {
40
+ const {
41
+ visible = true,
42
+ color = GRABBER_DEFAULT_COLOR,
43
+ width = GRABBER_DEFAULT_WIDTH,
44
+ height = GRABBER_DEFAULT_HEIGHT,
45
+ style,
46
+ ...rest
47
+ } = props
48
+
49
+ if (!visible) return null
50
+
51
+ return (
52
+ <View style={$wrapper}>
53
+ <View style={[$grabber, { height, width, backgroundColor: color }, style]} {...rest} />
54
+ </View>
55
+ )
56
+ }
57
+
58
+ const $wrapper: ViewStyle = {
59
+ position: 'absolute',
60
+ top: 0,
61
+ left: 0,
62
+ right: 0,
63
+ alignSelf: 'center',
64
+ height: GRABBER_WRAPPER_HEIGHT,
65
+ alignItems: 'center',
66
+ zIndex: 9999,
67
+ }
68
+
69
+ const $grabber: ViewStyle = {
70
+ // M3 spec for opacity
71
+ opacity: 0.4,
72
+ borderRadius: GRABBER_DEFAULT_HEIGHT / 2,
73
+ top: 6,
74
+ }
package/src/index.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './types'
2
2
  export * from './TrueSheet'
3
+ export * from './TrueSheetGrabber'