summaryrefslogtreecommitdiff
path: root/storybook/storybook.tsx
blob: c48e3efa5cf27d183216e23e60b2f50b7ef4c089 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import React, { useEffect } from 'react'
import { getStorybookUI, configure } from '@storybook/react-native'
import { initFonts } from '../app/theme/fonts'

declare let module

configure(() => {
  require('./storybook-registry')
}, module)

const StorybookUI = getStorybookUI({
  port: 9001,
  host: 'localhost',
  onDeviceUI: true,
  asyncStorage:
    require('@react-native-async-storage/async-storage').default || null,
})

export function StorybookUIRoot() {
  useEffect(() => {
    ;(async () => {
      await initFonts() // expo only
      if (typeof __TEST__ === 'undefined' || !__TEST__) {
        const Reactotron = require('../app/services/reactotron')
        const reactotron = new Reactotron.Reactotron()
        reactotron.setup()
      }
    })()
  }, [])

  return <StorybookUI />
}