npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

babel-plugin-react-native-feedback-wrapper

v1.0.0

Published

Babel plugin to automatically wrap React Native components with FeedbackTrackable for Galadrim Feedback

Readme

babel-plugin-react-native-feedback-wrapper

Babel plugin to automatically wrap React Native components with FeedbackTrackable for Galadrim Feedback integration.

What it does

This plugin automatically wraps the root JSX element of exported components with a FeedbackTrackable wrapper that enables click tracking for feedback collection. It only wraps top-level/exported components, not every component used within.

Before:

export function MyScreen() {
  return (
    <View>
      <Text>Hello World</Text>
      <TouchableOpacity onPress={handlePress}>
        <Text>Click me</Text>
      </TouchableOpacity>
    </View>
  );
}

export function AnotherScreen() {
  return (
    <View>
      <Text>Another</Text>
    </View>
  );
}

After:

import { FeedbackTrackable } from "galadrim-feedback-react-native";

export function MyScreen() {
  return (
    <FeedbackTrackable componentPath="screens/MyScreen.tsx:MyScreen">
      <View>
        <Text>Hello World</Text>
        <TouchableOpacity onPress={handlePress}>
          <Text>Click me</Text>
        </TouchableOpacity>
      </View>
    </FeedbackTrackable>
  );
}

export function AnotherScreen() {
  return (
    <FeedbackTrackable componentPath="screens/MyScreen.tsx:AnotherScreen:2">
      <View>
        <Text>Another</Text>
      </View>
    </FeedbackTrackable>
  );
}

Note: The counter (:2) is automatically added when multiple exported components exist in the same file.

Key Behavior:

  • ✅ Only wraps the root element of exported components
  • ✅ Nested components inside are not wrapped
  • ✅ Much cleaner output and better performance
  • ✅ Tracks at the component level, not element level
  • ✅ Auto-increments counter for multiple instances of same component

Component Path Format:

  • Single instance: screens/HomeScreen.tsx:HomeScreen
  • Multiple instances: screens/HomeScreen.tsx:HomeScreen:2, screens/HomeScreen.tsx:HomeScreen:3, etc.

Installation

npm install --save-dev babel-plugin-react-native-feedback-wrapper
# or
yarn add -D babel-plugin-react-native-feedback-wrapper

Usage

Basic Configuration

Add the plugin to your Babel configuration:

babel.config.js:

module.exports = {
  presets: ["module:metro-react-native-babel-preset"],
  plugins: ["babel-plugin-react-native-feedback-wrapper"],
};

Advanced Configuration

You can customize which components to wrap:

module.exports = {
  presets: ["module:metro-react-native-babel-preset"],
  plugins: [
    [
      "babel-plugin-react-native-feedback-wrapper",
      {
        // Specify which React Native components to wrap
        wrappableComponents: [
          "View",
          "Text",
          "ScrollView",
          "TouchableOpacity",
          "TouchableHighlight",
          "Pressable",
          "Image",
        ],
        // Set to false to only wrap specified RN components, not user components
        wrapUserComponents: true,
      },
    ],
  ],
};

Options

wrappableComponents (Array)

An array of React Native component names that should be wrapped.

Default:

[
  "View",
  "Text",
  "ScrollView",
  "TouchableOpacity",
  "TouchableHighlight",
  "Pressable",
  "Image",
  "FlatList",
  "SectionList",
];

wrapUserComponents (boolean)

Whether to wrap user-defined components (components starting with uppercase).

Default: true

Skipping Specific Components

To prevent a specific component from being wrapped, add the data-feedback-skip attribute:

<View data-feedback-skip>
  {/* This View and its children won't be tracked */}
  <Text>This won't be wrapped</Text>
</View>

How it Works

  1. The plugin traverses your JSX tree (skipping node_modules)
  2. Identifies components that match the wrapping criteria
  3. Automatically adds the FeedbackTrackable import if needed
  4. Wraps each matching component with <FeedbackTrackable componentPath="...">
  5. The componentPath includes the file path and component name for tracking

Automatically Skipped:

  • Files in node_modules (third-party packages)
  • FeedbackProvider and FeedbackRoot components
  • FeedbackTrackable components (avoids double-wrapping)
  • Components with data-feedback-skip attribute
  • Fragments (<Fragment> or <React.Fragment>)

Metro Configuration

For React Native projects using Metro bundler, make sure your metro.config.js is configured properly:

const { getDefaultConfig } = require("expo/metro-config");

const config = getDefaultConfig(__dirname);

module.exports = config;

Performance Considerations

  • The plugin only processes files during the build/transform phase
  • node_modules are automatically skipped for optimal performance
  • Wrapping adds minimal runtime overhead
  • Consider being selective with wrappableComponents for large apps
  • Nested components avoid redundant wrapping (children of wrapped components aren't wrapped again)

Compatibility

  • React Native: 0.60+
  • Babel: 7.0+
  • Expo: Compatible with Expo workflow

License

MIT