Skip to content

Commit b6129c0

Browse files
authored
Merge branch 'master' into youssef/p-3546-add-section-list-component
2 parents a4163f6 + 9dfec69 commit b6129c0

File tree

5 files changed

+25
-48
lines changed

5 files changed

+25
-48
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
branches:
66
- master
7-
- 47
7+
- 48
88
pull_request:
99
types: [assigned, opened, synchronize, reopened]
1010

@@ -64,8 +64,8 @@ jobs:
6464
--yes \
6565
--no-verify-access
6666
67-
- name: Release packages (47)
68-
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/47'
67+
- name: Release packages (48)
68+
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/48'
6969
env:
7070
NODE_AUTH_TOKEN: ${{ secrets.JIGSAW_AUTH_TOKEN }}
7171
run: |
@@ -74,20 +74,6 @@ jobs:
7474
--yes \
7575
--no-verify-access
7676
77-
- name: Release packages (47)
78-
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/47'
79-
env:
80-
NODE_AUTH_TOKEN: ${{ secrets.JIGSAW_AUTH_TOKEN }}
81-
run: |
82-
# Only publishes when finding a new `lerna version` was pushed to
83-
# the branch. But for purposes of _this_ action, that means master.
84-
# You have to manually run lerna version locally and get that PR
85-
# merged before this does anything.
86-
yarn lerna publish from-package \
87-
--ignore-scripts \
88-
--yes \
89-
--no-verify-access
90-
9177
- name: Release to Snack (PRs)
9278
if: github.event_name == 'pull_request'
9379
run: |

packages/core/src/components/SwipeableItem/SwipeableItem.tsx

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ import { SwipeRow } from "react-native-swipe-list-view";
2020
import { IconSlot } from "../../interfaces/Icon";
2121
import type { Theme } from "../../styles/DefaultTheme";
2222
import { withTheme } from "../../theming";
23-
import { SwipeableItemButtonProps } from "./SwipeableItemButton";
23+
import SwipeableItemButton, {
24+
SwipeableItemButtonProps,
25+
} from "./SwipeableItemButton";
2426
import { SwipeableListContext } from "./SwipeableList";
2527
import {
2628
RightSwipeProps,
@@ -87,12 +89,6 @@ const SwipeableItem: React.FC<React.PropsWithChildren<Props>> = ({
8789
disableRightSwipe,
8890
...rest
8991
}) => {
90-
const instanceOfSwipeableItemButtonProps = (
91-
object: any
92-
): object is SwipeableItemButtonProps => {
93-
return "title" in object && "revealSwipeDirection" in object;
94-
};
95-
9692
const isEmptyObject = (object: object) => {
9793
return Object.keys(object).length === 0;
9894
};
@@ -131,7 +127,7 @@ const SwipeableItem: React.FC<React.PropsWithChildren<Props>> = ({
131127
React.Children.toArray(children).filter(
132128
(child) =>
133129
React.isValidElement(child) &&
134-
instanceOfSwipeableItemButtonProps(child.props) &&
130+
child.type === SwipeableItemButton &&
135131
child.props.revealSwipeDirection === "left"
136132
) as React.ReactElement<SwipeableItemButtonProps>[],
137133
[children]
@@ -142,7 +138,7 @@ const SwipeableItem: React.FC<React.PropsWithChildren<Props>> = ({
142138
React.Children.toArray(children).filter(
143139
(child) =>
144140
React.isValidElement(child) &&
145-
instanceOfSwipeableItemButtonProps(child.props) &&
141+
child.type === SwipeableItemButton &&
146142
child.props.revealSwipeDirection === "right"
147143
) as React.ReactElement<SwipeableItemButtonProps>[],
148144
[children]
@@ -152,8 +148,7 @@ const SwipeableItem: React.FC<React.PropsWithChildren<Props>> = ({
152148
() =>
153149
React.Children.toArray(children).filter(
154150
(child) =>
155-
React.isValidElement(child) &&
156-
!instanceOfSwipeableItemButtonProps(child.props)
151+
React.isValidElement(child) && child.type !== SwipeableItemButton
157152
),
158153
[children]
159154
);

packages/core/src/components/TabView/TabView.tsx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
Route,
99
} from "react-native-tab-view";
1010

11-
import { TabViewItemProps } from "./TabViewItem";
11+
import TabViewItem from "./TabViewItem";
1212
import type { IconSlot } from "../../interfaces/Icon";
1313
import { withTheme } from "../../theming";
1414
import type { Theme } from "../../styles/DefaultTheme";
@@ -62,23 +62,14 @@ const TabViewComponent: React.FC<React.PropsWithChildren<TabViewProps>> = ({
6262

6363
const { textStyles, viewStyles } = extractStyles(style);
6464

65-
//Check type of child using props
66-
//Regular '.type' cannot work because Draftbit strips the type in Draft view
67-
const instanceOfTabViewItemProps = (
68-
object: any
69-
): object is TabViewItemProps => {
70-
return "title" in object;
71-
};
72-
7365
//Populate routes and scenes based on children
7466
React.useEffect(() => {
7567
const newRoutes: Route[] = [];
7668
const scenes: { [key: string]: React.ReactElement } = {};
7769

7870
React.Children.toArray(children)
7971
.filter(
80-
(child) =>
81-
React.isValidElement(child) && instanceOfTabViewItemProps(child.props)
72+
(child) => React.isValidElement(child) && child.type === TabViewItem
8273
)
8374
.forEach((item: any, idx) => {
8475
const child = item as React.ReactElement;

packages/core/src/components/TabView/TabViewItem.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import React from "react";
22
import { StyleProp, ViewStyle, StyleSheet, View } from "react-native";
33

4-
//Props used by parent (TabView) to create tabs
5-
export interface TabViewItemProps {
4+
interface TabViewItemProps {
65
title: string;
76
icon?: string;
87
accessibilityLabel?: string;

packages/maps/src/components/MapMarker.tsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,11 @@ export function renderMarker(
5757
if (calloutChildren.length === 0 && (title || description)) {
5858
calloutChildren.push(
5959
<MapCallout showTooltip>
60-
<View>
61-
{title && <Text style={style.title}>{title}</Text>}
62-
{description && <Text style={style.description}>{description}</Text>}
60+
<View style={styles.defaultCalloutContainer}>
61+
{title && <Text style={styles.defaultCalloutTitle}>{title}</Text>}
62+
{description && (
63+
<Text style={styles.defaultCalloutDescription}>{description}</Text>
64+
)}
6365
</View>
6466
</MapCallout>
6567
);
@@ -98,13 +100,17 @@ export function renderMarker(
98100
);
99101
}
100102

101-
const style = StyleSheet.create({
102-
title: {
103+
const styles = StyleSheet.create({
104+
defaultCalloutContainer: {
105+
flex: 1,
106+
},
107+
defaultCalloutTitle: {
103108
fontWeight: "600",
104109
textAlign: "center",
110+
maxWidth: 250,
105111
},
106-
description: {
107-
textAlign: "center",
112+
defaultCalloutDescription: {
113+
maxWidth: 250,
108114
},
109115
});
110116

0 commit comments

Comments
 (0)