react-native-unified-action-sheet 0.1.1 → 0.3.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 (61) hide show
  1. package/CHANGELOG.md +66 -1
  2. package/README.md +38 -105
  3. package/android/build.gradle +28 -1
  4. package/android/src/main/java/com/unifiedactionsheet/ActionSheetOptions.kt +6 -2
  5. package/android/src/main/java/com/unifiedactionsheet/PromptOptions.kt +132 -0
  6. package/android/src/main/java/com/unifiedactionsheet/SheetContentBuilder.kt +31 -0
  7. package/android/src/main/java/com/unifiedactionsheet/SheetPresenters.kt +54 -0
  8. package/android/src/main/java/com/unifiedactionsheet/UnifiedActionSheetModule.kt +61 -0
  9. package/android/src/material/java/com/unifiedactionsheet/BottomSheetPresenterFactory.kt +10 -0
  10. package/android/src/material/java/com/unifiedactionsheet/MaterialBottomSheetPresenter.kt +90 -0
  11. package/android/src/material/res/values/unified_action_sheet_bottom_sheet.xml +22 -0
  12. package/android/src/noMaterial/java/com/unifiedactionsheet/BottomSheetPresenterFactory.kt +10 -0
  13. package/app.plugin.js +1 -0
  14. package/ios/BottomSheetViewController.swift +208 -0
  15. package/ios/UnifiedActionSheet.mm +73 -1
  16. package/ios/UnifiedActionSheetImpl.swift +248 -11
  17. package/jest/index.d.ts +15 -1
  18. package/jest/index.js +28 -0
  19. package/lib/commonjs/NativeUnifiedActionSheet.js.map +1 -1
  20. package/lib/commonjs/action-sheet-options.interface.js +4 -0
  21. package/lib/commonjs/common-options.interface.js +2 -0
  22. package/lib/commonjs/common-options.interface.js.map +1 -0
  23. package/lib/commonjs/index.js +57 -5
  24. package/lib/commonjs/index.js.map +1 -1
  25. package/lib/commonjs/prompt-options.interface.js +6 -0
  26. package/lib/commonjs/prompt-options.interface.js.map +1 -0
  27. package/lib/module/NativeUnifiedActionSheet.js.map +1 -1
  28. package/lib/module/action-sheet-options.interface.js +2 -0
  29. package/lib/module/common-options.interface.js +2 -0
  30. package/lib/module/common-options.interface.js.map +1 -0
  31. package/lib/module/index.js +55 -4
  32. package/lib/module/index.js.map +1 -1
  33. package/lib/module/prompt-options.interface.js +4 -0
  34. package/lib/module/prompt-options.interface.js.map +1 -0
  35. package/lib/typescript/commonjs/src/NativeUnifiedActionSheet.d.ts +23 -0
  36. package/lib/typescript/commonjs/src/NativeUnifiedActionSheet.d.ts.map +1 -1
  37. package/lib/typescript/commonjs/src/action-sheet-options.interface.d.ts +5 -14
  38. package/lib/typescript/commonjs/src/action-sheet-options.interface.d.ts.map +1 -1
  39. package/lib/typescript/commonjs/src/common-options.interface.d.ts +17 -0
  40. package/lib/typescript/commonjs/src/common-options.interface.d.ts.map +1 -0
  41. package/lib/typescript/commonjs/src/index.d.ts +4 -0
  42. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  43. package/lib/typescript/commonjs/src/prompt-options.interface.d.ts +19 -0
  44. package/lib/typescript/commonjs/src/prompt-options.interface.d.ts.map +1 -0
  45. package/lib/typescript/module/src/NativeUnifiedActionSheet.d.ts +23 -0
  46. package/lib/typescript/module/src/NativeUnifiedActionSheet.d.ts.map +1 -1
  47. package/lib/typescript/module/src/action-sheet-options.interface.d.ts +5 -14
  48. package/lib/typescript/module/src/action-sheet-options.interface.d.ts.map +1 -1
  49. package/lib/typescript/module/src/common-options.interface.d.ts +17 -0
  50. package/lib/typescript/module/src/common-options.interface.d.ts.map +1 -0
  51. package/lib/typescript/module/src/index.d.ts +4 -0
  52. package/lib/typescript/module/src/index.d.ts.map +1 -1
  53. package/lib/typescript/module/src/prompt-options.interface.d.ts +19 -0
  54. package/lib/typescript/module/src/prompt-options.interface.d.ts.map +1 -0
  55. package/package.json +12 -2
  56. package/plugin/withUnifiedActionSheet.js +58 -0
  57. package/src/NativeUnifiedActionSheet.ts +22 -0
  58. package/src/action-sheet-options.interface.ts +10 -20
  59. package/src/common-options.interface.ts +18 -0
  60. package/src/index.tsx +100 -6
  61. package/src/prompt-options.interface.ts +27 -0
@@ -16,12 +16,18 @@ const toWireOptions = ({
16
16
  // crosses the bridge. Omit<> would not strip it at runtime.
17
17
  anchor: _anchor,
18
18
  ...rest
19
- }) => {
19
+ }) => ({
20
+ ...rest,
21
+ ...toWireButtons(options)
22
+ });
23
+ /// Same flattening as the sheet: labels plus index sets. Kept generic over the
24
+ /// button shape so the two APIs cannot disagree about what 'cancel' means.
25
+ const toWireButtons = buttons => {
20
26
  const labels = [];
21
27
  const destructive = [];
22
28
  const disabled = [];
23
29
  let cancelButtonIndex;
24
- options.forEach((button, index) => {
30
+ buttons.forEach((button, index) => {
25
31
  labels.push(button.label);
26
32
  if (button.style === 'destructive') destructive.push(index);
27
33
  if (button.style === 'cancel' && cancelButtonIndex == null) {
@@ -30,7 +36,6 @@ const toWireOptions = ({
30
36
  if (button.disabled) disabled.push(index);
31
37
  });
32
38
  return {
33
- ...rest,
34
39
  options: labels,
35
40
  ...(cancelButtonIndex == null ? {} : {
36
41
  cancelButtonIndex
@@ -46,6 +51,18 @@ const toWireOptions = ({
46
51
  const showWithNativeModule = options => nativeModule().showActionSheetWithOptions(options)
47
52
  // A programmatic dismiss resolves with no index rather than a selection.
48
53
  .then(buttonIndex => buttonIndex === DISMISSED_BY_API ? undefined : buttonIndex).catch(() => options.cancelButtonIndex ?? -1);
54
+ let warnedMaterialDisabled = false;
55
+
56
+ /// 'bottom' needs Material on Android, which the app opts into at build time.
57
+ /// Without it the sheet falls back to a centered dialog; say so once, in
58
+ /// development, since the fallback alone looks like the option was ignored.
59
+ const warnIfBottomUnavailable = presentationStyle => {
60
+ if (!__DEV__ || warnedMaterialDisabled || Platform.OS !== 'android' || presentationStyle !== 'bottom' || nativeModule().getConstants().isMaterialEnabled) {
61
+ return;
62
+ }
63
+ warnedMaterialDisabled = true;
64
+ console.warn("react-native-unified-action-sheet: presentationStyle 'bottom' needs Material on Android, " + 'so this sheet falls back to a centered dialog. Set unifiedActionSheet.material=true in ' + "android/gradle.properties, or add ['react-native-unified-action-sheet', { material: true }] " + 'to your Expo plugins, then rebuild the app.');
65
+ };
49
66
 
50
67
  /// The anchor is measured in JS and sent across as a rect, so neither native
51
68
  /// module has to resolve a view: a ref's own measureInWindow is the supported
@@ -79,7 +96,12 @@ export const showActionSheetWithOptions = options => {
79
96
  if (Platform.OS !== 'ios' && Platform.OS !== 'android') {
80
97
  return Promise.resolve(undefined);
81
98
  }
82
- return withAnchorRect(wire, options.anchor).then(showWithNativeModule).then(press);
99
+ warnIfBottomUnavailable(options.presentationStyle);
100
+
101
+ // A bottom sheet has no anchor, so don't measure one: on iPad a rect would
102
+ // turn the sheet into an arrowed popover pointing at it.
103
+ const anchor = options.presentationStyle === 'bottom' ? undefined : options.anchor;
104
+ return withAnchorRect(wire, anchor).then(showWithNativeModule).then(press);
83
105
  };
84
106
  export const dismissActionSheet = () => {
85
107
  if (Platform.OS === 'ios' || Platform.OS === 'android') {
@@ -94,4 +116,33 @@ export const dismissAllActionSheets = () => {
94
116
  nativeModule().dismissAllActionSheets();
95
117
  }
96
118
  };
119
+
120
+ /// A prompt is the sheet's centered dialog with a text field: iOS presents a
121
+ /// UIAlertController alert with addTextField, Android the same AppCompatDialog
122
+ /// the centered style uses. React Native's own Alert.prompt is iOS-only and a
123
+ /// silent no-op on Android, which is the gap this fills.
124
+ export const showPromptWithOptions = options => {
125
+ const {
126
+ options: buttons,
127
+ ...rest
128
+ } = options;
129
+ const wire = {
130
+ ...rest,
131
+ ...toWireButtons(buttons)
132
+ };
133
+ if (Platform.OS !== 'ios' && Platform.OS !== 'android') {
134
+ return Promise.resolve(undefined);
135
+ }
136
+ return nativeModule().showPromptWithOptions(wire).then(result =>
137
+ // A programmatic dismiss resolves with no selection, matching the sheet.
138
+ result.buttonIndex === DISMISSED_BY_API ? undefined : result).catch(() => ({
139
+ buttonIndex: wire.cancelButtonIndex ?? -1,
140
+ text: ''
141
+ })).then(result => {
142
+ // The text goes to the handler, so a caller using onPress alone never
143
+ // has to read the resolved value.
144
+ if (result) buttons[result.buttonIndex]?.onPress?.(result.text);
145
+ return result;
146
+ });
147
+ };
97
148
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Platform","DISMISSED_BY_API","nativeModule","require","default","toWireOptions","options","anchor","_anchor","rest","labels","destructive","disabled","cancelButtonIndex","forEach","button","index","push","label","style","length","destructiveButtonIndices","disabledButtonIndices","showWithNativeModule","showActionSheetWithOptions","then","buttonIndex","undefined","catch","withAnchorRect","wire","target","current","Promise","resolve","measureInWindow","x","y","width","height","measured","anchorRect","press","onPress","OS","dismissActionSheet","dismissAllActionSheets"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AAavC,MAAMC,gBAAgB,GAAG,CAAC,CAAC;;AAE3B;AACA;;AASA,MAAMC,YAAY,GAAGA,CAAA,KACnBC,OAAO,CAAC,4BAA4B,CAAC,CAACC,OAAe;;AAEvD;AACA;AACA,MAAMC,aAAa,GAAGA,CAAC;EACrBC,OAAO;EACP;EACA;EACAC,MAAM,EAAEC,OAAO;EACf,GAAGC;AACwB,CAAC,KAAkB;EAC9C,MAAMC,MAAgB,GAAG,EAAE;EAC3B,MAAMC,WAAqB,GAAG,EAAE;EAChC,MAAMC,QAAkB,GAAG,EAAE;EAC7B,IAAIC,iBAAqC;EAEzCP,OAAO,CAACQ,OAAO,CAAC,CAACC,MAAM,EAAEC,KAAK,KAAK;IACjCN,MAAM,CAACO,IAAI,CAACF,MAAM,CAACG,KAAK,CAAC;IAEzB,IAAIH,MAAM,CAACI,KAAK,KAAK,aAAa,EAAER,WAAW,CAACM,IAAI,CAACD,KAAK,CAAC;IAC3D,IAAID,MAAM,CAACI,KAAK,KAAK,QAAQ,IAAIN,iBAAiB,IAAI,IAAI,EAAE;MAC1DA,iBAAiB,GAAGG,KAAK;IAC3B;IACA,IAAID,MAAM,CAACH,QAAQ,EAAEA,QAAQ,CAACK,IAAI,CAACD,KAAK,CAAC;EAC3C,CAAC,CAAC;EAEF,OAAO;IACL,GAAGP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QAAO;MAAE,CAAC,GAAGT,IAChE,CAAC;IACH,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC;AAED,OAAO,MAAMN,0BAA0B,GACrClB,OAAoC,IACJ;EAChC,MAAMwB,IAAI,GAAGzB,aAAa,CAACC,OAAO,CAAC;;EAEnC;EACA,MAAMoC,KAAK,GAAIhB,WAA+B,IAAK;IACjD,IAAIA,WAAW,IAAI,IAAI,EAAEpB,OAAO,CAACA,OAAO,CAACoB,WAAW,CAAC,EAAEiB,OAAO,GAAG,CAAC;IAElE,OAAOjB,WAAW;EACpB,CAAC;EAED,IAAI1B,QAAQ,CAAC4C,EAAE,KAAK,KAAK,IAAI5C,QAAQ,CAAC4C,EAAE,KAAK,SAAS,EAAE;IACtD,OAAOX,OAAO,CAACC,OAAO,CAACP,SAAS,CAAC;EACnC;EAEA,OAAOE,cAAc,CAACC,IAAI,EAAExB,OAAO,CAACC,MAAM,CAAC,CACxCkB,IAAI,CAACF,oBAAoB,CAAC,CAC1BE,IAAI,CAACiB,KAAK,CAAC;AAChB,CAAC;AAED,OAAO,MAAMG,kBAAkB,GAAGA,CAAA,KAAY;EAC5C,IAAI7C,QAAQ,CAAC4C,EAAE,KAAK,KAAK,IAAI5C,QAAQ,CAAC4C,EAAE,KAAK,SAAS,EAAE;IACtD1C,YAAY,CAAC,CAAC,CAAC2C,kBAAkB,CAAC,CAAC;EACrC;AACF,CAAC;;AAED;AACA;AACA,OAAO,MAAMC,sBAAsB,GAAGA,CAAA,KAAY;EAChD,IAAI9C,QAAQ,CAAC4C,EAAE,KAAK,KAAK,IAAI5C,QAAQ,CAAC4C,EAAE,KAAK,SAAS,EAAE;IACtD1C,YAAY,CAAC,CAAC,CAAC4C,sBAAsB,CAAC,CAAC;EACzC;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Platform","DISMISSED_BY_API","nativeModule","require","default","toWireOptions","options","anchor","_anchor","rest","toWireButtons","buttons","labels","destructive","disabled","cancelButtonIndex","forEach","button","index","push","label","style","length","destructiveButtonIndices","disabledButtonIndices","showWithNativeModule","showActionSheetWithOptions","then","buttonIndex","undefined","catch","warnedMaterialDisabled","warnIfBottomUnavailable","presentationStyle","__DEV__","OS","getConstants","isMaterialEnabled","console","warn","withAnchorRect","wire","target","current","Promise","resolve","measureInWindow","x","y","width","height","measured","anchorRect","press","onPress","dismissActionSheet","dismissAllActionSheets","showPromptWithOptions","result","text"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AAgCvC,MAAMC,gBAAgB,GAAG,CAAC,CAAC;;AAE3B;AACA;;AASA,MAAMC,YAAY,GAAGA,CAAA,KACnBC,OAAO,CAAC,4BAA4B,CAAC,CAACC,OAAe;;AAEvD;AACA;AACA,MAAMC,aAAa,GAAGA,CAAC;EACrBC,OAAO;EACP;EACA;EACAC,MAAM,EAAEC,OAAO;EACf,GAAGC;AACwB,CAAC,MAAmB;EAC/C,GAAGA,IAAI;EACP,GAAGC,aAAa,CAACJ,OAAO;AAC1B,CAAC,CAAC;AASF;AACA;AACA,MAAMI,aAAa,GAAIC,OAA2C,IAAK;EACrE,MAAMC,MAAgB,GAAG,EAAE;EAC3B,MAAMC,WAAqB,GAAG,EAAE;EAChC,MAAMC,QAAkB,GAAG,EAAE;EAC7B,IAAIC,iBAAqC;EAEzCJ,OAAO,CAACK,OAAO,CAAC,CAACC,MAAM,EAAEC,KAAK,KAAK;IACjCN,MAAM,CAACO,IAAI,CAACF,MAAM,CAACG,KAAK,CAAC;IAEzB,IAAIH,MAAM,CAACI,KAAK,KAAK,aAAa,EAAER,WAAW,CAACM,IAAI,CAACD,KAAK,CAAC;IAC3D,IAAID,MAAM,CAACI,KAAK,KAAK,QAAQ,IAAIN,iBAAiB,IAAI,IAAI,EAAE;MAC1DA,iBAAiB,GAAGG,KAAK;IAC3B;IACA,IAAID,MAAM,CAACH,QAAQ,EAAEA,QAAQ,CAACK,IAAI,CAACD,KAAK,CAAC;EAC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C,MAAM,CAAC9B,WAAW,CAAC,EAAE0B,OAAO,GAAGI,MAAM,CAACC,IAAI,CAAC;IAE/D,OAAOD,MAAM;EACf,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export {};
4
+ //# sourceMappingURL=prompt-options.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../src","sources":["prompt-options.interface.ts"],"mappings":"","ignoreList":[]}
@@ -1,5 +1,8 @@
1
1
  import { type TurboModule } from 'react-native';
2
2
  export interface Spec extends TurboModule {
3
+ getConstants(): {
4
+ isMaterialEnabled: boolean;
5
+ };
3
6
  showActionSheetWithOptions(options: {
4
7
  options: string[];
5
8
  cancelButtonIndex?: number;
@@ -21,6 +24,26 @@ export interface Spec extends TurboModule {
21
24
  height: number;
22
25
  };
23
26
  }): Promise<number>;
27
+ showPromptWithOptions(options: {
28
+ options: string[];
29
+ cancelButtonIndex?: number;
30
+ destructiveButtonIndices?: number[];
31
+ disabledButtonIndices?: number[];
32
+ title?: string;
33
+ message?: string;
34
+ placeholder?: string;
35
+ defaultValue?: string;
36
+ keyboardType?: string;
37
+ secureTextEntry?: boolean;
38
+ tintColor?: string;
39
+ cancelButtonTintColor?: string;
40
+ destructiveColor?: string;
41
+ buttonTextAlignment?: string;
42
+ userInterfaceStyle?: string;
43
+ }): Promise<{
44
+ buttonIndex: number;
45
+ text: string;
46
+ }>;
24
47
  dismissActionSheet(): void;
25
48
  dismissAllActionSheets(): void;
26
49
  }
@@ -1 +1 @@
1
- {"version":3,"file":"NativeUnifiedActionSheet.d.ts","sourceRoot":"","sources":["../../../../src/NativeUnifiedActionSheet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAErE,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,0BAA0B,CAAC,OAAO,EAAE;QAClC,OAAO,EAAE,MAAM,EAAE,CAAC;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AAI,IAAI,CAAC;IAC3B,sBAAsB,IAAI,IAAI,CAAC;CAChC;;AAED,wBAA4E"}
@@ -1,27 +1,18 @@
1
- export interface ActionSheetButtonInterface {
2
- label: string;
3
- style?: 'cancel' | 'destructive';
4
- disabled?: boolean;
1
+ import type { BaseAndroidOptionsInterface, BaseButtonInterface, BaseOptionsInterface } from './common-options.interface';
2
+ export interface ActionSheetButtonInterface extends BaseButtonInterface {
5
3
  onPress?: () => void;
6
4
  }
7
5
  export interface ActionSheetAnchorInterface {
8
6
  measureInWindow: (callback: (x: number, y: number, width: number, height: number) => void) => void;
9
7
  }
10
- export interface ActionSheetCommonOptionsInterface {
8
+ export interface ActionSheetCommonOptionsInterface extends BaseOptionsInterface {
11
9
  options: ActionSheetButtonInterface[];
12
- title?: string;
13
- message?: string;
14
- tintColor?: string;
15
- cancelButtonTintColor?: string;
16
- userInterfaceStyle?: 'light' | 'dark';
17
10
  anchor?: ActionSheetAnchorInterface | {
18
11
  current: ActionSheetAnchorInterface | null;
19
12
  } | null;
20
- destructiveColor?: string;
21
- presentationStyle?: 'centered' | 'anchored';
13
+ presentationStyle?: 'centered' | 'anchored' | 'bottom';
22
14
  }
23
- export interface ActionSheetAndroidOptionsInterface {
24
- buttonTextAlignment?: 'start' | 'center';
15
+ export interface ActionSheetAndroidOptionsInterface extends BaseAndroidOptionsInterface {
25
16
  anchorAlignment?: 'start' | 'center';
26
17
  }
27
18
  export interface ActionSheetOptionsInterface extends ActionSheetCommonOptionsInterface, ActionSheetAndroidOptionsInterface {
@@ -1 +1 @@
1
- {"version":3,"file":"action-sheet-options.interface.d.ts","sourceRoot":"","sources":["../../../../src/action-sheet-options.interface.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,QAAQ,GAAG,aAAa,CAAC;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAGnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAID,MAAM,WAAW,0BAA0B;IACzC,eAAe,EAAE,CACf,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,KACpE,IAAI,CAAC;CACX;AAED,MAAM,WAAW,iCAAiC;IAChD,OAAO,EAAE,0BAA0B,EAAE,CAAC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,kBAAkB,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACtC,MAAM,CAAC,EACH,0BAA0B,GAC1B;QAAE,OAAO,EAAE,0BAA0B,GAAG,IAAI,CAAA;KAAE,GAC9C,IAAI,CAAC;IACT,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;CAC7C;AAED,MAAM,WAAW,kCAAkC;IACjD,mBAAmB,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IACzC,eAAe,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CACtC;AAED,MAAM,WAAW,2BACf,SACE,iCAAiC,EACjC,kCAAkC;CAAG"}
1
+ {"version":3,"file":"action-sheet-options.interface.d.ts","sourceRoot":"","sources":["../../../../src/action-sheet-options.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,2BAA2B,EAC3B,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,WAAW,0BAA2B,SAAQ,mBAAmB;IACrE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,0BAA0B;IACzC,eAAe,EAAE,CACf,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,KACpE,IAAI,CAAC;CACX;AAED,MAAM,WAAW,iCAAkC,SAAQ,oBAAoB;IAC7E,OAAO,EAAE,0BAA0B,EAAE,CAAC;IACtC,MAAM,CAAC,EACH,0BAA0B,GAC1B;QAAE,OAAO,EAAE,0BAA0B,GAAG,IAAI,CAAA;KAAE,GAC9C,IAAI,CAAC;IACT,iBAAiB,CAAC,EAAE,UAAU,GAAG,UAAU,GAAG,QAAQ,CAAC;CACxD;AAED,MAAM,WAAW,kCAAmC,SAAQ,2BAA2B;IACrF,eAAe,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CACtC;AAED,MAAM,WAAW,2BACf,SACE,iCAAiC,EACjC,kCAAkC;CAAG"}
@@ -0,0 +1,17 @@
1
+ export interface BaseButtonInterface {
2
+ label: string;
3
+ style?: 'cancel' | 'destructive';
4
+ disabled?: boolean;
5
+ }
6
+ export interface BaseOptionsInterface {
7
+ title?: string;
8
+ message?: string;
9
+ tintColor?: string;
10
+ cancelButtonTintColor?: string;
11
+ destructiveColor?: string;
12
+ userInterfaceStyle?: 'light' | 'dark';
13
+ }
14
+ export interface BaseAndroidOptionsInterface {
15
+ buttonTextAlignment?: 'start' | 'center';
16
+ }
17
+ //# sourceMappingURL=common-options.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common-options.interface.d.ts","sourceRoot":"","sources":["../../../../src/common-options.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,QAAQ,GAAG,aAAa,CAAC;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kBAAkB,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CACvC;AAED,MAAM,WAAW,2BAA2B;IAC1C,mBAAmB,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CAC1C"}
@@ -1,6 +1,10 @@
1
1
  import type { ActionSheetOptionsInterface } from './action-sheet-options.interface';
2
+ export type { BaseButtonInterface, BaseOptionsInterface, BaseAndroidOptionsInterface, } from './common-options.interface';
3
+ export type { PromptButtonInterface, PromptCommonOptionsInterface, PromptAndroidOptionsInterface, PromptOptionsInterface, PromptResultInterface, } from './prompt-options.interface';
4
+ import type { PromptOptionsInterface, PromptResultInterface } from './prompt-options.interface';
2
5
  export type { ActionSheetAnchorInterface, ActionSheetButtonInterface, ActionSheetCommonOptionsInterface, ActionSheetAndroidOptionsInterface, ActionSheetOptionsInterface, } from './action-sheet-options.interface';
3
6
  export declare const showActionSheetWithOptions: (options: ActionSheetOptionsInterface) => Promise<number | undefined>;
4
7
  export declare const dismissActionSheet: () => void;
5
8
  export declare const dismissAllActionSheets: () => void;
9
+ export declare const showPromptWithOptions: (options: PromptOptionsInterface) => Promise<PromptResultInterface | undefined>;
6
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAEpF,YAAY,EACV,0BAA0B,EAC1B,0BAA0B,EAC1B,iCAAiC,EACjC,kCAAkC,EAClC,2BAA2B,GAC5B,MAAM,kCAAkC,CAAC;AAsF1C,eAAO,MAAM,0BAA0B,GACrC,SAAS,2BAA2B,KACnC,OAAO,CAAC,MAAM,GAAG,SAAS,CAiB5B,CAAC;AAEF,eAAO,MAAM,kBAAkB,QAAO,IAIrC,CAAC;AAIF,eAAO,MAAM,sBAAsB,QAAO,IAIzC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAEpF,YAAY,EACV,mBAAmB,EACnB,oBAAoB,EACpB,2BAA2B,GAC5B,MAAM,4BAA4B,CAAC;AAEpC,YAAY,EACV,qBAAqB,EACrB,4BAA4B,EAC5B,6BAA6B,EAC7B,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EACV,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,4BAA4B,CAAC;AAEpC,YAAY,EACV,0BAA0B,EAC1B,0BAA0B,EAC1B,iCAAiC,EACjC,kCAAkC,EAClC,2BAA2B,GAC5B,MAAM,kCAAkC,CAAC;AA8H1C,eAAO,MAAM,0BAA0B,GACrC,SAAS,2BAA2B,KACnC,OAAO,CAAC,MAAM,GAAG,SAAS,CAsB5B,CAAC;AAEF,eAAO,MAAM,kBAAkB,QAAO,IAIrC,CAAC;AAIF,eAAO,MAAM,sBAAsB,QAAO,IAIzC,CAAC;AAMF,eAAO,MAAM,qBAAqB,GAChC,SAAS,sBAAsB,KAC9B,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAsB3C,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { BaseAndroidOptionsInterface, BaseButtonInterface, BaseOptionsInterface } from './common-options.interface';
2
+ export interface PromptButtonInterface extends BaseButtonInterface {
3
+ onPress?: (text: string) => void;
4
+ }
5
+ export interface PromptCommonOptionsInterface extends BaseOptionsInterface {
6
+ options: PromptButtonInterface[];
7
+ placeholder?: string;
8
+ defaultValue?: string;
9
+ keyboardType?: 'default' | 'email-address' | 'numeric' | 'phone-pad' | 'url';
10
+ secureTextEntry?: boolean;
11
+ }
12
+ export type PromptAndroidOptionsInterface = BaseAndroidOptionsInterface;
13
+ export interface PromptOptionsInterface extends PromptCommonOptionsInterface, PromptAndroidOptionsInterface {
14
+ }
15
+ export interface PromptResultInterface {
16
+ buttonIndex: number;
17
+ text: string;
18
+ }
19
+ //# sourceMappingURL=prompt-options.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt-options.interface.d.ts","sourceRoot":"","sources":["../../../../src/prompt-options.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,2BAA2B,EAC3B,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,WAAW,qBAAsB,SAAQ,mBAAmB;IAChE,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC;AAED,MAAM,WAAW,4BAA6B,SAAQ,oBAAoB;IACxE,OAAO,EAAE,qBAAqB,EAAE,CAAC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,SAAS,GAAG,eAAe,GAAG,SAAS,GAAG,WAAW,GAAG,KAAK,CAAC;IAC7E,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,MAAM,6BAA6B,GAAG,2BAA2B,CAAC;AAExE,MAAM,WAAW,sBACf,SAAQ,4BAA4B,EAAE,6BAA6B;CAAG;AAExE,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd"}
@@ -1,5 +1,8 @@
1
1
  import { type TurboModule } from 'react-native';
2
2
  export interface Spec extends TurboModule {
3
+ getConstants(): {
4
+ isMaterialEnabled: boolean;
5
+ };
3
6
  showActionSheetWithOptions(options: {
4
7
  options: string[];
5
8
  cancelButtonIndex?: number;
@@ -21,6 +24,26 @@ export interface Spec extends TurboModule {
21
24
  height: number;
22
25
  };
23
26
  }): Promise<number>;
27
+ showPromptWithOptions(options: {
28
+ options: string[];
29
+ cancelButtonIndex?: number;
30
+ destructiveButtonIndices?: number[];
31
+ disabledButtonIndices?: number[];
32
+ title?: string;
33
+ message?: string;
34
+ placeholder?: string;
35
+ defaultValue?: string;
36
+ keyboardType?: string;
37
+ secureTextEntry?: boolean;
38
+ tintColor?: string;
39
+ cancelButtonTintColor?: string;
40
+ destructiveColor?: string;
41
+ buttonTextAlignment?: string;
42
+ userInterfaceStyle?: string;
43
+ }): Promise<{
44
+ buttonIndex: number;
45
+ text: string;
46
+ }>;
24
47
  dismissActionSheet(): void;
25
48
  dismissAllActionSheets(): void;
26
49
  }
@@ -1 +1 @@
1
- {"version":3,"file":"NativeUnifiedActionSheet.d.ts","sourceRoot":"","sources":["../../../../src/NativeUnifiedActionSheet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAErE,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,0BAA0B,CAAC,OAAO,EAAE;QAClC,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC;QACpC,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,qBAAqB,CAAC,EAAE,MAAM,CAAC;QAC/B,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,mBAAmB,CAAC,EAAE,MAAM,CAAC;QAC7B,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;QACjC,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,UAAU,CAAC,EAAE;YACX,CAAC,EAAE,MAAM,CAAC;YACV,CAAC,EAAE,MAAM,CAAC;YACV,KAAK,EAAE,MAAM,CAAC;YACd,MAAM,EAAE,MAAM,CAAC;SAChB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C3B,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC;QACpC,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;QACjC,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,eAAe,CAAC,EAAE,OAAO,CAAC;QAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,qBAAqB,CAAC,EAAE,MAAM,CAAC;QAC/B,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,mBAAmB,CAAC,EAAE,MAAM,CAAC;QAC7B,kBAAkB,CAAC,EAAE,MAAM,CAAC;KAC7B,GAAG,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACnD,kBAAkB,IAAI,IAAI,CAAC;IAC3B,sBAAsB,IAAI,IAAI,CAAC;CAChC;;AAED,wBAA4E"}
@@ -1,27 +1,18 @@
1
- export interface ActionSheetButtonInterface {
2
- label: string;
3
- style?: 'cancel' | 'destructive';
4
- disabled?: boolean;
1
+ import type { BaseAndroidOptionsInterface, BaseButtonInterface, BaseOptionsInterface } from './common-options.interface.js';
2
+ export interface ActionSheetButtonInterface extends BaseButtonInterface {
5
3
  onPress?: () => void;
6
4
  }
7
5
  export interface ActionSheetAnchorInterface {
8
6
  measureInWindow: (callback: (x: number, y: number, width: number, height: number) => void) => void;
9
7
  }
10
- export interface ActionSheetCommonOptionsInterface {
8
+ export interface ActionSheetCommonOptionsInterface extends BaseOptionsInterface {
11
9
  options: ActionSheetButtonInterface[];
12
- title?: string;
13
- message?: string;
14
- tintColor?: string;
15
- cancelButtonTintColor?: string;
16
- userInterfaceStyle?: 'light' | 'dark';
17
10
  anchor?: ActionSheetAnchorInterface | {
18
11
  current: ActionSheetAnchorInterface | null;
19
12
  } | null;
20
- destructiveColor?: string;
21
- presentationStyle?: 'centered' | 'anchored';
13
+ presentationStyle?: 'centered' | 'anchored' | 'bottom';
22
14
  }
23
- export interface ActionSheetAndroidOptionsInterface {
24
- buttonTextAlignment?: 'start' | 'center';
15
+ export interface ActionSheetAndroidOptionsInterface extends BaseAndroidOptionsInterface {
25
16
  anchorAlignment?: 'start' | 'center';
26
17
  }
27
18
  export interface ActionSheetOptionsInterface extends ActionSheetCommonOptionsInterface, ActionSheetAndroidOptionsInterface {
@@ -1 +1 @@
1
- {"version":3,"file":"action-sheet-options.interface.d.ts","sourceRoot":"","sources":["../../../../src/action-sheet-options.interface.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,QAAQ,GAAG,aAAa,CAAC;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAGnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAID,MAAM,WAAW,0BAA0B;IACzC,eAAe,EAAE,CACf,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,KACpE,IAAI,CAAC;CACX;AAED,MAAM,WAAW,iCAAiC;IAChD,OAAO,EAAE,0BAA0B,EAAE,CAAC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,kBAAkB,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACtC,MAAM,CAAC,EACH,0BAA0B,GAC1B;QAAE,OAAO,EAAE,0BAA0B,GAAG,IAAI,CAAA;KAAE,GAC9C,IAAI,CAAC;IACT,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;CAC7C;AAED,MAAM,WAAW,kCAAkC;IACjD,mBAAmB,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IACzC,eAAe,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CACtC;AAED,MAAM,WAAW,2BACf,SACE,iCAAiC,EACjC,kCAAkC;CAAG"}
1
+ {"version":3,"file":"action-sheet-options.interface.d.ts","sourceRoot":"","sources":["../../../../src/action-sheet-options.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,2BAA2B,EAC3B,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,+BAA4B,CAAC;AAEpC,MAAM,WAAW,0BAA2B,SAAQ,mBAAmB;IACrE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,0BAA0B;IACzC,eAAe,EAAE,CACf,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,KACpE,IAAI,CAAC;CACX;AAED,MAAM,WAAW,iCAAkC,SAAQ,oBAAoB;IAC7E,OAAO,EAAE,0BAA0B,EAAE,CAAC;IACtC,MAAM,CAAC,EACH,0BAA0B,GAC1B;QAAE,OAAO,EAAE,0BAA0B,GAAG,IAAI,CAAA;KAAE,GAC9C,IAAI,CAAC;IACT,iBAAiB,CAAC,EAAE,UAAU,GAAG,UAAU,GAAG,QAAQ,CAAC;CACxD;AAED,MAAM,WAAW,kCAAmC,SAAQ,2BAA2B;IACrF,eAAe,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CACtC;AAED,MAAM,WAAW,2BACf,SACE,iCAAiC,EACjC,kCAAkC;CAAG"}
@@ -0,0 +1,17 @@
1
+ export interface BaseButtonInterface {
2
+ label: string;
3
+ style?: 'cancel' | 'destructive';
4
+ disabled?: boolean;
5
+ }
6
+ export interface BaseOptionsInterface {
7
+ title?: string;
8
+ message?: string;
9
+ tintColor?: string;
10
+ cancelButtonTintColor?: string;
11
+ destructiveColor?: string;
12
+ userInterfaceStyle?: 'light' | 'dark';
13
+ }
14
+ export interface BaseAndroidOptionsInterface {
15
+ buttonTextAlignment?: 'start' | 'center';
16
+ }
17
+ //# sourceMappingURL=common-options.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common-options.interface.d.ts","sourceRoot":"","sources":["../../../../src/common-options.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,QAAQ,GAAG,aAAa,CAAC;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kBAAkB,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CACvC;AAED,MAAM,WAAW,2BAA2B;IAC1C,mBAAmB,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CAC1C"}
@@ -1,6 +1,10 @@
1
1
  import type { ActionSheetOptionsInterface } from './action-sheet-options.interface.js';
2
+ export type { BaseButtonInterface, BaseOptionsInterface, BaseAndroidOptionsInterface, } from './common-options.interface.js';
3
+ export type { PromptButtonInterface, PromptCommonOptionsInterface, PromptAndroidOptionsInterface, PromptOptionsInterface, PromptResultInterface, } from './prompt-options.interface.js';
4
+ import type { PromptOptionsInterface, PromptResultInterface } from './prompt-options.interface.js';
2
5
  export type { ActionSheetAnchorInterface, ActionSheetButtonInterface, ActionSheetCommonOptionsInterface, ActionSheetAndroidOptionsInterface, ActionSheetOptionsInterface, } from './action-sheet-options.interface.js';
3
6
  export declare const showActionSheetWithOptions: (options: ActionSheetOptionsInterface) => Promise<number | undefined>;
4
7
  export declare const dismissActionSheet: () => void;
5
8
  export declare const dismissAllActionSheets: () => void;
9
+ export declare const showPromptWithOptions: (options: PromptOptionsInterface) => Promise<PromptResultInterface | undefined>;
6
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,qCAAkC,CAAC;AAEpF,YAAY,EACV,0BAA0B,EAC1B,0BAA0B,EAC1B,iCAAiC,EACjC,kCAAkC,EAClC,2BAA2B,GAC5B,MAAM,qCAAkC,CAAC;AAsF1C,eAAO,MAAM,0BAA0B,GACrC,SAAS,2BAA2B,KACnC,OAAO,CAAC,MAAM,GAAG,SAAS,CAiB5B,CAAC;AAEF,eAAO,MAAM,kBAAkB,QAAO,IAIrC,CAAC;AAIF,eAAO,MAAM,sBAAsB,QAAO,IAIzC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,qCAAkC,CAAC;AAEpF,YAAY,EACV,mBAAmB,EACnB,oBAAoB,EACpB,2BAA2B,GAC5B,MAAM,+BAA4B,CAAC;AAEpC,YAAY,EACV,qBAAqB,EACrB,4BAA4B,EAC5B,6BAA6B,EAC7B,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,+BAA4B,CAAC;AAEpC,OAAO,KAAK,EACV,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,+BAA4B,CAAC;AAEpC,YAAY,EACV,0BAA0B,EAC1B,0BAA0B,EAC1B,iCAAiC,EACjC,kCAAkC,EAClC,2BAA2B,GAC5B,MAAM,qCAAkC,CAAC;AA8H1C,eAAO,MAAM,0BAA0B,GACrC,SAAS,2BAA2B,KACnC,OAAO,CAAC,MAAM,GAAG,SAAS,CAsB5B,CAAC;AAEF,eAAO,MAAM,kBAAkB,QAAO,IAIrC,CAAC;AAIF,eAAO,MAAM,sBAAsB,QAAO,IAIzC,CAAC;AAMF,eAAO,MAAM,qBAAqB,GAChC,SAAS,sBAAsB,KAC9B,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAsB3C,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { BaseAndroidOptionsInterface, BaseButtonInterface, BaseOptionsInterface } from './common-options.interface.js';
2
+ export interface PromptButtonInterface extends BaseButtonInterface {
3
+ onPress?: (text: string) => void;
4
+ }
5
+ export interface PromptCommonOptionsInterface extends BaseOptionsInterface {
6
+ options: PromptButtonInterface[];
7
+ placeholder?: string;
8
+ defaultValue?: string;
9
+ keyboardType?: 'default' | 'email-address' | 'numeric' | 'phone-pad' | 'url';
10
+ secureTextEntry?: boolean;
11
+ }
12
+ export type PromptAndroidOptionsInterface = BaseAndroidOptionsInterface;
13
+ export interface PromptOptionsInterface extends PromptCommonOptionsInterface, PromptAndroidOptionsInterface {
14
+ }
15
+ export interface PromptResultInterface {
16
+ buttonIndex: number;
17
+ text: string;
18
+ }
19
+ //# sourceMappingURL=prompt-options.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt-options.interface.d.ts","sourceRoot":"","sources":["../../../../src/prompt-options.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,2BAA2B,EAC3B,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,+BAA4B,CAAC;AAEpC,MAAM,WAAW,qBAAsB,SAAQ,mBAAmB;IAChE,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC;AAED,MAAM,WAAW,4BAA6B,SAAQ,oBAAoB;IACxE,OAAO,EAAE,qBAAqB,EAAE,CAAC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,SAAS,GAAG,eAAe,GAAG,SAAS,GAAG,WAAW,GAAG,KAAK,CAAC;IAC7E,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,MAAM,6BAA6B,GAAG,2BAA2B,CAAC;AAExE,MAAM,WAAW,sBACf,SAAQ,4BAA4B,EAAE,6BAA6B;CAAG;AAExE,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-unified-action-sheet",
3
- "version": "0.1.1",
4
- "description": "Unified action sheet for React Native: a native UIAlertController on iOS, a native AppCompatDialog on Android",
3
+ "version": "0.3.0",
4
+ "description": "Unified native action sheet for React Native, one API on iOS and Android",
5
5
  "main": "./lib/commonjs/index.js",
6
6
  "sideEffects": false,
7
7
  "types": "./lib/typescript/commonjs/src/index.d.ts",
@@ -18,6 +18,7 @@
18
18
  }
19
19
  },
20
20
  "./package.json": "./package.json",
21
+ "./app.plugin.js": "./app.plugin.js",
21
22
  "./jest": {
22
23
  "types": "./jest/index.d.ts",
23
24
  "default": "./jest/index.js"
@@ -27,6 +28,8 @@
27
28
  "src",
28
29
  "lib",
29
30
  "jest",
31
+ "plugin",
32
+ "app.plugin.js",
30
33
  "android",
31
34
  "ios",
32
35
  "*.podspec",
@@ -56,6 +59,7 @@
56
59
  "action-sheet",
57
60
  "actionsheet",
58
61
  "action-sheet-ios",
62
+ "bottom-sheet",
59
63
  "turbomodule"
60
64
  ],
61
65
  "repository": {
@@ -97,9 +101,15 @@
97
101
  "typescript": "^6.0.3"
98
102
  },
99
103
  "peerDependencies": {
104
+ "@expo/config-plugins": "*",
100
105
  "react": "*",
101
106
  "react-native": ">=0.81.0"
102
107
  },
108
+ "peerDependenciesMeta": {
109
+ "@expo/config-plugins": {
110
+ "optional": true
111
+ }
112
+ },
103
113
  "workspaces": [
104
114
  "example"
105
115
  ],
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Expo config plugin. Writes the gradle properties that opt the Android build
3
+ * into Material, which presentationStyle 'bottom' needs:
4
+ *
5
+ * plugins: [['react-native-unified-action-sheet', { material: true }]]
6
+ *
7
+ * Options:
8
+ * material enable the Material bottom sheet (default false)
9
+ * materialVersion override the Material version the library pins
10
+ */
11
+ const MATERIAL_KEY = 'unifiedActionSheet.material';
12
+ const MATERIAL_VERSION_KEY = 'unifiedActionSheet.materialVersion';
13
+
14
+ /// Pure, so it can be tested without Expo. Drops any previous value of both
15
+ /// keys before adding the current ones: prebuild runs repeatedly, and turning
16
+ /// the option off must remove what an earlier run wrote.
17
+ const applyMaterialProperties = (properties, options = {}) => {
18
+ const next = properties.filter(
19
+ (item) =>
20
+ !(
21
+ item.type === 'property' &&
22
+ (item.key === MATERIAL_KEY || item.key === MATERIAL_VERSION_KEY)
23
+ )
24
+ );
25
+
26
+ if (options.material) {
27
+ next.push({ type: 'property', key: MATERIAL_KEY, value: 'true' });
28
+
29
+ if (options.materialVersion) {
30
+ next.push({
31
+ type: 'property',
32
+ key: MATERIAL_VERSION_KEY,
33
+ value: String(options.materialVersion),
34
+ });
35
+ }
36
+ }
37
+
38
+ return next;
39
+ };
40
+
41
+ const withUnifiedActionSheet = (config, options = {}) => {
42
+ // Required here rather than at the top: @expo/config-plugins is an optional
43
+ // peer, present in every Expo project and absent from bare ones, which never
44
+ // load this file.
45
+ const { withGradleProperties } = require('@expo/config-plugins');
46
+
47
+ return withGradleProperties(config, (modConfig) => {
48
+ modConfig.modResults = applyMaterialProperties(
49
+ modConfig.modResults,
50
+ options
51
+ );
52
+
53
+ return modConfig;
54
+ });
55
+ };
56
+
57
+ module.exports = withUnifiedActionSheet;
58
+ module.exports.applyMaterialProperties = applyMaterialProperties;
@@ -1,6 +1,11 @@
1
1
  import { TurboModuleRegistry, type TurboModule } from 'react-native';
2
2
 
3
3
  export interface Spec extends TurboModule {
4
+ getConstants(): {
5
+ /// Android: whether the app opted into Material (presentationStyle
6
+ /// 'bottom'). Always false on iOS, which needs no opt-in.
7
+ isMaterialEnabled: boolean;
8
+ };
4
9
  showActionSheetWithOptions(options: {
5
10
  options: string[];
6
11
  cancelButtonIndex?: number;
@@ -22,6 +27,23 @@ export interface Spec extends TurboModule {
22
27
  height: number;
23
28
  };
24
29
  }): Promise<number>;
30
+ showPromptWithOptions(options: {
31
+ options: string[];
32
+ cancelButtonIndex?: number;
33
+ destructiveButtonIndices?: number[];
34
+ disabledButtonIndices?: number[];
35
+ title?: string;
36
+ message?: string;
37
+ placeholder?: string;
38
+ defaultValue?: string;
39
+ keyboardType?: string;
40
+ secureTextEntry?: boolean;
41
+ tintColor?: string;
42
+ cancelButtonTintColor?: string;
43
+ destructiveColor?: string;
44
+ buttonTextAlignment?: string;
45
+ userInterfaceStyle?: string;
46
+ }): Promise<{ buttonIndex: number; text: string }>;
25
47
  dismissActionSheet(): void;
26
48
  dismissAllActionSheets(): void;
27
49
  }
@@ -1,39 +1,29 @@
1
- /// One button. `style` mirrors React Native's own Alert API and the native
2
- /// button roles, which are mutually exclusive; `disabled` is independent of it.
3
- export interface ActionSheetButtonInterface {
4
- label: string;
5
- style?: 'cancel' | 'destructive';
6
- disabled?: boolean;
7
- /// Runs when this button resolves the sheet, so callers need not match on the
8
- /// index. A dismissal that resolves the cancel button counts as pressing it.
1
+ import type {
2
+ BaseAndroidOptionsInterface,
3
+ BaseButtonInterface,
4
+ BaseOptionsInterface,
5
+ } from './common-options.interface';
6
+
7
+ export interface ActionSheetButtonInterface extends BaseButtonInterface {
9
8
  onPress?: () => void;
10
9
  }
11
10
 
12
- /// Anything measurable — every React Native host component ref has this method,
13
- /// so a `useRef` on a View, Pressable or Touchable satisfies it.
14
11
  export interface ActionSheetAnchorInterface {
15
12
  measureInWindow: (
16
13
  callback: (x: number, y: number, width: number, height: number) => void
17
14
  ) => void;
18
15
  }
19
16
 
20
- export interface ActionSheetCommonOptionsInterface {
17
+ export interface ActionSheetCommonOptionsInterface extends BaseOptionsInterface {
21
18
  options: ActionSheetButtonInterface[];
22
- title?: string;
23
- message?: string;
24
- tintColor?: string;
25
- cancelButtonTintColor?: string;
26
- userInterfaceStyle?: 'light' | 'dark';
27
19
  anchor?:
28
20
  | ActionSheetAnchorInterface
29
21
  | { current: ActionSheetAnchorInterface | null }
30
22
  | null;
31
- destructiveColor?: string;
32
- presentationStyle?: 'centered' | 'anchored';
23
+ presentationStyle?: 'centered' | 'anchored' | 'bottom';
33
24
  }
34
25
 
35
- export interface ActionSheetAndroidOptionsInterface {
36
- buttonTextAlignment?: 'start' | 'center';
26
+ export interface ActionSheetAndroidOptionsInterface extends BaseAndroidOptionsInterface {
37
27
  anchorAlignment?: 'start' | 'center';
38
28
  }
39
29