1- import { View } from 'react-native' ;
1+ import { type JSX } from 'react' ;
2+ import { ScrollView , View } from 'react-native' ;
23
34import MessageContext from '../message/Context' ;
45import { UiKitMessage } from '.' ;
@@ -9,7 +10,7 @@ import {
910 BASE_ROW_HEIGHT_CONDENSED ,
1011 ResponsiveLayoutContext
1112} from '../../lib/hooks/useResponsiveLayout/useResponsiveLayout' ;
12- import { ThemeContext } from '../../theme' ;
13+ import { ThemeContext , type TSupportedThemes } from '../../theme' ;
1314
1415const user = {
1516 id : 'y8bd77ptZswPj3EW8' ,
@@ -18,41 +19,38 @@ const user = {
1819} ;
1920
2021const baseUrl = 'https://open.rocket.chat' ;
21- const theme = 'dark' ;
2222
2323export default {
2424 title : 'UIKit/UiKitMessage' ,
2525 decorators : [
2626 ( Story : any ) => (
27- < ThemeContext . Provider value = { { theme, colors : colors [ theme ] } } >
28- < ResponsiveLayoutContext . Provider
27+ < ResponsiveLayoutContext . Provider
28+ value = { {
29+ fontScale : 1 ,
30+ fontScaleLimited : 1 ,
31+ isLargeFontScale : false ,
32+ rowHeight : BASE_ROW_HEIGHT ,
33+ rowHeightCondensed : BASE_ROW_HEIGHT_CONDENSED ,
34+ width : 350 ,
35+ height : 800
36+ } } >
37+ < MessageContext . Provider
2938 value = { {
30- fontScale : 1 ,
31- fontScaleLimited : 1 ,
32- isLargeFontScale : false ,
33- rowHeight : BASE_ROW_HEIGHT ,
34- rowHeightCondensed : BASE_ROW_HEIGHT_CONDENSED ,
35- width : 350 ,
36- height : 800
39+ user,
40+ baseUrl,
41+ onPress : ( ) => { } ,
42+ onLongPress : ( ) => { } ,
43+ reactionInit : ( ) => { } ,
44+ onErrorPress : ( ) => { } ,
45+ replyBroadcast : ( ) => { } ,
46+ onReactionPress : ( ) => { } ,
47+ onDiscussionPress : ( ) => { } ,
48+ onReactionLongPress : ( ) => { } ,
49+ threadBadgeColor : themes . light . fontInfo
3750 } } >
38- < MessageContext . Provider
39- value = { {
40- user,
41- baseUrl,
42- onPress : ( ) => { } ,
43- onLongPress : ( ) => { } ,
44- reactionInit : ( ) => { } ,
45- onErrorPress : ( ) => { } ,
46- replyBroadcast : ( ) => { } ,
47- onReactionPress : ( ) => { } ,
48- onDiscussionPress : ( ) => { } ,
49- onReactionLongPress : ( ) => { } ,
50- threadBadgeColor : themes . light . fontInfo
51- } } >
52- < Story />
53- </ MessageContext . Provider >
54- </ ResponsiveLayoutContext . Provider >
55- </ ThemeContext . Provider >
51+ < Story />
52+ </ MessageContext . Provider >
53+ </ ResponsiveLayoutContext . Provider >
5654 )
5755 ]
5856} ;
@@ -560,8 +558,14 @@ const getInfoCardAction = ({
560558 }
561559} ) ;
562560
563- export const InfoCard = ( ) => (
564- < View style = { { padding : 10 , gap : 10 } } >
561+ const ThemedStory = ( { theme, story } : { theme : TSupportedThemes ; story : ( ) => JSX . Element } ) => (
562+ < ThemeContext . Provider value = { { theme, colors : colors [ theme ] } } >
563+ < View style = { { padding : 10 , gap : 10 , backgroundColor : colors [ theme ] . surfaceTint } } > { story ( ) } </ View >
564+ </ ThemeContext . Provider >
565+ ) ;
566+
567+ const ThemedStoryInfoCardList = ( ) => (
568+ < >
565569 { UiKitMessage ( [
566570 {
567571 type : 'info_card' ,
@@ -636,9 +640,17 @@ export const InfoCard = () => (
636640 ]
637641 }
638642 ] ) }
639- </ View >
643+ </ >
640644) ;
641- InfoCard . storyName = 'Info Card' ;
645+ export const InfoCard = ( ) => (
646+ < ScrollView >
647+ < ThemedStory theme = { 'light' } story = { ThemedStoryInfoCardList } />
648+ < ThemedStory theme = { 'dark' } story = { ThemedStoryInfoCardList } />
649+ < ThemedStory theme = { 'black' } story = { ThemedStoryInfoCardList } />
650+ </ ScrollView >
651+ ) ;
652+
653+ InfoCard . storyName = 'UIKit/UiKitMessage/Info Card' ;
642654
643655export const InfoCardIcons = ( ) =>
644656 UiKitMessage ( [
0 commit comments