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

@mapples/app

v1.0.1

Published

A React Native component library that provides the core Mapples ecosystem functionality. This package includes the main MapplesApp component and utility functions for asset management and font loading.

Downloads

16

Readme

@mapples/app

A React Native component library that provides the core Mapples ecosystem functionality. This package includes the main MapplesApp component and utility functions for asset management and font loading.

Features

  • 🚀 Core Mapples Integration: Main entry point for the Mapples ecosystem
  • 📱 Font Loading: Automatic font loading with expo-font integration
  • 🎨 Style Provider: Built-in styling system integration
  • 🧩 Render Provider: Dynamic component rendering capabilities
  • 📦 Asset Management: Utility functions for processing Mapples asset references
  • 🔧 TypeScript Support: Full TypeScript support with comprehensive type definitions
  • ⚛️ React Integration: Seamless integration with React Native applications

Installation

npm install @mapples/app
# or
yarn add @mapples/app

Usage

Basic Setup

Wrap your app with the MapplesApp component to enable the Mapples ecosystem:

import React from 'react';
import MapplesApp from '@mapples/app';

function App() {
  return (
    <MapplesApp>
      {/* Your app components */}
    </MapplesApp>
  );
}

export default App;

With Custom Configuration

import React from 'react';
import MapplesApp from '@mapples/app';

function App() {
  return (
    <MapplesApp
      showFontLoadingIndicator={true}
      FontLoadingIndicator={<LoadingSpinner />}
    >
      {/* Your app components */}
    </MapplesApp>
  );
}

export default App;

With Custom Assets and Styles

import React from 'react';
import MapplesApp from '@mapples/app';

const customAssets = {
  'ref(font:123:CustomFont.ttf)': require('./fonts/CustomFont.ttf'),
  'ref(image:456:logo.png)': require('./images/logo.png'),
};

const customStyle = {
  // Your custom style configuration
};

function App() {
  return (
    <MapplesApp
      assets={customAssets}
      style={customStyle}
    >
      {/* Your app components */}
    </MapplesApp>
  );
}

export default App;

API Reference

MapplesApp

The main component that provides the core Mapples ecosystem functionality.

Props:

  • children - Child components
  • style? - Optional custom style configuration to override the default Mapples styling
  • assets? - Optional custom assets configuration to override the default Mapples assets
  • showFontLoadingIndicator? - Whether to show a loading indicator while fonts are loading
  • FontLoadingIndicator? - Custom loading indicator component to display while fonts are loading

Example:

<MapplesApp
  showFontLoadingIndicator={true}
  FontLoadingIndicator={<ActivityIndicator size="large" />}
>
  <YourAppContent />
</MapplesApp>

Utility Functions

normalizeKey(key)

Normalizes a reference key by extracting type, id, and name information.

Parameters:

  • key - The reference key to normalize, either in ref(type:id:name) format or a plain string

Returns:

  • An object containing the parsed type, id, and normalized name, or undefined if the key format is invalid

Example:

import { normalizeKey } from '@mapples/app';

const result = normalizeKey('ref(font:123:MyFont.ttf)');
// Returns: { type: 'font', id: '123', name: 'MyFont' }

remapFonts(assets)

Remaps font assets from the Mapples asset configuration format to a format compatible with expo-font.

Parameters:

  • assets - The assets configuration object containing font references

Returns:

  • A new object containing only the font assets in expo-font compatible format

Example:

import { remapFonts } from '@mapples/app';

const assets = {
  'ref(font:123:MyFont.ttf)': require('./fonts/MyFont.ttf'),
  'ref(image:456:logo.png)': require('./images/logo.png'),
};

const fonts = remapFonts(assets);
// Returns: { MyFont: require('./fonts/MyFont.ttf') }

Advanced Usage

Custom Font Loading

import React from 'react';
import MapplesApp, { remapFonts } from '@mapples/app';

const customAssets = {
  'ref(font:123:CustomFont.ttf)': require('./fonts/CustomFont.ttf'),
  'ref(font:124:AnotherFont.ttf)': require('./fonts/AnotherFont.ttf'),
};

function App() {
  return (
    <MapplesApp assets={customAssets}>
      <YourAppContent />
    </MapplesApp>
  );
}

Asset Processing

import { normalizeKey, remapFonts } from '@mapples/app';

// Process individual asset keys
const assetKey = 'ref(font:123:MyFont.ttf)';
const normalized = normalizeKey(assetKey);
console.log(normalized); // { type: 'font', id: '123', name: 'MyFont' }

// Process entire asset configuration
const assets = {
  'ref(font:123:MyFont.ttf)': require('./fonts/MyFont.ttf'),
  'ref(image:456:logo.png)': require('./images/logo.png'),
};

const fonts = remapFonts(assets);
console.log(fonts); // { MyFont: require('./fonts/MyFont.ttf') }

Integration with Other Mapples Packages

The MapplesApp component automatically integrates with other Mapples packages:

import React from 'react';
import MapplesApp from '@mapples/app';
import { useForm } from '@mapples/form';
import { useDnD } from '@mapples/dnd';

function App() {
  return (
    <MapplesApp>
      <FormExample />
      <DnDExample />
    </MapplesApp>
  );
}

function FormExample() {
  const form = useForm();
  // Form functionality is available
  return <div>Form content</div>;
}

function DnDExample() {
  const { isDragging } = useDnD();
  // Drag and drop functionality is available
  return <div>DnD content</div>;
}

TypeScript Support

This package is written in TypeScript and provides full type safety. All APIs are documented with TSDoc comments for excellent IDE support and IntelliSense.

Type Definitions

interface MapplesAppProps {
  style?: StyleContextType;
  assets?: AnyObject;
  showFontLoadingIndicator?: boolean;
  FontLoadingIndicator?: JSX.Element;
}

Best Practices

  1. Always wrap your app: Use MapplesApp as the root component to ensure all Mapples functionality is available

  2. Font loading: Consider using showFontLoadingIndicator for better user experience during font loading

  3. Asset organization: Keep your asset references organized and use the utility functions for processing

  4. Performance: The component handles font loading efficiently and only re-renders when necessary

  5. Testing: Test your app with different asset configurations to ensure proper loading

Metro Configuration

This package requires Metro configuration to work properly with Expo applications. Update your metro.config.js:

const { getDefaultConfig } = require('expo/metro-config');
const { mapplesResolver } = require('@mapples/app/expo');

module.exports = (() => {
  const config = getDefaultConfig(__dirname);

  const { transformer, resolver } = config;

  config.transformer = {
    ...transformer,
    babelTransformerPath: require.resolve('react-native-svg-transformer/expo'),
  };
  config.resolver = {
    ...resolver,
    assetExts: resolver.assetExts.filter((ext) => ext !== 'svg'),
    sourceExts: [...resolver.sourceExts, 'svg'],
  };

  config.resolver.resolveRequest = mapplesResolver(
    (context, moduleName, platform) => {
      // add your custom resolvers here
      return context.resolveRequest(context, moduleName, platform);
    },
  );

  return config;
})();

Dependencies

Make sure you have the required dependencies installed:

npm install react-native-svg react-native-svg-transformer
# or
yarn add react-native-svg react-native-svg-transformer

For more information about SVG transformation, see the react-native-svg-transformer documentation.

Development

Building the Package

npm run build

Type Checking

npm run type-check

Linting

npm run lint

Contributing

Contributions are welcome! Please ensure that:

  1. All new APIs include comprehensive TSDoc documentation
  2. TypeScript types are properly defined
  3. Tests are added for new functionality
  4. The README is updated for any new features

License

MIT License - see LICENSE file for details.

Author

Oleksandr Soloviov - mapples.org