Skip to content

Commit 181de11

Browse files
authored
fix pipeline (#330)
1 parent 8e591fe commit 181de11

7 files changed

Lines changed: 254 additions & 216 deletions

File tree

.github/workflows/release.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,14 @@ jobs:
2727
- name: Install dependencies
2828
uses: ./.github/actions/setup
2929

30-
- name: Run example bare app
31-
run: yarn run example:bare
30+
- name: Install playground dependencies
31+
run: npm install
32+
working-directory: playground
33+
34+
- name: Build playground
35+
run: yarn run playground:build
36+
env:
37+
EXPO_NO_TELEMETRY: 1
3238

3339
- name: Build packages
3440
run: yarn run build

CONTRIBUTING.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Then you can lint and test after making your changes:
1616
# Lint and tests
1717
$ yarn lint
1818
$ yarn ts:check
19-
$ yarn example:bare ts:check
2019
$ yarn test
2120

2221
```

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,16 @@
99
"playground": "cd playground && yarn start",
1010
"playground:ios": "cd playground && yarn ios",
1111
"playground:android": "cd playground && yarn android",
12+
"playground:build:ios": "cd playground && npm run build:ios",
13+
"playground:build:android": "cd playground && npm run build:android",
14+
"playground:build": "cd playground && npm run build",
1215
"build:animations": "yarn workspace @react-native-ama/animations build",
1316
"build:core": "yarn workspace @react-native-ama/core build",
1417
"build:bottom-sheet": "yarn workspace @react-native-ama/bottom-sheet build",
1518
"build:forms": "yarn workspace @react-native-ama/forms build",
1619
"build:lists": "yarn workspace @react-native-ama/lists build",
1720
"build:website": "cd website && yarn build",
1821
"build": "yarn build:core && yarn build:animations && yarn build:forms && yarn build:lists && yarn build:bottom-sheet && yarn build:website",
19-
"pods": "cd examples/bare && pod-install --quiet",
2022
"doc": "cd website && yarn start",
2123
"ts:check": "tsc --noEmit",
2224
"lint": "eslint --ext .js,.jsx,.ts,.tsx --ignore-path .gitignore ./packages",
@@ -37,8 +39,7 @@
3739
"packages/bottom-sheet",
3840
"packages/forms",
3941
"packages/lists",
40-
"packages/react-native",
41-
"example"
42+
"packages/react-native"
4243
],
4344
"resolutions": {
4445
"@babel/core": "^7.26.0"

packages/bottom-sheet/src/components/BottomSheet.tsx

Lines changed: 52 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import * as React from 'react';
2-
import type { PropsWithChildren } from 'react';
1+
import * as React from "react";
2+
import type { PropsWithChildren } from "react";
33
import {
44
Dimensions,
55
KeyboardAvoidingView,
@@ -10,14 +10,15 @@ import {
1010
Pressable,
1111
ScrollViewProps,
1212
StyleSheet,
13+
useWindowDimensions,
1314
View,
1415
ViewStyle,
15-
} from 'react-native';
16+
} from "react-native";
1617
import {
1718
GestureDetector,
1819
GestureHandlerRootView,
1920
ScrollView,
20-
} from 'react-native-gesture-handler';
21+
} from "react-native-gesture-handler";
2122
import Animated, {
2223
runOnJS,
2324
SharedValue,
@@ -26,11 +27,11 @@ import Animated, {
2627
useReducedMotion,
2728
useSharedValue,
2829
withTiming,
29-
} from 'react-native-reanimated';
30-
import { useBottomSheetGestureHandler } from '../hooks/useBottomSheetGestureHandler';
31-
import { useKeyboard } from '../hooks/useKeyboard';
30+
} from "react-native-reanimated";
31+
import { useBottomSheetGestureHandler } from "../hooks/useBottomSheetGestureHandler";
32+
import { useKeyboard } from "../hooks/useKeyboard";
3233

33-
const AnimaCore = require('@react-native-ama/core');
34+
const AnimaCore = require("@react-native-ama/core");
3435

3536
export type BottomSheetProps = {
3637
animationDuration?: number;
@@ -40,7 +41,7 @@ export type BottomSheetProps = {
4041
closeActionAccessibilityLabel: string;
4142
closeDistance?: number;
4243
footerComponent?: React.ReactElement;
43-
handleComponent?: React.ReactElement | 'none';
44+
handleComponent?: React.ReactElement | "none";
4445
handleStyle?: ViewStyle | ViewStyle[];
4546
headerComponent?: React.ReactElement;
4647
maxHeight?: number;
@@ -54,14 +55,14 @@ export type BottomSheetProps = {
5455
hasScrollableContent?: boolean;
5556
scrollViewProps?: Omit<
5657
ScrollViewWrapperProps,
57-
'testID' | 'maxScrollViewHeight'
58+
"testID" | "maxScrollViewHeight"
5859
>;
5960
testID?: string;
6061
topInset: number;
6162
visible: boolean;
6263
ref?: React.RefObject<BottomSheetActions>;
6364
shouldHandleKeyboardEvents?: boolean;
64-
supportedOrientations?: ModalProps['supportedOrientations'];
65+
supportedOrientations?: ModalProps["supportedOrientations"];
6566
isOverlayAccessible?: boolean;
6667
};
6768

@@ -70,9 +71,8 @@ export type BottomSheetActions = {
7071
isVisible: () => boolean;
7172
};
7273

73-
const DEFAULT_MAX_HEIGHT = Dimensions.get('window').height * 0.9;
74-
const isIOS = Platform.OS === 'ios';
75-
const SCREEN_HEIGHT = Dimensions.get('screen').height;
74+
const isIOS = Platform.OS === "ios";
75+
const SCREEN_HEIGHT = Dimensions.get("screen").height;
7676

7777
export const BottomSheet = React.forwardRef<
7878
BottomSheetActions,
@@ -100,7 +100,7 @@ export const BottomSheet = React.forwardRef<
100100
overlayOpacity = 1,
101101
footerComponent,
102102
avoidKeyboard,
103-
maxHeight = DEFAULT_MAX_HEIGHT,
103+
maxHeight: propMaxHeight,
104104
minVelocityToClose = 1000,
105105
topInset,
106106
onBottomSheetHidden,
@@ -128,6 +128,8 @@ export const BottomSheet = React.forwardRef<
128128
shouldHandleKeyboardEvents
129129
);
130130
const shouldReduceMotion = useReducedMotion();
131+
const { height } = useWindowDimensions();
132+
const maxHeight = propMaxHeight ?? height * 0.9;
131133

132134
const duration = shouldReduceMotion ? 0 : animationDuration;
133135

@@ -187,7 +189,19 @@ export const BottomSheet = React.forwardRef<
187189
}
188190
);
189191
}
190-
}, [duration, autoCloseDelay, isModalVisible, onBottomSheetHidden, onClose, onTimeout, translateY, visible, dragOpacity, overlayOpacity, contentHeight.value]);
192+
}, [
193+
duration,
194+
autoCloseDelay,
195+
isModalVisible,
196+
onBottomSheetHidden,
197+
onClose,
198+
onTimeout,
199+
translateY,
200+
visible,
201+
dragOpacity,
202+
overlayOpacity,
203+
contentHeight.value,
204+
]);
191205

192206
React.useEffect(() => {
193207
isMounted.current = true;
@@ -219,11 +233,11 @@ export const BottomSheet = React.forwardRef<
219233
useDerivedValue(() => {
220234
const maxScrollHeight = Math.ceil(
221235
maxHeight -
222-
keyboardFinalHeight.value -
223-
footerHeight -
224-
headerHeight -
225-
handleHeight -
226-
topInset
236+
keyboardFinalHeight.value -
237+
footerHeight -
238+
headerHeight -
239+
handleHeight -
240+
topInset
227241
);
228242

229243
if (
@@ -294,7 +308,7 @@ export const BottomSheet = React.forwardRef<
294308
testID={`${testID}-overlay-button`}
295309
accessible={isOverlayAccessible && !persistent}
296310
importantForAccessibility={
297-
persistent ? 'no-hide-descendants' : 'yes'
311+
persistent ? "no-hide-descendants" : "yes"
298312
}
299313
accessibilityElementsHidden={persistent}
300314
onAccessibilityTap={maybeCloseBottomSheet}
@@ -327,14 +341,14 @@ export const BottomSheet = React.forwardRef<
327341
setHandleHeight(event.nativeEvent.layout.height);
328342
}}
329343
>
330-
{handleComponent === 'none'
344+
{handleComponent === "none"
331345
? null
332346
: handleComponent ?? (
333-
<View
334-
style={[styles.line, handleStyle]}
335-
testID={`${testID}-line`}
336-
/>
337-
)}
347+
<View
348+
style={[styles.line, handleStyle]}
349+
testID={`${testID}-line`}
350+
/>
351+
)}
338352
</View>
339353
<View
340354
onLayout={(event) => {
@@ -372,7 +386,7 @@ const BottomSheetKeyboardAvoidingView = ({
372386
}: React.PropsWithChildren<{}>) => {
373387
return (
374388
<KeyboardAvoidingView
375-
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
389+
behavior={Platform.OS === "ios" ? "padding" : undefined}
376390
pointerEvents="box-none"
377391
style={{ flex: 1 }}
378392
>
@@ -457,30 +471,30 @@ const FragmentWrapper: React.FC<React.PropsWithChildren<any>> = ({
457471

458472
const styles = StyleSheet.create({
459473
overlay: {
460-
backgroundColor: 'rgba(0, 0, 0, 0.5)',
474+
backgroundColor: "rgba(0, 0, 0, 0.5)",
461475
flex: 1,
462476
},
463477
closeButton: {
464478
flex: 1,
465479
},
466480
contentWrapper: {
467-
flexDirection: 'column',
481+
flexDirection: "column",
468482
flex: 1,
469-
position: 'absolute',
483+
position: "absolute",
470484
bottom: 0,
471-
alignSelf: 'flex-end',
472-
width: '100%',
485+
alignSelf: "flex-end",
486+
width: "100%",
473487
},
474488
content: {
475-
width: '100%',
476-
backgroundColor: '#fff',
489+
width: "100%",
490+
backgroundColor: "#fff",
477491
flex: 1,
478492
},
479493
line: {
480494
width: 48,
481495
height: 4,
482-
backgroundColor: 'grey',
483-
alignSelf: 'center',
496+
backgroundColor: "grey",
497+
alignSelf: "center",
484498
marginBottom: 24,
485499
borderRadius: 2,
486500
marginTop: 12,

0 commit comments

Comments
 (0)