react-native-unified-action-sheet 0.2.0 → 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.
- package/CHANGELOG.md +33 -1
- package/README.md +25 -113
- package/android/build.gradle +28 -1
- package/android/src/main/java/com/unifiedactionsheet/ActionSheetOptions.kt +6 -2
- package/android/src/main/java/com/unifiedactionsheet/UnifiedActionSheetModule.kt +6 -0
- package/android/src/material/java/com/unifiedactionsheet/BottomSheetPresenterFactory.kt +10 -0
- package/android/src/material/java/com/unifiedactionsheet/MaterialBottomSheetPresenter.kt +90 -0
- package/android/src/material/res/values/unified_action_sheet_bottom_sheet.xml +22 -0
- package/android/src/noMaterial/java/com/unifiedactionsheet/BottomSheetPresenterFactory.kt +10 -0
- package/app.plugin.js +1 -0
- package/ios/BottomSheetViewController.swift +208 -0
- package/ios/UnifiedActionSheet.mm +26 -1
- package/ios/UnifiedActionSheetImpl.swift +147 -7
- package/lib/commonjs/NativeUnifiedActionSheet.js.map +1 -1
- package/lib/commonjs/index.js +18 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/NativeUnifiedActionSheet.js.map +1 -1
- package/lib/module/index.js +18 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/commonjs/src/NativeUnifiedActionSheet.d.ts +3 -0
- package/lib/typescript/commonjs/src/NativeUnifiedActionSheet.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/action-sheet-options.interface.d.ts +1 -1
- package/lib/typescript/commonjs/src/action-sheet-options.interface.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/NativeUnifiedActionSheet.d.ts +3 -0
- package/lib/typescript/module/src/NativeUnifiedActionSheet.d.ts.map +1 -1
- package/lib/typescript/module/src/action-sheet-options.interface.d.ts +1 -1
- package/lib/typescript/module/src/action-sheet-options.interface.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/package.json +12 -2
- package/plugin/withUnifiedActionSheet.js +58 -0
- package/src/NativeUnifiedActionSheet.ts +5 -0
- package/src/action-sheet-options.interface.ts +1 -1
- package/src/index.tsx +35 -3
|
@@ -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,CAAC;KACH,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACpB,qBAAqB,CAAC,OAAO,EAAE;QAC7B,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC;QACpC,qBAAqB,CAA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sInterface extends BaseOptionsInterface
|
|
|
10
10
|
anchor?: ActionSheetAnchorInterface | {
|
|
11
11
|
current: ActionSheetAnchorInterface | null;
|
|
12
12
|
} | null;
|
|
13
|
-
presentationStyle?: 'centered' | 'anchored';
|
|
13
|
+
presentationStyle?: 'centered' | 'anchored' | 'bottom';
|
|
14
14
|
}
|
|
15
15
|
export interface ActionSheetAndroidOptionsInterface extends BaseAndroidOptionsInterface {
|
|
16
16
|
anchorAlignment?: 'start' | 'center';
|
|
@@ -1 +1 @@
|
|
|
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,CAAC;
|
|
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,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
|
+
{"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"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-unified-action-sheet",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Unified action sheet for React Native
|
|
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;
|
|
@@ -20,7 +20,7 @@ export interface ActionSheetCommonOptionsInterface extends BaseOptionsInterface
|
|
|
20
20
|
| ActionSheetAnchorInterface
|
|
21
21
|
| { current: ActionSheetAnchorInterface | null }
|
|
22
22
|
| null;
|
|
23
|
-
presentationStyle?: 'centered' | 'anchored';
|
|
23
|
+
presentationStyle?: 'centered' | 'anchored' | 'bottom';
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export interface ActionSheetAndroidOptionsInterface extends BaseAndroidOptionsInterface {
|
package/src/index.tsx
CHANGED
|
@@ -104,6 +104,33 @@ const showWithNativeModule = (
|
|
|
104
104
|
)
|
|
105
105
|
.catch(() => options.cancelButtonIndex ?? -1);
|
|
106
106
|
|
|
107
|
+
let warnedMaterialDisabled = false;
|
|
108
|
+
|
|
109
|
+
/// 'bottom' needs Material on Android, which the app opts into at build time.
|
|
110
|
+
/// Without it the sheet falls back to a centered dialog; say so once, in
|
|
111
|
+
/// development, since the fallback alone looks like the option was ignored.
|
|
112
|
+
const warnIfBottomUnavailable = (
|
|
113
|
+
presentationStyle: ActionSheetOptionsInterface['presentationStyle']
|
|
114
|
+
) => {
|
|
115
|
+
if (
|
|
116
|
+
!__DEV__ ||
|
|
117
|
+
warnedMaterialDisabled ||
|
|
118
|
+
Platform.OS !== 'android' ||
|
|
119
|
+
presentationStyle !== 'bottom' ||
|
|
120
|
+
nativeModule().getConstants().isMaterialEnabled
|
|
121
|
+
) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
warnedMaterialDisabled = true;
|
|
126
|
+
console.warn(
|
|
127
|
+
"react-native-unified-action-sheet: presentationStyle 'bottom' needs Material on Android, " +
|
|
128
|
+
'so this sheet falls back to a centered dialog. Set unifiedActionSheet.material=true in ' +
|
|
129
|
+
"android/gradle.properties, or add ['react-native-unified-action-sheet', { material: true }] " +
|
|
130
|
+
'to your Expo plugins, then rebuild the app.'
|
|
131
|
+
);
|
|
132
|
+
};
|
|
133
|
+
|
|
107
134
|
/// The anchor is measured in JS and sent across as a rect, so neither native
|
|
108
135
|
/// module has to resolve a view: a ref's own measureInWindow is the supported
|
|
109
136
|
/// way to do this on both architectures, unlike a react tag.
|
|
@@ -143,9 +170,14 @@ export const showActionSheetWithOptions = (
|
|
|
143
170
|
return Promise.resolve(undefined);
|
|
144
171
|
}
|
|
145
172
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
173
|
+
warnIfBottomUnavailable(options.presentationStyle);
|
|
174
|
+
|
|
175
|
+
// A bottom sheet has no anchor, so don't measure one: on iPad a rect would
|
|
176
|
+
// turn the sheet into an arrowed popover pointing at it.
|
|
177
|
+
const anchor =
|
|
178
|
+
options.presentationStyle === 'bottom' ? undefined : options.anchor;
|
|
179
|
+
|
|
180
|
+
return withAnchorRect(wire, anchor).then(showWithNativeModule).then(press);
|
|
149
181
|
};
|
|
150
182
|
|
|
151
183
|
export const dismissActionSheet = (): void => {
|