diff --git a/examples/SampleApp/src/components/AttachmentPickerSelectionBar.tsx b/examples/SampleApp/src/components/AttachmentPickerSelectionBar.tsx index 6201074e3e..eb17c80820 100644 --- a/examples/SampleApp/src/components/AttachmentPickerSelectionBar.tsx +++ b/examples/SampleApp/src/components/AttachmentPickerSelectionBar.tsx @@ -54,7 +54,7 @@ const useStyles = () => { const { theme: { semantics }} = useTheme(); return useMemo(() => StyleSheet.create({ selectionBar: { - backgroundColor: semantics.composerBg, + backgroundColor: semantics.backgroundCoreElevation1, flexDirection: 'row', alignItems: 'center', paddingHorizontal: 16, diff --git a/package/expo-package/src/optionalDependencies/__tests__/getPhotos.test.ts b/package/expo-package/src/optionalDependencies/__tests__/getPhotos.test.ts deleted file mode 100644 index 24afe40d6c..0000000000 --- a/package/expo-package/src/optionalDependencies/__tests__/getPhotos.test.ts +++ /dev/null @@ -1,86 +0,0 @@ -jest.mock( - 'expo-media-library', - () => ({ - MediaType: { - photo: 'photo', - video: 'video', - }, - SortBy: { - modificationTime: 'modificationTime', - }, - getAssetsAsync: jest.fn(), - getPermissionsAsync: jest.fn(), - requestPermissionsAsync: jest.fn(), - }), - { virtual: true }, -); - -jest.mock('../getLocalAssetUri', () => ({ - getLocalAssetUri: jest.fn(), -})); - -import * as MediaLibrary from 'expo-media-library'; - -import { getLocalAssetUri } from '../getLocalAssetUri'; -import { getPhotos } from '../getPhotos'; - -const mockedMediaLibrary = MediaLibrary as { - getAssetsAsync: jest.Mock; - getPermissionsAsync: jest.Mock; - requestPermissionsAsync: jest.Mock; -}; - -const mockedGetLocalAssetUri = getLocalAssetUri as jest.Mock; - -describe('getPhotos', () => { - beforeEach(() => { - mockedMediaLibrary.getPermissionsAsync.mockResolvedValue({ - accessPrivileges: 'all', - status: 'granted', - }); - mockedMediaLibrary.requestPermissionsAsync.mockResolvedValue({ - status: 'granted', - }); - mockedMediaLibrary.getAssetsAsync.mockReset(); - mockedGetLocalAssetUri.mockReset(); - mockedGetLocalAssetUri.mockResolvedValue(undefined); - }); - - it('falls back to media-type mime strings when filename mime detection returns null', async () => { - mockedMediaLibrary.getAssetsAsync.mockResolvedValue({ - assets: [ - { - duration: 0, - filename: 'IMG_0001', - height: 100, - id: 'photo-1', - mediaType: MediaLibrary.MediaType.photo, - uri: 'ph://photo-1', - width: 200, - }, - { - duration: 12, - filename: 'VID_0002', - height: 300, - id: 'video-1', - mediaType: MediaLibrary.MediaType.video, - uri: 'ph://video-1', - width: 400, - }, - ], - endCursor: undefined, - hasNextPage: false, - }); - - const result = await getPhotos({ after: undefined, first: 20 }); - - expect(result.assets).toEqual([ - expect.objectContaining({ - type: 'image/*', - }), - expect.objectContaining({ - type: 'video/*', - }), - ]); - }); -}); diff --git a/package/src/components/Attachment/Audio/PlayPauseButton.tsx b/package/src/components/Attachment/Audio/PlayPauseButton.tsx index c0dd4bc35a..71d9f0d0f4 100644 --- a/package/src/components/Attachment/Audio/PlayPauseButton.tsx +++ b/package/src/components/Attachment/Audio/PlayPauseButton.tsx @@ -38,7 +38,7 @@ export const PlayPauseButton = ({ style={({ pressed }) => [ styles.container, { - backgroundColor: pressed ? semantics.backgroundCorePressed : 'transparent', + backgroundColor: pressed ? semantics.backgroundUtilityPressed : 'transparent', }, containerStyle, ]} diff --git a/package/src/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentMediaPicker.tsx b/package/src/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentMediaPicker.tsx index 887a4d8080..95d7491f07 100644 --- a/package/src/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentMediaPicker.tsx +++ b/package/src/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentMediaPicker.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useRef, useState } from 'react'; +import React, { useEffect, useMemo, useRef, useState } from 'react'; import { Linking, StyleSheet } from 'react-native'; import { renderAttachmentPickerItem } from './AttachmentPickerItem'; @@ -31,12 +31,16 @@ const useMediaPickerStyles = () => { const { theme: { semantics }, } = useTheme(); - return StyleSheet.create({ - container: { - flexGrow: 1, - backgroundColor: semantics.composerBg, - }, - }); + return useMemo( + () => + StyleSheet.create({ + container: { + flexGrow: 1, + backgroundColor: semantics.backgroundCoreElevation1, + }, + }), + [semantics.backgroundCoreElevation1], + ); }; export const AttachmentMediaPickerIcon = () => { diff --git a/package/src/components/AttachmentPicker/components/AttachmentPickerContent.tsx b/package/src/components/AttachmentPicker/components/AttachmentPickerContent.tsx index 1eedaf2351..6a26aeffe8 100644 --- a/package/src/components/AttachmentPicker/components/AttachmentPickerContent.tsx +++ b/package/src/components/AttachmentPicker/components/AttachmentPickerContent.tsx @@ -32,7 +32,7 @@ const useStyles = () => { container: { alignItems: 'center', justifyContent: 'center', - backgroundColor: semantics.backgroundElevationElevation1, + backgroundColor: semantics.backgroundCoreElevation1, paddingHorizontal: primitives.spacing2xl, paddingBottom: primitives.spacing3xl, }, @@ -46,7 +46,7 @@ const useStyles = () => { maxWidth: 200, }, }), - [semantics.backgroundElevationElevation1, semantics.textSecondary], + [semantics.backgroundCoreElevation1, semantics.textSecondary], ); }; @@ -117,7 +117,7 @@ const AttachmentCommandPickerItemUI = ({ return ( ({ - backgroundColor: pressed ? semantics.backgroundCorePressed : undefined, + backgroundColor: pressed ? semantics.backgroundUtilityPressed : undefined, borderRadius: primitives.radiusSm, })} onPress={onPress} @@ -175,10 +175,10 @@ const useCommandPickerStyle = () => { flexGrow: 1, paddingHorizontal: primitives.spacingXxs, paddingBottom: primitives.spacing2xl, - backgroundColor: semantics.composerBg, + backgroundColor: semantics.backgroundCoreElevation1, }, title: { - backgroundColor: semantics.composerBg, + backgroundColor: semantics.backgroundCoreElevation1, fontWeight: primitives.typographyFontWeightSemiBold, fontSize: primitives.typographyFontSizeMd, color: semantics.textPrimary, @@ -186,7 +186,7 @@ const useCommandPickerStyle = () => { paddingBottom: primitives.spacingMd, }, }), - [semantics.composerBg, semantics.textPrimary], + [semantics.backgroundCoreElevation1, semantics.textPrimary], ); }; diff --git a/package/src/components/AttachmentPicker/components/AttachmentPickerSelectionBar.tsx b/package/src/components/AttachmentPicker/components/AttachmentPickerSelectionBar.tsx index c43274a096..5586088be4 100644 --- a/package/src/components/AttachmentPicker/components/AttachmentPickerSelectionBar.tsx +++ b/package/src/components/AttachmentPicker/components/AttachmentPickerSelectionBar.tsx @@ -20,14 +20,14 @@ const useStyles = () => { () => StyleSheet.create({ container: { - backgroundColor: semantics.composerBg, + backgroundColor: semantics.backgroundCoreElevation1, paddingBottom: primitives.spacingSm, paddingHorizontal: primitives.spacingMd, alignItems: 'center', flexDirection: 'row', }, }), - [semantics.composerBg], + [semantics.backgroundCoreElevation1], ); }; diff --git a/package/src/components/AutoCompleteInput/AutoCompleteSuggestionList.tsx b/package/src/components/AutoCompleteInput/AutoCompleteSuggestionList.tsx index 56b0226ca0..455d8efd3c 100644 --- a/package/src/components/AutoCompleteInput/AutoCompleteSuggestionList.tsx +++ b/package/src/components/AutoCompleteInput/AutoCompleteSuggestionList.tsx @@ -126,13 +126,13 @@ const useStyles = () => { StyleSheet.create({ container: { maxHeight: DEFAULT_LIST_HEIGHT, - backgroundColor: semantics.composerBg, + backgroundColor: semantics.backgroundCoreElevation1, borderTopWidth: 1, borderColor: semantics.borderCoreDefault, }, flatlist: { - backgroundColor: semantics.composerBg, - shadowColor: semantics.accentBlack, + backgroundColor: semantics.backgroundCoreElevation1, + shadowColor: semantics.textOnAccent, borderRadius: 8, elevation: 3, marginHorizontal: 8, diff --git a/package/src/components/ChannelPreview/ChannelDetailsBottomSheet.tsx b/package/src/components/ChannelPreview/ChannelDetailsBottomSheet.tsx index d93dcad12d..c4e1b6c3af 100644 --- a/package/src/components/ChannelPreview/ChannelDetailsBottomSheet.tsx +++ b/package/src/components/ChannelPreview/ChannelDetailsBottomSheet.tsx @@ -125,14 +125,14 @@ const useStyles = () => { StyleSheet.create({ contentContainer: { flexGrow: 1, - backgroundColor: semantics.backgroundElevationElevation1, + backgroundColor: semantics.backgroundCoreElevation1, ...contentContainer, }, headerContainer: { flexDirection: 'row', padding: primitives.spacingSm, gap: primitives.spacingSm, - backgroundColor: semantics.backgroundElevationElevation1, + backgroundColor: semantics.backgroundCoreElevation1, ...header.container, }, headerMeta: { @@ -174,7 +174,7 @@ const useStyles = () => { item.destructiveText, item.standardText, semantics.accentError, - semantics.backgroundElevationElevation1, + semantics.backgroundCoreElevation1, semantics.textPrimary, semantics.textTertiary, ], diff --git a/package/src/components/ChannelPreview/ChannelPreviewMessenger.tsx b/package/src/components/ChannelPreview/ChannelPreviewMessenger.tsx index 43ea0c8b02..7379fe2fe7 100644 --- a/package/src/components/ChannelPreview/ChannelPreviewMessenger.tsx +++ b/package/src/components/ChannelPreview/ChannelPreviewMessenger.tsx @@ -104,7 +104,7 @@ const ChannelPreviewMessengerWithContext = (props: ChannelPreviewMessengerPropsW { backgroundColor: pressed && !swipeRegistry?.hasOpen() - ? semantics.backgroundCorePressed + ? semantics.backgroundUtilityPressed : 'transparent', }, container, diff --git a/package/src/components/ImageGallery/components/ImageGalleryFooter.tsx b/package/src/components/ImageGallery/components/ImageGalleryFooter.tsx index 9cfe91a31c..ec3f101d1e 100644 --- a/package/src/components/ImageGallery/components/ImageGalleryFooter.tsx +++ b/package/src/components/ImageGallery/components/ImageGalleryFooter.tsx @@ -216,7 +216,7 @@ const useStyles = () => { () => StyleSheet.create({ container: { - backgroundColor: semantics.backgroundElevationElevation1, + backgroundColor: semantics.backgroundCoreElevation1, borderTopWidth: 1, borderTopColor: semantics.borderCoreDefault, ...footer.container, diff --git a/package/src/components/ImageGallery/components/ImageGalleryHeader.tsx b/package/src/components/ImageGallery/components/ImageGalleryHeader.tsx index c7e5563e28..fafef3c6a0 100644 --- a/package/src/components/ImageGallery/components/ImageGalleryHeader.tsx +++ b/package/src/components/ImageGallery/components/ImageGalleryHeader.tsx @@ -116,7 +116,7 @@ const useStyles = () => { () => StyleSheet.create({ container: { - backgroundColor: semantics.backgroundElevationElevation1, + backgroundColor: semantics.backgroundCoreElevation1, gap: primitives.spacingXs, ...header.container, }, diff --git a/package/src/components/ImageGallery/components/ImageGalleryVideoControl.tsx b/package/src/components/ImageGallery/components/ImageGalleryVideoControl.tsx index 3ecda66635..0659349ba4 100644 --- a/package/src/components/ImageGallery/components/ImageGalleryVideoControl.tsx +++ b/package/src/components/ImageGallery/components/ImageGalleryVideoControl.tsx @@ -120,7 +120,7 @@ const useStyles = () => { return useMemo(() => { return StyleSheet.create({ container: { - backgroundColor: semantics.backgroundElevationElevation1, + backgroundColor: semantics.backgroundCoreElevation1, alignItems: 'center', flexDirection: 'row', justifyContent: 'space-evenly', diff --git a/package/src/components/Indicators/LoadingDot.tsx b/package/src/components/Indicators/LoadingDot.tsx index 409d464fde..711d7a4fcc 100644 --- a/package/src/components/Indicators/LoadingDot.tsx +++ b/package/src/components/Indicators/LoadingDot.tsx @@ -56,7 +56,7 @@ export const LoadingDot = (props: Props) => { styles.container, { backgroundColor: selected - ? semantics.backgroundCoreSelected + ? semantics.backgroundUtilitySelected : pressed - ? semantics.backgroundCorePressed + ? semantics.backgroundUtilityPressed : semantics.reactionBg, }, style, diff --git a/package/src/components/MessageInput/MessageInput.tsx b/package/src/components/MessageInput/MessageInput.tsx index ac678ef934..de5f63b0ab 100644 --- a/package/src/components/MessageInput/MessageInput.tsx +++ b/package/src/components/MessageInput/MessageInput.tsx @@ -74,11 +74,11 @@ const useStyles = () => { alignItems: 'center', flex: 1, justifyContent: 'center', - backgroundColor: semantics.backgroundElevationElevation1, + backgroundColor: semantics.backgroundCoreElevation1, }, pollSafeArea: { flex: 1, - backgroundColor: semantics.backgroundElevationElevation1, + backgroundColor: semantics.backgroundCoreElevation1, }, container: { alignItems: 'center', @@ -107,7 +107,7 @@ const useStyles = () => { borderWidth: 1, flex: 1, flexDirection: 'row', - backgroundColor: semantics.composerBg, + backgroundColor: semantics.backgroundCoreElevation1, borderColor: semantics.borderCoreDefault, }, inputButtonsContainer: { @@ -132,7 +132,7 @@ const useStyles = () => { shadowRadius: 12, }, suggestionsListContainer: { - backgroundColor: semantics.composerBg, + backgroundColor: semantics.backgroundCoreElevation1, position: 'absolute', width: '100%', }, @@ -404,7 +404,7 @@ const MessageInputWithContext = (props: MessageInputPropsWithContext) => { styles.wrapper, { borderTopWidth: 1, - backgroundColor: semantics.composerBg, + backgroundColor: semantics.backgroundCoreElevation1, borderColor: semantics.borderCoreDefault, // paddingBottom: BOTTOM_OFFSET, paddingBottom: diff --git a/package/src/components/MessageInput/components/AttachmentPreview/AttachmentUploadProgressIndicator.tsx b/package/src/components/MessageInput/components/AttachmentPreview/AttachmentUploadProgressIndicator.tsx index 7ea9b848fe..4c19380a2b 100644 --- a/package/src/components/MessageInput/components/AttachmentPreview/AttachmentUploadProgressIndicator.tsx +++ b/package/src/components/MessageInput/components/AttachmentPreview/AttachmentUploadProgressIndicator.tsx @@ -169,7 +169,7 @@ const useImageUploadNotSupportedIndicatorStyles = () => { } = useTheme(); return StyleSheet.create({ container: { - backgroundColor: semantics.backgroundElevationElevation0, + backgroundColor: semantics.backgroundCoreElevation0, borderRadius: primitives.radiusMax, position: 'absolute', left: primitives.spacingXxs, diff --git a/package/src/components/MessageInput/components/AttachmentPreview/ImageAttachmentUploadPreview.tsx b/package/src/components/MessageInput/components/AttachmentPreview/ImageAttachmentUploadPreview.tsx index 0385522022..5ef92794eb 100644 --- a/package/src/components/MessageInput/components/AttachmentPreview/ImageAttachmentUploadPreview.tsx +++ b/package/src/components/MessageInput/components/AttachmentPreview/ImageAttachmentUploadPreview.tsx @@ -89,7 +89,7 @@ const useStyles = () => { theme: { semantics }, } = useTheme(); - const { borderCoreOpacity10 } = semantics; + const { borderCoreOpacitySubtle } = semantics; return useMemo( () => @@ -101,7 +101,7 @@ const useStyles = () => { justifyContent: 'center', alignItems: 'center', borderRadius: primitives.radiusLg, - borderColor: borderCoreOpacity10, + borderColor: borderCoreOpacitySubtle, borderWidth: 1, overflow: 'hidden', }, @@ -109,6 +109,6 @@ const useStyles = () => { padding: primitives.spacingXxs, }, }), - [borderCoreOpacity10], + [borderCoreOpacitySubtle], ); }; diff --git a/package/src/components/MessageInput/components/AudioRecorder/AudioRecordingButton.tsx b/package/src/components/MessageInput/components/AudioRecorder/AudioRecordingButton.tsx index 7d65ac3857..265d20a022 100644 --- a/package/src/components/MessageInput/components/AudioRecorder/AudioRecordingButton.tsx +++ b/package/src/components/MessageInput/components/AudioRecorder/AudioRecordingButton.tsx @@ -232,7 +232,7 @@ export const AudioRecordingButtonWithContext = (props: AudioRecordingButtonProps const animatedStyle = useAnimatedStyle(() => { return { transform: [{ scale: scale.value }], - backgroundColor: pressed.value ? semantics.backgroundCorePressed : 'transparent', + backgroundColor: pressed.value ? semantics.backgroundUtilityPressed : 'transparent', }; }); diff --git a/package/src/components/MessageList/ScrollToBottomButton.tsx b/package/src/components/MessageList/ScrollToBottomButton.tsx index 52fe02cd22..d60ba57196 100644 --- a/package/src/components/MessageList/ScrollToBottomButton.tsx +++ b/package/src/components/MessageList/ScrollToBottomButton.tsx @@ -38,7 +38,7 @@ export const ScrollToBottomButton = (props: ScrollToBottomButtonProps) => { style={[ styles.floatingButtonContainer, primitives.lightElevation1, - { backgroundColor: semantics.backgroundElevationElevation1 }, + { backgroundColor: semantics.backgroundCoreElevation1 }, ]} >