Skip to content

Commit 8694d47

Browse files
authored
Map and SwipeableView Fixes/Updates (v46.12.1) (#640)
* Updated default disable of swipeable view * Update maps callback args to provide more inforamtion * Removed nullable on onPress and onSwipe Will only be rendered under SwipeableView when onPress/onSwipe provided * Fixed issue with size styles application for web on swipeable view * v46.12.1 * Addressed PR comments
1 parent d6b3af0 commit 8694d47

File tree

19 files changed

+100
-54
lines changed

19 files changed

+100
-54
lines changed

example/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@draftbit/example",
33
"description": "Example app for @draftbit/ui",
4-
"version": "46.12.0",
4+
"version": "46.12.1",
55
"private": true,
66
"main": "__generated__/AppEntry.js",
77
"scripts": {
@@ -15,8 +15,8 @@
1515
"clean:modules": "rimraf node_modules"
1616
},
1717
"dependencies": {
18-
"@draftbit/maps": "46.12.0",
19-
"@draftbit/ui": "46.12.0",
18+
"@draftbit/maps": "46.12.1",
19+
"@draftbit/ui": "46.12.1",
2020
"@expo/dev-server": "0.1.120",
2121
"@expo/webpack-config": "^0.17.0",
2222
"@react-navigation/drawer": "^5.7.7",

example/src/SwipeableViewExample.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@ const SwipeableViewExample: React.FC = () => {
1515
<Text>Some Content</Text>
1616

1717
<SwipeableViewButton
18-
onPress={null}
18+
onPress={() => {}}
1919
side="left"
2020
title="Button"
2121
icon="add"
2222
/>
2323
<SwipeableViewButton
24-
onPress={null}
24+
onPress={() => {}}
2525
side="left"
2626
title="Button"
2727
icon="add"
2828
/>
2929
<SwipeableViewSwipeHandler
30-
onSwipe={null}
30+
onSwipe={() => {}}
3131
side="right"
3232
title="Swipe"
3333
icon="add"

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "46.12.0",
2+
"version": "46.12.1",
33
"npmClient": "yarn",
44
"useWorkspaces": true,
55
"packages": ["packages/*", "example"],

packages/core/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@draftbit/core",
3-
"version": "46.12.0",
3+
"version": "46.12.1",
44
"description": "Core (non-native) Components",
55
"main": "lib/commonjs/index.js",
66
"module": "lib/module/index.js",
@@ -41,7 +41,7 @@
4141
"dependencies": {
4242
"@date-io/date-fns": "^1.3.13",
4343
"@draftbit/react-theme-provider": "^2.1.1",
44-
"@draftbit/types": "46.12.0",
44+
"@draftbit/types": "46.12.1",
4545
"@material-ui/core": "^4.11.0",
4646
"@material-ui/pickers": "^3.2.10",
4747
"@react-native-community/slider": "4.2.3",

packages/core/src/components/SwipeableView/SwipeableView.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,23 @@ const SwipeableView: React.FC<React.PropsWithChildren<SwipeableViewProps>> = ({
7777
const { borderStyles, marginStyles } =
7878
extractBorderAndMarginStyles(viewStyles);
7979

80+
const sizeStyles = extractSizeStyles(viewStyles);
81+
8082
const parentContainerStyles = StyleSheet.flatten([
8183
borderStyles,
8284
marginStyles,
8385
extractFlexItemStyles(viewStyles),
8486
extractPositionStyles(viewStyles),
8587
extractEffectStyles(viewStyles),
86-
extractSizeStyles(viewStyles),
88+
sizeStyles,
8789
]);
8890

8991
//Remove styles already consumed from viewStyles
9092
Object.keys(parentContainerStyles).forEach((key) => delete viewStyles[key]);
91-
const surfaceContainerStyles = viewStyles;
93+
const surfaceContainerStyles = StyleSheet.flatten([
94+
viewStyles,
95+
sizeStyles /* Size styles needs to be readded to surface container due to inconsistencies on web */,
96+
]);
9297

9398
const [componentWidth, setComponentWidth] = React.useState<number | null>(
9499
null
@@ -289,7 +294,7 @@ const styles = StyleSheet.create({
289294
surfaceContainer: {
290295
flexDirection: "row",
291296
width: "100%",
292-
height: "100%",
297+
minHeight: 50,
293298
padding: 10,
294299
alignItems: "center",
295300
overflow: "hidden",

packages/core/src/components/SwipeableView/SwipeableViewButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React from "react";
33
export interface SwipeableViewButtonProps {
44
title: string;
55
side: "left" | "right";
6-
onPress: (() => void) | null; //Not optional in order to always exist in props
6+
onPress?: () => void;
77
icon?: string;
88
iconSize?: number;
99
backgroundColor?: string;

packages/core/src/components/SwipeableView/SwipeableViewSwipeHandler.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React from "react";
33
export interface SwipeableViewSwipeHandlerProps {
44
title: string;
55
side: "left" | "right";
6-
onSwipe: (() => void) | null; //Not optional in order to always exist in props
6+
onSwipe?: () => void;
77
icon?: string;
88
iconSize?: number;
99
backgroundColor?: string;

packages/core/src/mappings/SwipeableView.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ export const SEED_DATA = [
8686
disableLeftSwipe: createBoolProp({
8787
label: "Disable left swipe",
8888
description: "Whether left swipe is enabled or not",
89-
defaultValue: true,
89+
defaultValue: false,
9090
}),
9191
disableRightSwipe: createBoolProp({
9292
label: "Disable right swipe",
9393
description: "Whether right swipe is enabled or not",
94-
defaultValue: true,
94+
defaultValue: false,
9595
}),
9696
leftOpenValue: createStaticNumberProp({
9797
label: "Left open value",

packages/core/src/utilities.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export function extractEffectStyles(
169169
return effectStyles;
170170
}
171171

172-
export const sizeStyleNames = ["width", "height"];
172+
export const sizeStyleNames = ["width", "height", "minWidth", "minHeight"];
173173

174174
export function extractSizeStyles(
175175
style: StyleProp<any>,

packages/maps/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@draftbit/maps",
3-
"version": "46.12.0",
3+
"version": "46.12.1",
44
"description": "Map Components",
55
"main": "lib/commonjs/index.js",
66
"module": "lib/module/index.js",
@@ -39,8 +39,8 @@
3939
},
4040
"homepage": "https://github.com/draftbit/react-native-jigsaw#readme",
4141
"dependencies": {
42-
"@draftbit/types": "46.12.0",
43-
"@draftbit/web-maps": "46.12.0",
42+
"@draftbit/types": "46.12.1",
43+
"@draftbit/web-maps": "46.12.1",
4444
"react-native-maps": "0.31.1"
4545
},
4646
"react-native-builder-bob": {

0 commit comments

Comments
 (0)