@hero-design/rn 8.141.0 → 8.141.2-expo-snack
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/assets/fonts/hero-icons-mobile.ttf +0 -0
- package/jest.config.js +1 -1
- package/lib/assets/fonts/hero-icons-mobile.ttf +0 -0
- package/lib/index.js +118 -24
- package/package.json +2 -3
- package/package.json.bak +118 -0
- package/rollup.config.mjs +6 -11
- package/scripts/publish-expo-snack.js +110 -0
- package/src/components/Slider/RangeSlider.tsx +10 -1
- package/src/components/Slider/SingleSlider.tsx +11 -2
- package/src/utils/loadNativeComponent.tsx +49 -0
- package/types/components/TextInput/index.d.ts +1 -1
- package/types/utils/loadNativeComponent.d.ts +13 -0
- package/es/index.js +0 -43849
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Platform, Text, View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
type NativeModule<P> = React.ComponentType<P> | { default?: unknown };
|
|
5
|
+
|
|
6
|
+
// Function/class components, or exotic ones such as memo/forwardRef (objects with `$$typeof`)
|
|
7
|
+
const isComponent = (value: unknown): boolean =>
|
|
8
|
+
typeof value === 'function' ||
|
|
9
|
+
(typeof value === 'object' && value !== null && '$$typeof' in value);
|
|
10
|
+
|
|
11
|
+
const getLinkingError = (packageName: string) =>
|
|
12
|
+
`The package '${packageName}' doesn't seem to be linked. Make sure: \n\n${Platform.select(
|
|
13
|
+
{ ios: `- You have run 'pod install'\n`, default: '' }
|
|
14
|
+
)}- You rebuilt the app after installing the package\n`;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Loads a component from a package that needs native linking.
|
|
18
|
+
* When the package can't be loaded (e.g. in Expo Snack), returns a component
|
|
19
|
+
* that renders a linking error instead of crashing the whole library.
|
|
20
|
+
*
|
|
21
|
+
* `load` must contain a literal `require('<packageName>')` so Metro can resolve it statically.
|
|
22
|
+
*/
|
|
23
|
+
const loadNativeComponent = <P,>(
|
|
24
|
+
packageName: string,
|
|
25
|
+
load: () => NativeModule<P>
|
|
26
|
+
): React.ComponentType<P> => {
|
|
27
|
+
try {
|
|
28
|
+
const nativeModule = load();
|
|
29
|
+
// Depending on the bundler's interop, the component is either `default` or the module itself
|
|
30
|
+
const { default: defaultExport } = nativeModule as { default?: unknown };
|
|
31
|
+
const component = isComponent(defaultExport) ? defaultExport : nativeModule;
|
|
32
|
+
|
|
33
|
+
if (isComponent(component)) {
|
|
34
|
+
return component as React.ComponentType<P>;
|
|
35
|
+
}
|
|
36
|
+
} catch {
|
|
37
|
+
// package not linked, fall through to the linking error component
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const LinkingError = () => (
|
|
41
|
+
<View>
|
|
42
|
+
<Text>{getLinkingError(packageName)}</Text>
|
|
43
|
+
</View>
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
return LinkingError;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export default loadNativeComponent;
|
|
@@ -134,7 +134,7 @@ export declare const renderSuffix: ({ state, loading, suffix, }: {
|
|
|
134
134
|
state: State;
|
|
135
135
|
loading: boolean;
|
|
136
136
|
suffix?: IconName | React.ReactElement;
|
|
137
|
-
}) => "number" | "search" | "bold" | "filter" | "swag" | "wallet" |
|
|
137
|
+
}) => "number" | "search" | "bold" | "filter" | React.JSX.Element | "swag" | "wallet" | "menu" | "image" | "switch" | "warning" | "list" | "directory" | "document" | "feed" | "italic" | "activate" | "add-emoji" | "add-person" | "adjustment" | "alignment" | "antenna" | "archive" | "assignment-warning" | "bank" | "bell" | "billing" | "bolt" | "bookmark-added" | "bookmark-checked" | "bookmark" | "box-check" | "box" | "bpay" | "buildings" | "cake" | "calendar-clock" | "calendar" | "candy-box-menu" | "caret-down-small" | "caret-down" | "caret-left-small" | "caret-left" | "caret-right-small" | "caret-right" | "caret-up-small" | "caret-up" | "check-radio" | "circle-add" | "circle-cancel" | "circle-check" | "circle-down" | "circle-info" | "circle-left" | "circle-ok" | "circle-pencil" | "circle-question" | "circle-remove" | "circle-right" | "circle-up" | "circle-warning" | "clock-3" | "clock" | "cloud-download" | "cloud-upload" | "cog" | "coin" | "contacts" | "credit-card" | "diamond" | "direction-arrows" | "dollar-coin-shine" | "dot" | "double-buildings" | "edit-template" | "envelope" | "exclude" | "expand-content" | "expense" | "explore_nearby" | "eye-circle" | "eye-invisible" | "eye" | "face-meh" | "face-sad" | "face-smiley" | "feedbacks" | "file-certified" | "file-clone" | "file-copy" | "file-csv" | "file-dispose" | "file-doc" | "file-excel" | "file-export" | "file-lock" | "file-pdf" | "file-powerpoint" | "file-search" | "file-secured" | "file-sheets" | "file-slide" | "file-verified" | "file-word" | "file" | "folder-user" | "folder" | "format-bold" | "format-heading1" | "format-heading2" | "format-italic" | "format-list-bulleted" | "format-list-numbered" | "format-underlined" | "funnel-filter" | "global-dollar" | "global-pound" | "globe" | "graduation-cap" | "graph" | "happy-sun" | "health-bag" | "heart" | "hero-points" | "home" | "import" | "incident-siren" | "instapay-daily" | "instapay-now" | "instapay" | "loading-2" | "loading" | "location-on" | "location" | "lock" | "looks-one" | "looks-two" | "media-content" | "money-notes" | "moneybag" | "moon" | "multiple-stars" | "multiple-users" | "near-me" | "node" | "open-folder" | "paperclip-vertical" | "paperclip" | "payment-summary" | "pencil" | "phone" | "piggy-bank" | "plane-up" | "plane" | "play-arrow" | "play-circle" | "pound-coin-shine" | "pound-sign" | "print" | "raising-hands" | "reply-arrow" | "reply" | "reschedule" | "rocket-launch" | "rostering" | "salary-sacrifice" | "save" | "schedule-send" | "schedule" | "search-person" | "send" | "speaker" | "star-award" | "star-badge" | "star-circle" | "star-medal" | "star" | "steps-circle" | "stopwatch" | "suitcase" | "surfing" | "survey" | "swag-pillar-benefit" | "swag-pillar-career" | "swag-pillar-money" | "swag-pillar-work" | "swipe-right" | "tag" | "target" | "teams" | "thumb-down" | "thumb-up" | "timesheet" | "touch-id" | "trash-bin" | "unlock" | "user" | "video-1" | "video-2" | "academic-hat-outlined" | "accommodation-outlined" | "activate-outlined" | "add-credit-card-outlined" | "add-emoji-outlined" | "add-person-outlined" | "add-section-outlined" | "add-time-outlined" | "add" | "adjustment-outlined" | "afternoon-outlined" | "ai-outlined" | "alignment-2-outlined" | "alignment-outlined" | "all-caps" | "application-outlined" | "archive-outlined" | "arrow-down" | "arrow-downwards" | "arrow-left" | "arrow-leftwards" | "arrow-right" | "arrow-rightwards" | "arrow-up" | "arrow-upwards" | "article-outlined" | "assignment-warning-outlined" | "at-sign" | "auto-graph-outlined" | "automotive-outlined" | "bakery-outlined" | "bank-outlined" | "bar-outlined" | "beauty-outlined" | "beer-outlined" | "bell-outlined" | "bell-slash-outlined" | "bill-management-outlined" | "billing-outlined" | "body-outlined" | "bolt-outlined" | "book-outlined" | "bookmark-added-outlined" | "bookmark-checked-outlined" | "bookmark-outlined" | "box-1-outlined" | "box-check-outlined" | "box-outlined" | "bullet-points" | "cake-outlined" | "calculator-outlined" | "calendar-clock-outlined" | "calendar-dates-outlined" | "calendar-edit-outlined" | "calendar-outlined" | "calendar-star-outlined" | "call-outlined" | "call-split-outlined" | "camera-outlined" | "cancel" | "car-forward-outlined" | "cashback-outlined" | "charging-station-outlined" | "chat-bubble-outlined" | "chat-unread-outlined" | "checkmark" | "circle-add-outlined" | "circle-cancel-outlined" | "circle-check-outlined" | "circle-down-outlined" | "circle-info-outlined" | "circle-left-outlined" | "circle-ok-outlined" | "circle-question-outlined" | "circle-remove-outlined" | "circle-right-outlined" | "circle-up-outlined" | "circle-warning-outlined" | "clock-2-outlined" | "clock-3-outlined" | "clock-in-outlined" | "clock-out-outlined" | "clock-outlined" | "cloud-download-outlined" | "cog-outlined" | "coin-outlined" | "coin-super-outlined" | "comment-outlined" | "contacts-outlined" | "contacts-user-outlined" | "credit-card-outlined" | "cultural-site-outlined" | "cup-outlined" | "dentistry-outlined" | "diamond-outlined" | "direction-arrows-outlined" | "directory-outlined" | "document-outlined" | "dollar-box-outlined" | "dollar-card-outlined" | "dollar-coin-shine-outlined" | "dollar-credit-card-outlined" | "dollar-sign" | "double-buildings-outlined" | "double-left-arrows" | "double-right-arrows" | "download-box-outlined" | "download-outlined" | "edit-template-outlined" | "edit-user-outlined" | "electronics-outlined" | "email-outlined" | "end-break-outlined" | "enter-arrow" | "entertainment-outlined" | "envelope-outlined" | "evening-outlined" | "expense-approval-outlined" | "expense-outlined" | "explore-outlined" | "extension-outlined" | "external-link" | "eye-invisible-outlined" | "eye-outlined" | "face-id" | "face-meh-outlined" | "face-open-smiley-outlined" | "face-sad-outlined" | "face-smiley-outlined" | "fastfood-outlined" | "feed-outlined" | "feedbacks-outlined" | "file-certified-outlined" | "file-clone-outlined" | "file-copy-outlined" | "file-dispose-outlined" | "file-dollar-certified-outlined" | "file-dollar-outlined" | "file-download-outlined" | "file-export-outlined" | "file-lock-outlined" | "file-outlined" | "file-pound-outlined" | "file-search-outlined" | "file-secured-outlined" | "file-statutory-outlined" | "file-verified-outlined" | "filter-outlined" | "fitness-outlined" | "folder-outlined" | "folder-upload-outlined" | "folder-user-outlined" | "form-outlined" | "funnel-filter-outline" | "goal-outlined" | "graph-outlined" | "grocery-outlined" | "hand-holding-user-outlined" | "handshake-outlined" | "happy-sun-outlined" | "health-bag-outlined" | "heart-outlined" | "history-outlined" | "home-outlined" | "id-card-outlined" | "image-outlined" | "import-outlined" | "instapay-outlined" | "job-search-outlined" | "leave-approval-outlined" | "lighting-outlined" | "link-1" | "link-2" | "list-outlined" | "live-help-outlined" | "local_mall_outlined" | "location-on-outlined" | "location-outlined" | "lock-outlined" | "locked-file-outlined" | "log-out" | "mail-outlined" | "map-outlined" | "media-content-outlined" | "menu-close" | "menu-expand" | "menu-fold-outlined" | "menu-unfold-outlined" | "mic-outlined" | "mic-slash-outlined" | "mobile-outlined" | "moneybag-outlined" | "moon-outlined" | "more-horizontal" | "more-vertical" | "morning-outlined" | "multiple-folders-outlined" | "multiple-users-outlined" | "near-me-outlined" | "node-outlined" | "number-points" | "overview-outlined" | "park-outlined" | "payment-summary-outlined" | "payslip-outlined" | "pencil-outlined" | "percentage" | "phone-outlined" | "piggy-bank-outlined" | "plane-outlined" | "play-circle-outlined" | "pound-box-outlined" | "pound-card-outlined" | "pound-coin-shine-outlined" | "pound-credit-card-outlined" | "print-outlined" | "profile-2user-outlined" | "propane-tank-outlined" | "qr-code-outlined" | "qualification-outlined" | "question-mark" | "raising-hands-outlined" | "re-assign" | "redeem" | "refresh" | "remove" | "reply-outlined" | "restart" | "restaurant-outlined" | "resume-outlined" | "return-arrow" | "rocket-launch-outlined" | "rostering-outlined" | "safety-outlined" | "save-outlined" | "schedule-outlined" | "schedule-send-outlined" | "search-outlined" | "search-secured-outlined" | "send-outlined" | "share-1" | "share-2" | "share-outlined-2" | "share-outlined" | "shield-check-outlined" | "shop-outlined" | "shopping_basket_outlined" | "show-chart-outlined" | "single-down-arrow" | "single-left-arrow" | "single-right-arrow" | "single-up-arrow" | "smart-match-outlined" | "sparkle-2-outlined" | "sparkle-outlined" | "speaker-outlined" | "star-award-outlined" | "star-badge-outlined" | "star-circle-outlined" | "star-medal-outlined" | "star-outlined" | "start-break-outlined" | "stash-outlined" | "stop-outlined" | "stopwatch-outlined" | "strikethrough" | "styler-outlined" | "suitcase-clock-outlined" | "suitcase-outlined" | "survey-outlined" | "switch-outlined" | "sync" | "tablet-outlined" | "tag-outlined" | "target-outlined" | "teams-outlined" | "tennis-outlined" | "thumb-down-outlined" | "thumb-up-outlined" | "ticket-outlined" | "timesheet-outlined" | "timesheets-outlined" | "today-outlined" | "transfer" | "transportation-outlined" | "trash-bin-outlined" | "umbrela-outlined" | "unavailability-outlined" | "unavailable" | "underline" | "union-outlined" | "unlock-outlined" | "upload-outlined" | "user-add-outlined" | "user-circle-outlined" | "user-gear-outlined" | "user-out-outlined" | "user-outlined" | "user-rectangle-outlined" | "video-1-outlined" | "video-2-outlined" | "volunteer-outlined" | "wallet-outlined" | "warning-outlined" | "wellness-outlined" | undefined;
|
|
138
138
|
export declare const renderPrefix: ({ state, prefix, }: {
|
|
139
139
|
state: State;
|
|
140
140
|
prefix?: IconName | React.ReactElement;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type NativeModule<P> = React.ComponentType<P> | {
|
|
3
|
+
default?: unknown;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Loads a component from a package that needs native linking.
|
|
7
|
+
* When the package can't be loaded (e.g. in Expo Snack), returns a component
|
|
8
|
+
* that renders a linking error instead of crashing the whole library.
|
|
9
|
+
*
|
|
10
|
+
* `load` must contain a literal `require('<packageName>')` so Metro can resolve it statically.
|
|
11
|
+
*/
|
|
12
|
+
declare const loadNativeComponent: <P>(packageName: string, load: () => NativeModule<P>) => React.ComponentType<P>;
|
|
13
|
+
export default loadNativeComponent;
|