[FIX] HashTag markdown not working on stories (#4357)
* [FIX] Storybook Markdown Hashtag * Fix storyshot
This commit is contained in:
parent
92d16b52e1
commit
90c1b0a97f
|
@ -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>
|
||||
);
|
||||
};
|
|
@ -7,6 +7,7 @@ import Markdown, { MarkdownPreview } from '../../app/containers/markdown';
|
|||
import { themes } from '../../app/lib/constants';
|
||||
import { TGetCustomEmoji, IEmoji } from '../../app/definitions/IEmoji';
|
||||
import { store } from '.';
|
||||
import { NavigationDecorator } from '../StoryNavigator';
|
||||
|
||||
const theme = 'light';
|
||||
|
||||
|
@ -44,7 +45,9 @@ const getCustomEmoji: TGetCustomEmoji = content => {
|
|||
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', () => (
|
||||
<View style={styles.container}>
|
||||
|
|
|
@ -7,9 +7,12 @@ import { Provider } from 'react-redux';
|
|||
import NewMarkdown from '../../app/containers/markdown/new';
|
||||
import { themes } from '../../app/lib/constants';
|
||||
import { longText } from '../utils';
|
||||
import { NavigationDecorator } from '../StoryNavigator';
|
||||
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';
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue