Skip to content

Export more utility hooks, component hooks, contexts, types, etc.. where possible #5360

@akinzalowevidation

Description

@akinzalowevidation

Description

We wrap most of the NativeBase components to add our own functionality and in some cases create our own NativeBase components from scratch. We've had success with this so far, despite some having to have some ugly imports such as:

import type { InterfaceBoxProps } from 'native-base/lib/typescript/components/primitives/Box';
import type { CustomProps } from 'native-base/lib/typescript/components/types';

This works fine for types, but not anything else.

Today we began making our first component from scratch that relied on interaction states. Upon further investigate we discovered that other NB components rely on hooks defined in Pressable (useHover, usePressed, etc..). These hooks do not appear to be exported, making it difficult to build our own components and attempt to follow NB component structure - most notably using usePropsResolution.

Problem Statement

Currently it is not fully possible to create some custom NativeBase-like components by exporting types, hooks, or other components from native-base. For users that create an internal component library that wraps native-base, this is an important requirement to have.

Proposed Solution or API

Export more (or all) types, utility functions (such as mergeRefs), utility hooks, component hooks, component contexts, etc.. out of native-base.

Alternatives

We could fork NativeBase, but our goal is not to add additional features or changes to NativeBase itself, but rather just utilize all existing features NativeBase has to build our own components in the same manner that NativeBase components are built.

It is also much easier in these cases where we are wrapping NativeBase to simply upgrade a NativeBase version over maintaining forked code.

Additional Information

If needed, I can offer some more use case examples.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions