[FIX] HashTag markdown not working on stories (#4357)

* [FIX] Storybook Markdown Hashtag

* Fix storyshot
This commit is contained in:
Reinaldo Neto 2022-07-14 15:30:15 -03:00 committed by GitHub
parent 92d16b52e1
commit 90c1b0a97f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 61 additions and 23 deletions

View File

@ -0,0 +1,32 @@
import React from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import { themes } from '../app/lib/constants';
/**
* https://davidl.fr/blog/react-navigation-object-storybook
* Helper component tor create a Dummy Stack to access {navigation} object on *.story.tsx files
*
* @usage add this decorator
* ```
* .addDecorator(NavigationDecorator)
* ```
*/
const StoryBookStack = createStackNavigator();
export const NavigationDecorator = (story: any) => {
const Screen = () => story();
return (
<NavigationContainer independent={true}>
<StoryBookStack.Navigator>
<StoryBookStack.Screen
name='StorybookNavigator'
component={Screen}
options={{ header: () => null, cardStyle: { backgroundColor: themes.light.backgroundColor } }}
/>
</StoryBookStack.Navigator>
</NavigationContainer>
);
};

View File

@ -7,6 +7,7 @@ import Markdown, { MarkdownPreview } from '../../app/containers/markdown';
import { themes } from '../../app/lib/constants'; import { themes } from '../../app/lib/constants';
import { TGetCustomEmoji, IEmoji } from '../../app/definitions/IEmoji'; import { TGetCustomEmoji, IEmoji } from '../../app/definitions/IEmoji';
import { store } from '.'; import { store } from '.';
import { NavigationDecorator } from '../StoryNavigator';
const theme = 'light'; const theme = 'light';
@ -44,7 +45,9 @@ const getCustomEmoji: TGetCustomEmoji = content => {
return customEmoji; return customEmoji;
}; };
const stories = storiesOf('Markdown', module).addDecorator(story => <Provider store={store}>{story()}</Provider>); const stories = storiesOf('Markdown', module)
.addDecorator(story => <Provider store={store}>{story()}</Provider>)
.addDecorator(NavigationDecorator);
stories.add('Text', () => ( stories.add('Text', () => (
<View style={styles.container}> <View style={styles.container}>

View File

@ -7,9 +7,12 @@ import { Provider } from 'react-redux';
import NewMarkdown from '../../app/containers/markdown/new'; import NewMarkdown from '../../app/containers/markdown/new';
import { themes } from '../../app/lib/constants'; import { themes } from '../../app/lib/constants';
import { longText } from '../utils'; import { longText } from '../utils';
import { NavigationDecorator } from '../StoryNavigator';
import { store } from './index'; import { store } from './index';
const stories = storiesOf('NewMarkdown', module).addDecorator(story => <Provider store={store}>{story()}</Provider>); const stories = storiesOf('NewMarkdown', module)
.addDecorator(story => <Provider store={store}>{story()}</Provider>)
.addDecorator(NavigationDecorator);
const theme = 'light'; const theme = 'light';

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long