Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 44 additions & 42 deletions examples/ExpoMessaging/useStreamChatTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,49 +14,51 @@ export const useStreamChatTheme = () => {
colors:
colorScheme === 'dark'
? {
accent_blue: '#005FFF',
accent_green: '#20E070',
accent_red: '#FF3742',
bg_gradient_end: '#101214',
bg_gradient_start: '#070A0D',
black: '#FFFFFF',
blue_alice: '#00193D',
border: '#141924',
grey: '#7A7A7A',
grey_gainsboro: '#2D2F2F',
grey_whisper: '#1C1E22',
icon_background: '#FFFFFF',
modal_shadow: '#000000',
overlay: '#FFFFFFCC', // CC = 80% opacity
shadow_icon: '#00000080', // 80 = 50% opacity
targetedMessageBackground: '#302D22',
transparent: 'transparent',
white: '#101418',
white_smoke: '#13151B',
white_snow: '#070A0D',
}
accent_blue: '#005FFF',
accent_green: '#20E070',
accent_red: '#FF3742',
bg_gradient_end: '#101214',
bg_gradient_start: '#070A0D',
black: '#FFFFFF',
blue_alice: '#00193D',
border: '#141924',
grey: '#7A7A7A',
grey_dark: '#F7F7F8',
grey_gainsboro: '#2D2F2F',
grey_whisper: '#1C1E22',
icon_background: '#FFFFFF',
modal_shadow: '#000000',
overlay: '#FFFFFFCC', // CC = 80% opacity
shadow_icon: '#00000080', // 80 = 50% opacity
targetedMessageBackground: '#302D22',
transparent: 'transparent',
white: '#101418',
white_smoke: '#13151B',
white_snow: '#070A0D',
}
: {
accent_blue: '#005FFF',
accent_green: '#20E070',
accent_red: '#FF3742',
bg_gradient_end: '#F7F7F7',
bg_gradient_start: '#FCFCFC',
black: '#000000',
blue_alice: '#E9F2FF',
border: '#00000014', // 14 = 8% opacity; top: x=0, y=-1; bottom: x=0, y=1
grey: '#7A7A7A',
grey_gainsboro: '#DBDBDB',
grey_whisper: '#ECEBEB',
icon_background: '#FFFFFF',
modal_shadow: '#00000099', // 99 = 60% opacity; x=0, y= 1, radius=4
overlay: '#00000099', // 99 = 60% opacity
shadow_icon: '#00000040', // 40 = 25% opacity; x=0, y=0, radius=4
targetedMessageBackground: '#FBF4DD', // dark mode = #302D22
transparent: 'transparent',
white: '#FFFFFF',
white_smoke: '#F2F2F2',
white_snow: '#FCFCFC',
},
accent_blue: '#005FFF',
accent_green: '#20E070',
accent_red: '#FF3742',
bg_gradient_end: '#F7F7F7',
bg_gradient_start: '#FCFCFC',
black: '#000000',
blue_alice: '#E9F2FF',
border: '#00000014', // 14 = 8% opacity; top: x=0, y=-1; bottom: x=0, y=1
grey: '#7A7A7A',
grey_dark: '#17191C',
grey_gainsboro: '#DBDBDB',
grey_whisper: '#ECEBEB',
icon_background: '#FFFFFF',
modal_shadow: '#00000099', // 99 = 60% opacity; x=0, y= 1, radius=4
overlay: '#00000099', // 99 = 60% opacity
shadow_icon: '#00000040', // 40 = 25% opacity; x=0, y=0, radius=4
targetedMessageBackground: '#FBF4DD', // dark mode = #302D22
transparent: 'transparent',
white: '#FFFFFF',
white_smoke: '#F2F2F2',
white_snow: '#FCFCFC',
},
spinner: {
height: 15,
width: 15,
Expand Down
1 change: 0 additions & 1 deletion examples/TypeScriptMessaging/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ const App = () => {
theme={{
colors: {
...(colorScheme === 'dark' ? DarkTheme : DefaultTheme).colors,
background: theme.colors?.white_snow || '#FCFCFC',
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed in TSMessagingApp. Since removing it will give us a fair idea about the component's default theme.

},
dark: colorScheme === 'dark',
}}
Expand Down
2 changes: 2 additions & 0 deletions examples/TypeScriptMessaging/useStreamChatTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const getChatStyle = (colorScheme: string): DeepPartial<Theme> => ({
blue_alice: '#00193D',
border: '#141924',
grey: '#7A7A7A',
grey_dark: '#F7F7F8',
grey_gainsboro: '#2D2F2F',
grey_whisper: '#1C1E22',
icon_background: '#FFFFFF',
Expand All @@ -43,6 +44,7 @@ const getChatStyle = (colorScheme: string): DeepPartial<Theme> => ({
blue_alice: '#E9F2FF',
border: '#00000014', // 14 = 8% opacity; top: x=0, y=-1; bottom: x=0, y=1
grey: '#7A7A7A',
grey_dark: '#17191C',
grey_gainsboro: '#DBDBDB',
grey_whisper: '#ECEBEB',
icon_background: '#FFFFFF',
Expand Down
6 changes: 3 additions & 3 deletions package/src/components/Indicators/LoadingIndicator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ const styles = StyleSheet.create({
const LoadingIndicatorWrapper: React.FC<{ text: string }> = ({ text }) => {
const {
theme: {
colors: { black },
colors: { black, white_snow },
loadingIndicator: { container, loadingText },
},
} = useTheme();

return (
<View style={[styles.container, container]}>
<Spinner />
<View style={[styles.container, { backgroundColor: white_snow }, container]}>
<Spinner height={20} width={20} />
Copy link
Copy Markdown
Member

@santhoshvai santhoshvai Apr 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<Spinner height={20} width={20} /> is better as <Spinner />

Looking at this, it seems like the spinner component itself is bad to me.. the style by default has height and width of 16, but the icon doesnt have.. so its easier if we pass a default of 16 to the icon when no prop is passed and as a long term view, better

<Text style={[styles.loadingText, { color: black }, loadingText]} testID='loading'>
{text}
</Text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const SendMessageDisallowedIndicator = () => {
const { t } = useTranslationContext();
const {
theme: {
colors: { border, grey_dark },
colors: { border, grey_dark, white },
messageInput: {
sendMessageDisallowedIndicator: { container, text },
},
Expand All @@ -33,6 +33,7 @@ export const SendMessageDisallowedIndicator = () => {
style={[
styles.container,
{
backgroundColor: white,
borderTopColor: border,
height: 50,
},
Expand Down
26 changes: 15 additions & 11 deletions package/src/components/MessageList/MessageList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1072,7 +1072,11 @@ const MessageListWithContext = <
const renderListEmptyComponent = useCallback(
() => (
<View
style={[styles.flex, shouldApplyAndroidWorkaround ? styles.invertAndroid : styles.invert]}
style={[
styles.flex,
{ backgroundColor: white_snow },
shouldApplyAndroidWorkaround ? styles.invertAndroid : styles.invert,
]}
testID='empty-state'
>
<EmptyStateIndicator listType='message' />
Expand All @@ -1099,16 +1103,6 @@ const MessageListWithContext = <
[shouldApplyAndroidWorkaround, HeaderComponent],
);

if (!FlatList) return null;

if (loading) {
return (
<View style={styles.flex}>
<LoadingIndicator listType='message' />
</View>
);
}

const StickyHeaderComponent = () => {
if (!stickyHeaderDateString) return null;
if (StickyHeader) return <StickyHeader dateString={stickyHeaderDateString} />;
Expand All @@ -1127,6 +1121,16 @@ const MessageListWithContext = <
additionalFlatListPropsExcludingStyle = rest;
}

if (!FlatList) return null;

if (loading) {
return (
<View style={[styles.container, { backgroundColor: white_snow }, container]}>
<LoadingIndicator listType='message' />
</View>
);
}

return (
<View
style={[styles.container, { backgroundColor: white_snow }, container]}
Expand Down