Skip to content

Commit 45280c5

Browse files
authored
Merge pull request #470 from ammarahm-ed/develop
v10.0.1
2 parents a42c482 + b7e6c62 commit 45280c5

File tree

7 files changed

+37
-16
lines changed

7 files changed

+37
-16
lines changed

app/examples/input.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,18 @@ import { TextInput } from 'react-native-gesture-handler';
66
function Input() {
77

88
return (
9-
<ActionSheet gestureEnabled>
9+
<ActionSheet containerStyle={{
10+
borderWidth: 1,
11+
borderColor: 'red'
12+
}} gestureEnabled>
1013
<View
1114
style={{
1215
paddingHorizontal: 12,
1316
height: 200,
1417
alignItems: 'center',
1518
justifyContent: 'center',
1619
gap: 10,
20+
borderWidth: 1
1721
}}>
1822
<TextInput
1923
style={{

app/sheets.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ declare module 'react-native-actions-sheet' {
6161
'return-data': SheetDefinition<{
6262
returnValue: boolean;
6363
}>;
64-
'legend-list':SheetDefinition
65-
'custom-scroll-handlers': SheetDefinition
64+
'legend-list': SheetDefinition;
65+
'custom-scroll-handlers': SheetDefinition;
6666
}
6767
}
6868

@@ -86,8 +86,8 @@ export const Sheets = () => {
8686
'draw-under-statusbar': DrawUnderStatusBar,
8787
'return-data': ReturnData,
8888
'floating-sheet': FloatingSheet,
89-
'legend-list': LegendListExample,
90-
"custom-scroll-handlers": CustomScrollHandlers
89+
'legend-list': LegendListExample,
90+
'custom-scroll-handlers': CustomScrollHandlers,
9191
}}
9292
/>
9393
);

package-lock.json

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-actions-sheet",
3-
"version": "10.0.0",
3+
"version": "10.0.1",
44
"description": "A Cross Platform(Android & iOS) ActionSheet with a robust and flexible api, native performance and zero dependency code for react native. Create anything you want inside ActionSheet.",
55
"main": "./dist/index.js",
66
"types": "./dist/index.d.ts",

src/hooks/useKeyboard.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import React, {useEffect, useRef, useState} from 'react';
1+
import React, { useEffect, useRef, useState } from 'react';
22
import {
33
EmitterSubscription,
44
Keyboard,
55
KeyboardEventListener,
6-
Platform,
6+
Platform
77
} from 'react-native';
88

99
type ScreenRect = {
@@ -73,7 +73,10 @@ export function useKeyboard(enabled: boolean) {
7373
}, [enabled, handleKeyboardDidHide, handleKeyboardDidShow]);
7474
return {
7575
keyboardShown: !enabled ? false : shown,
76-
coordinates: !enabled || !shown ? emptyCoordinates : coordinates,
76+
coordinates: {
77+
start: !enabled || !shown ? emptyCoordinates : coordinates.start,
78+
end: !enabled || !shown ? emptyCoordinates : coordinates.end
79+
},
7780
keyboardHeight: !enabled || !shown ? 0 : keyboardHeight,
7881
pauseKeyboardHandler,
7982
reset: () => {

src/index.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,9 +1238,6 @@ export default forwardRef<ActionSheetRef, ActionSheetProps>(
12381238
{
12391239
borderTopRightRadius: 10,
12401240
borderTopLeftRadius: 10,
1241-
paddingBottom: useBottomSafeAreaPadding
1242-
? insets.bottom
1243-
: 0,
12441241
},
12451242
props.containerStyle,
12461243
{
@@ -1251,6 +1248,12 @@ export default forwardRef<ActionSheetRef, ActionSheetProps>(
12511248
: dimensions.height - insets.top,
12521249
// Using this to trigger layout when keyboard is shown
12531250
marginTop: keyboard.keyboardShown ? 0.5 : 0,
1251+
paddingBottom:
1252+
(Platform.OS === 'ios' &&
1253+
keyboard.keyboardShown) ||
1254+
!useBottomSafeAreaPadding
1255+
? 0
1256+
: insets.bottom,
12541257
},
12551258
]}>
12561259
{drawUnderStatusBar ? (

src/types.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export type ActionSheetRef<SheetId extends keyof Sheets = never> = {
7676
/**
7777
* Get the current payload of the sheet
7878
*/
79-
currentPayload: () => Sheets[SheetId]["payload"];
79+
currentPayload: () => Sheets[SheetId]['payload'];
8080
};
8181

8282
export type ActionSheetProps<SheetId extends keyof Sheets = never> = {
@@ -203,7 +203,17 @@ export type ActionSheetProps<SheetId extends keyof Sheets = never> = {
203203
CustomHeaderComponent?: React.ReactNode;
204204

205205
/**
206-
* Any custom styles for the container.
206+
* Styles for the ActionSheet container.
207+
*
208+
* Note: You can set most styles here except `maxHeight`, `marginBottom` and `paddingBottom`. These are used internally. You can do this instead:
209+
*
210+
* ```tsx
211+
* <ActionSheet>
212+
* <View style={{
213+
* paddingBottom: 50
214+
* }} />
215+
* </ActionSheet>
216+
* ```
207217
* */
208218
containerStyle?: StyleProp<ViewStyle>;
209219

0 commit comments

Comments
 (0)