0.5.0 • Published 11 months ago

react-native-qa-menu v0.5.0

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

react-native-qa-menu

Helper menu for QAs to examine the apps during the development

Installation

npm install react-native-qa-menu

or yarn:

yarn add react-native-qa-menu

This library needs these dependencies to be installed in your project before you can use it:

yarn add @react-native-clipboard/clipboard react-native-device-info react-native-file-logger react-native-share

Example

import React, { useEffect, useRef } from 'react'
import { StyleSheet, Text, View } from 'react-native'
import { QaMenu, QaMenuRefMethods } from 'react-native-qa-menu'

export default function App() {
  const ref = useRef<QaMenuRefMethods>(null)

  useEffect(() => {
    console.log('This is a log message', {
      array: [1, 2, 3],
      bool: true,
      object: { foo: 'bar' },
    })
    console.log({
      array: [1, 2, 3],
      bool: true,
      object: { foo: 'bar' },
    })
    console.error(new Error('This is an error message'))
    console.warn('This is a warning message')
    console.info('This is an info message')
    console.debug('This is a debug message')
    console.log(`%c Log message with color`, 'color: rgb(118, 74, 188)', { foo: 'bar' })
  }, [])

  return (
    <QaMenu
      visible
      ref={ref}
      quickActions={[{ title: 'Logout', onPress: () => {}, closedOnPress: true }]}
      state={{
        array: [1, 2, 3],
        bool: true,
        object: { foo: 'bar' },
      }}
    >
      <View style={styles.customSection}>
        <Text>This is another section rendered as children prop</Text>
      </View>
    </QaMenu>
  )
}

const styles = StyleSheet.create({
  customSection: {
    marginTop: 24,
  },
})

Properties

PropTypeRequiredDefaultDescription
visiblebooleantrueWhether to show the menu or not
isCirclebooleanfalsetrueDisplay the draggable menu as circle
xnumberfalseScreen width - 75Position x of the draggable menu
ynumberfalseScreen height - 100Position y of the draggable menu
maxLogsCountnumberfalse100Maximum number of logs shown in app
logFiltersstring[]false[]Filter out unwanted logs
draggableDisplayTextstringfalse<app_version>Displaying text on the draggable menu
draggableSizenumberfalse50Draggable menu's size
quickActionsArray<{ title: string; onPress: () => void; closedOnPress?: boolean }>false[]Quick actions added to the menu
extraAppInfoArray<{ title: string; description: string }>false[]Extra app info added to the menu
stateanyfalseundefinedAny object that we'd like to display in the JSON tree Eg. redux store state, react navigation state, react-query's state
stylesobjectfalse{}Custom styles applied to the elements inside the QA menu
styles.headerTitleStyleTextStylefalseundefinedText style applied to the menu header's title
styles.sectionTitleStyleTextStylefalseundefinedText style applied to the section's title
styles.infoTitleStyleTextStylefalseundefinedText style applied to the app info's title
styles.infoDescriptionStyleTextStylefalseundefinedText style applied to the app info's description
styles.quickActionButtonStyleViewStylefalseundefinedView style applied to the quick action button
styles.quickActionButtonTitleStyleTextStylefalseundefinedText style applied to the quick action button's title
styles.logTimestampStyleTextStylefalseundefinedText style applied to the log's timestamp text
styles.logCopyButtonStyleViewStylefalseundefinedView style applied to the log's copy button
styles.logMessageStyleTextStylefalseundefinedText style applied to the log's message text
errorColorColorValuefalse"crimson"Color applied when error state
successColorColorValuefalse"forestgreen"Color applied for normal state
warningColorColorValuefalse"lightgoldenrodyellow"Color applied when warning state

Methods

FuncDescription
openOpen the menu's content modal
closeClose the menu's content modal

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


0.5.0

11 months ago

0.4.0

2 years ago

0.3.1

2 years ago

0.1.10

2 years ago

0.1.11

2 years ago

0.1.12

2 years ago

0.1.13

2 years ago

0.1.14

2 years ago

0.1.15

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.1.16

2 years ago

0.1.17

2 years ago

0.1.18

2 years ago

0.1.19

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago