11import type { AddonStore , API } from 'storybook/manager-api' ;
2- import { StyleSheet , Text , View } from 'react-native' ;
2+ import { View } from 'react-native' ;
33import { useCallback } from 'react' ;
44import { UPDATE_GLOBALS } from 'storybook/internal/core-events' ;
5+ import { styled } from '@storybook/react-native-theming' ;
56
67import Swatch from './Swatch' ;
78import { PARAM_KEY } from './constants' ;
@@ -28,18 +29,40 @@ const preview: Preview = {
2829export default preview;
2930` . trim ( ) ;
3031
32+ const ThemedText = styled . Text ( ( { theme } ) => ( {
33+ color : theme . color . defaultText ,
34+ } ) ) ;
35+
36+ const TitleText = styled . Text ( ( { theme } ) => ( {
37+ color : theme . color . defaultText ,
38+ fontSize : 16 ,
39+ marginBottom : 8 ,
40+ } ) ) ;
41+
42+ const ParagraphText = styled . Text ( ( { theme } ) => ( {
43+ color : theme . color . defaultText ,
44+ marginBottom : 8 ,
45+ } ) ) ;
46+
47+ const LockedText = styled . Text ( ( { theme } ) => ( {
48+ color : theme . color . defaultText ,
49+ marginBottom : 10 ,
50+ fontStyle : 'italic' ,
51+ opacity : 0.7 ,
52+ } ) ) ;
53+
3154const Instructions = ( ) => (
3255 < View >
33- < Text style = { [ styles . paragraph , styles . title ] } > Setup Instructions</ Text >
34- < Text style = { styles . paragraph } >
56+ < TitleText > Setup Instructions</ TitleText >
57+ < ParagraphText >
3558 Add background options to your preview parameters. Each option should include a name and the
3659 corresponding color value.
37- </ Text >
38- < Text style = { styles . paragraph } >
60+ </ ParagraphText >
61+ < ParagraphText >
3962 Below is an example of how to configure backgrounds in your preview config. Long press the
4063 example to copy it.
41- </ Text >
42- < Text selectable > { codeSample } </ Text >
64+ </ ParagraphText >
65+ < ThemedText selectable > { codeSample } </ ThemedText >
4366 </ View >
4467) ;
4568
@@ -82,7 +105,7 @@ const BackgroundPanel = ({ active, api, channel }: BackgroundPanelProps) => {
82105 if ( options && Object . keys ( options ) . length > 0 ) {
83106 return (
84107 < View style = { { padding : 10 } } >
85- { isLocked && < Text style = { styles . lockedText } > Background is set at the story level</ Text > }
108+ { isLocked && < LockedText > Background is set at the story level</ LockedText > }
86109 { Object . entries ( options ) . map ( ( [ key , { name, value } ] ) => (
87110 < View key = { `${ key } ${ value } ` } >
88111 < Swatch
@@ -105,9 +128,3 @@ const BackgroundPanel = ({ active, api, channel }: BackgroundPanelProps) => {
105128} ;
106129
107130export default BackgroundPanel ;
108-
109- const styles = StyleSheet . create ( {
110- title : { fontSize : 16 } ,
111- paragraph : { marginBottom : 8 } ,
112- lockedText : { marginBottom : 10 , fontStyle : 'italic' , opacity : 0.7 } ,
113- } ) ;
0 commit comments