Skip to content

Commit 5a809a4

Browse files
author
Paweł Kata
committed
chore(appbar): merge latest main into appbar improvements
1 parent 4ede190 commit 5a809a4

98 files changed

Lines changed: 201 additions & 163 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/contributor-label.yml‎

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,46 +6,74 @@ on:
66

77
permissions:
88
issues: write
9-
pull-requests: write
109

1110
jobs:
1211
label:
1312
name: Add contributor label
1413
runs-on: ubuntu-latest
1514
steps:
15+
- uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
16+
id: app-token
17+
with:
18+
app-id: ${{ secrets.ORG_MEMBERSHIP_APP_ID }}
19+
private-key: ${{ secrets.ORG_MEMBERSHIP_APP_PRIVATE_KEY }}
20+
owner: callstack-internal
21+
permission-members: read
22+
1623
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
24+
env:
25+
ORG_MEMBERSHIP_TOKEN: ${{ steps.app-token.outputs.token }}
1726
with:
1827
github-token: ${{ secrets.GITHUB_TOKEN }}
1928
script: |
2029
const owner = context.repo.owner;
2130
const repo = context.repo.repo;
2231
23-
let permission = 'none';
32+
const label = 'Contributor: Internal';
33+
34+
const pullRequest = context.payload.pull_request;
35+
36+
if (pullRequest.labels.some(({ name }) => name === label)) {
37+
return;
38+
}
39+
40+
const username = pullRequest.user.login;
2441
25-
try {
26-
const { data } = await github.rest.repos.getCollaboratorPermissionLevel({
42+
const { data } =
43+
await github.rest.repos.getCollaboratorPermissionLevel({
2744
owner,
2845
repo,
29-
username: context.payload.pull_request.user.login,
46+
username,
3047
});
3148
32-
permission = data.permission;
33-
} catch (error) {
34-
if (error.status !== 404) {
35-
throw error;
49+
let isInternal =
50+
['MEMBER', 'OWNER'].includes(pullRequest.author_association) ||
51+
['admin', 'maintain', 'write'].includes(data.permission);
52+
53+
if (!isInternal) {
54+
try {
55+
const internalGithub = getOctokit(process.env.ORG_MEMBERSHIP_TOKEN);
56+
57+
await internalGithub.rest.orgs.checkMembershipForUser({
58+
org: 'callstack-internal',
59+
username,
60+
});
61+
62+
isInternal = true;
63+
} catch (error) {
64+
if (error.status !== 404) {
65+
throw error;
66+
}
3667
}
3768
}
3869
39-
if (
40-
!['MEMBER', 'OWNER'].includes(context.payload.pull_request.author_association) &&
41-
!['admin', 'maintain', 'write'].includes(permission)
42-
) {
70+
if (!isInternal) {
4371
return;
4472
}
4573
4674
await github.rest.issues.addLabels({
4775
owner,
4876
repo,
49-
issue_number: context.issue.number,
50-
labels: ['Contributor: Internal'],
77+
issue_number: pullRequest.number,
78+
labels: [label],
5179
});

‎example/src/DrawerItems.tsx‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
useTheme,
1818
} from 'react-native-paper';
1919

20-
import { dynamicThemeSupported, isWeb } from '../utils';
20+
import { dynamicThemeSupported } from '../utils';
2121
import { PreferencesContext } from './PreferencesContext';
2222

2323
const DrawerItemsData = [
@@ -92,7 +92,6 @@ function DrawerItems() {
9292
const _setDrawerItem = (index: number) => setDrawerItemIndex(index);
9393

9494
const { colors } = useTheme();
95-
const isIOS = Platform.OS === 'ios';
9695
const expoGoExecution =
9796
Constants.executionEnvironment === ExecutionEnvironment.StoreClient;
9897

@@ -114,7 +113,7 @@ function DrawerItems() {
114113
} = preferences;
115114

116115
const _handleToggleRTL = () => {
117-
if (!isWeb && expoGoExecution) {
116+
if (Platform.OS !== 'web' && expoGoExecution) {
118117
setShowRTLDialog(true);
119118
return;
120119
}
@@ -222,7 +221,7 @@ function DrawerItems() {
222221
<TouchableRipple onPress={toggleRippleEffect}>
223222
<View style={[styles.preference, styles.v3Preference]}>
224223
<Text variant="labelLarge">
225-
{isIOS ? 'Highlight' : 'Ripple'} effect *
224+
{Platform.OS === 'ios' ? 'Highlight' : 'Ripple'} effect *
226225
</Text>
227226
<View pointerEvents="none">
228227
<Switch value={rippleEffectEnabled} />

‎example/src/Examples/CardExample.tsx‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react';
2-
import { Alert, ScrollView, StyleSheet, View } from 'react-native';
2+
import { Alert, Platform, ScrollView, StyleSheet, View } from 'react-native';
33

44
import {
55
Avatar,
@@ -11,7 +11,6 @@ import {
1111
useTheme,
1212
} from 'react-native-paper';
1313

14-
import { isWeb } from '../../utils';
1514
import { PreferencesContext } from '../PreferencesContext';
1615
import ScreenWrapper from '../ScreenWrapper';
1716

@@ -151,7 +150,7 @@ const CardExample = () => {
151150
<Card
152151
style={styles.card}
153152
onPress={() => {
154-
isWeb
153+
Platform.OS === 'web'
155154
? alert('The Chameleon is Pressed')
156155
: Alert.alert('The Chameleon is Pressed');
157156
}}
@@ -168,7 +167,7 @@ const CardExample = () => {
168167
<Card
169168
style={styles.card}
170169
onLongPress={() => {
171-
isWeb
170+
Platform.OS === 'web'
172171
? alert('The City is Long Pressed')
173172
: Alert.alert('The City is Long Pressed');
174173
}}

‎example/src/Examples/Dialogs/DialogWithLoadingIndicator.tsx‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import { Dialog, Palette, Portal } from 'react-native-paper';
44

55
import { TextComponent } from './DialogTextComponent';
66

7-
const isIOS = Platform.OS === 'ios';
8-
97
const DialogWithLoadingIndicator = ({
108
visible,
119
close,
@@ -21,7 +19,7 @@ const DialogWithLoadingIndicator = ({
2119
<View style={styles.flexing}>
2220
<ActivityIndicator
2321
color={Palette.tertiary30}
24-
size={isIOS ? 'large' : 48}
22+
size={Platform.OS === 'ios' ? 'large' : 48}
2523
style={styles.marginRight}
2624
/>
2725
<TextComponent>Loading.....</TextComponent>

‎example/src/Examples/TooltipExample.tsx‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {
1515
Card,
1616
} from 'react-native-paper';
1717

18-
import { isWeb } from '../../utils';
1918
import ScreenWrapper from '../ScreenWrapper';
2019

2120
const MORE_ICON = Platform.OS === 'ios' ? 'dots-horizontal' : 'dots-vertical';
@@ -91,7 +90,7 @@ const TooltipExample = () => {
9190
<ScreenWrapper>
9291
<Banner visible>
9392
A tooltip is displayed upon
94-
{!isWeb
93+
{Platform.OS !== 'web'
9594
? ' tapping and holding a screen element or component'
9695
: ' hovering over a screen element or component'}
9796
. Continuously display the tooltip as long as the user long-presses or

‎example/utils/index.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ export function inputReducer<T extends keyof State>(
6060
}
6161
}
6262

63-
export const isWeb = Platform.OS === 'web';
64-
6563
export const animatedFABExampleData = [
6664
{
6765
id: '1',

‎src/components/ActivityIndicator.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Animated, Easing, Platform, StyleSheet, View } from 'react-native';
44
import type { ColorValue, StyleProp, ViewProps, ViewStyle } from 'react-native';
55

66
import { useInternalTheme } from '../core/theming';
7-
import type { ThemeProp } from '../types';
7+
import type { ThemeProp } from '../theme/types';
88

99
export type Props = ViewProps & {
1010
/**

‎src/components/Appbar/AppbarButton.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { StyleSheet } from 'react-native';
22

33
import AppbarBackIcon from './AppbarBackIcon';
44
import type { AppbarLeadingButton, AppbarTrailingAction } from './types';
5-
import type { Theme } from '../../types';
5+
import type { Theme } from '../../theme/types';
66
import IconButton from '../IconButton/IconButton';
77

88
type Props = {

‎src/components/Appbar/AppbarContent.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import type {
88
Props as AppbarProps,
99
} from './types';
1010
import { APPBAR_HEADLINE_IMAGE_HEIGHT } from './utils';
11-
import type { Theme, TypescaleKey } from '../../types';
11+
import type { Theme, TypescaleKey } from '../../theme/types';
1212
import Text from '../Typography/Text';
1313

1414
type Props = Pick<

‎src/components/Appbar/types.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import type {
99
ViewStyle,
1010
} from 'react-native';
1111

12-
import type { ThemeProp } from '../../types';
12+
import type { ThemeProp } from '../../theme/types';
1313
import type { IconSource } from '../Icon';
1414
import type { Props as IconButtonProps } from '../IconButton/IconButton';
1515
import type { Props as SearchbarProps } from '../Searchbar';

0 commit comments

Comments
 (0)