Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@react-querybuilder/native

Package Overview
Dependencies
Maintainers
0
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-querybuilder/native

React Native components for react-querybuilder

  • 8.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
90
decreased by-41.18%
Maintainers
0
Weekly downloads
 
Created
Source

@react-querybuilder/native

Official react-querybuilder compatibility package for React Native.

Installation

npm i react-querybuilder @react-querybuilder/native
# OR yarn add / pnpm add / bun add

Usage

To render a React Native-compatible query builder, use QueryBuilderNative.

import { QueryBuilderNative } from '@react-querybuilder/native';
import { useState } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { type Field, formatQuery, type RuleGroupType } from 'react-querybuilder';

const styles = StyleSheet.create({
  outer: { padding: 10, gap: 20 },
  code: { fontFamily: 'monospace' },
});

const fields: Field[] = [
  { name: 'firstName', label: 'First Name' },
  { name: 'lastName', label: 'Last Name' },
];

export function App() {
  const [query, setQuery] = useState<RuleGroupType>({ combinator: 'and', rules: [] });

  return (
    <View style={styles.outer}>
      <QueryBuilderNative fields={fields} query={query} onQueryChange={setQuery} />
      <Text style={styles.code}>{formatQuery(query, 'sql')}</Text>
    </View>
  );
}

QueryBuilderNative accepts the same props QueryBuilder and assigns the following props by default.

ExportQueryBuilder prop
defaultNativeControlElementscontrolElements
NativeActionElementcontrolElements.actionElement
NativeInlineCombinatorcontrolElements.inlineCombinator
NativeNotTogglecontrolElements.notToggle
NativeShiftActionscontrolElements.shiftActions
NativeValueEditorcontrolElements.valueEditor
NativeValueSelectorcontrolElements.valueSelector
RuleGroupNativecontrolElements.ruleGroup
RuleNativecontrolElements.rule

For react-native-web, assign defaultNativeWebControlElements to controlElements as in the example above.

ExportQueryBuilder prop
defaultNativeWebControlElementscontrolElements
NativeValueEditorWebcontrolElements.valueEditor
NativeValueSelectorWebcontrolElements.valueSelector

Keywords

FAQs

Package last updated on 08 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc