@iternio/react-native-auto-play 0.3.11 → 0.4.0
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/README.md +103 -3
- package/ReactNativeAutoPlay.podspec +0 -4
- package/android/src/automotive/AndroidManifest.xml +1 -0
- package/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridAutoPlay.kt +91 -0
- package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/VoiceInputManager.kt +214 -0
- package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/template/MapTemplate.kt +2 -1
- package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/template/Parser.kt +117 -38
- package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/utils/BitmapCache.kt +14 -0
- package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/utils/SymbolFont.kt +29 -30
- package/ios/extensions/NitroImageExtensions.swift +10 -1
- package/ios/hybrid/HybridAutoPlay.swift +51 -4
- package/ios/templates/GridTemplate.swift +7 -0
- package/ios/templates/MapTemplate.swift +14 -0
- package/ios/templates/Parser.swift +91 -4
- package/ios/utils/SymbolFont.swift +44 -44
- package/ios/utils/VoiceInputManager.swift +233 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/specs/AutoPlay.nitro.d.ts +31 -1
- package/lib/types/Image.d.ts +46 -4
- package/lib/types/Maneuver.d.ts +2 -10
- package/lib/utils/NitroImage.d.ts +29 -3
- package/lib/utils/NitroImage.js +64 -3
- package/nitrogen/generated/android/ReactNativeAutoPlay+autolinking.cmake +1 -1
- package/nitrogen/generated/android/c++/JGlyphImage.hpp +6 -1
- package/nitrogen/generated/android/c++/JGridTemplateConfig.hpp +3 -1
- package/nitrogen/generated/android/c++/JHybridAutoPlaySpec.cpp +48 -1
- package/nitrogen/generated/android/c++/JHybridAutoPlaySpec.hpp +4 -0
- package/nitrogen/generated/android/c++/JHybridClusterSpec.cpp +4 -0
- package/nitrogen/generated/android/c++/JHybridGridTemplateSpec.cpp +5 -1
- package/nitrogen/generated/android/c++/JHybridInformationTemplateSpec.cpp +5 -1
- package/nitrogen/generated/android/c++/JHybridListTemplateSpec.cpp +5 -1
- package/nitrogen/generated/android/c++/JHybridMapTemplateSpec.cpp +5 -1
- package/nitrogen/generated/android/c++/JHybridMessageTemplateSpec.cpp +5 -1
- package/nitrogen/generated/android/c++/JHybridSearchTemplateSpec.cpp +5 -1
- package/nitrogen/generated/android/c++/JHybridSignInTemplateSpec.cpp +5 -1
- package/nitrogen/generated/android/c++/JImageLane.hpp +2 -0
- package/nitrogen/generated/android/c++/JInformationTemplateConfig.hpp +3 -1
- package/nitrogen/generated/android/c++/JLaneGuidance.hpp +2 -0
- package/nitrogen/generated/android/c++/JListTemplateConfig.hpp +3 -1
- package/nitrogen/generated/android/c++/JMapTemplateConfig.hpp +3 -1
- package/nitrogen/generated/android/c++/JMessageTemplateConfig.hpp +7 -5
- package/nitrogen/generated/android/c++/JNitroAction.hpp +7 -5
- package/nitrogen/generated/android/c++/JNitroAttributedString.hpp +2 -0
- package/nitrogen/generated/android/c++/JNitroAttributedStringImage.hpp +2 -0
- package/nitrogen/generated/android/c++/JNitroBaseMapTemplateConfig.hpp +3 -1
- package/nitrogen/generated/android/c++/JNitroGridButton.hpp +2 -0
- package/nitrogen/generated/android/c++/JNitroImage.cpp +6 -2
- package/nitrogen/generated/android/c++/JNitroImage.hpp +20 -3
- package/nitrogen/generated/android/c++/JNitroManeuver.hpp +3 -1
- package/nitrogen/generated/android/c++/JNitroMapButton.hpp +2 -0
- package/nitrogen/generated/android/c++/JNitroMessageManeuver.hpp +7 -5
- package/nitrogen/generated/android/c++/JNitroNavigationAlert.hpp +7 -5
- package/nitrogen/generated/android/c++/JNitroRoutingManeuver.hpp +7 -5
- package/nitrogen/generated/android/c++/JNitroRow.hpp +7 -5
- package/nitrogen/generated/android/c++/JNitroSection.hpp +3 -1
- package/nitrogen/generated/android/c++/JPreferredImageLane.hpp +2 -0
- package/nitrogen/generated/android/c++/JRemoteImage.hpp +68 -0
- package/nitrogen/generated/android/c++/JSearchTemplateConfig.hpp +3 -1
- package/nitrogen/generated/android/c++/JSignInTemplateConfig.hpp +3 -1
- package/nitrogen/generated/android/c++/JVariant_GlyphImage_AssetImage_RemoteImage.cpp +30 -0
- package/nitrogen/generated/android/c++/JVariant_GlyphImage_AssetImage_RemoteImage.hpp +92 -0
- package/nitrogen/generated/android/c++/JVariant_PreferredImageLane_ImageLane.hpp +3 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/GlyphImage.kt +5 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridAutoPlaySpec.kt +17 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/MessageTemplateConfig.kt +3 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroAction.kt +3 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroImage.kt +14 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroMessageManeuver.kt +2 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroNavigationAlert.kt +3 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroRoutingManeuver.kt +2 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroRow.kt +3 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/RemoteImage.kt +44 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/{Variant_GlyphImage_AssetImage.kt → Variant_GlyphImage_AssetImage_RemoteImage.kt} +20 -8
- package/nitrogen/generated/ios/ReactNativeAutoPlay-Swift-Cxx-Bridge.cpp +16 -8
- package/nitrogen/generated/ios/ReactNativeAutoPlay-Swift-Cxx-Bridge.hpp +156 -79
- package/nitrogen/generated/ios/ReactNativeAutoPlay-Swift-Cxx-Umbrella.hpp +4 -0
- package/nitrogen/generated/ios/c++/HybridAutoPlaySpecSwift.hpp +37 -0
- package/nitrogen/generated/ios/c++/HybridCarPlayDashboardSpecSwift.hpp +4 -1
- package/nitrogen/generated/ios/c++/HybridClusterSpecSwift.hpp +3 -0
- package/nitrogen/generated/ios/c++/HybridGridTemplateSpecSwift.hpp +3 -0
- package/nitrogen/generated/ios/c++/HybridInformationTemplateSpecSwift.hpp +3 -0
- package/nitrogen/generated/ios/c++/HybridListTemplateSpecSwift.hpp +3 -0
- package/nitrogen/generated/ios/c++/HybridMapTemplateSpecSwift.hpp +3 -0
- package/nitrogen/generated/ios/c++/HybridMessageTemplateSpecSwift.hpp +3 -0
- package/nitrogen/generated/ios/c++/HybridSearchTemplateSpecSwift.hpp +3 -0
- package/nitrogen/generated/ios/swift/Func_void_std__shared_ptr_ArrayBuffer_.swift +46 -0
- package/nitrogen/generated/ios/swift/GlyphImage.swift +7 -2
- package/nitrogen/generated/ios/swift/HybridAutoPlaySpec.swift +4 -0
- package/nitrogen/generated/ios/swift/HybridAutoPlaySpec_cxx.swift +82 -0
- package/nitrogen/generated/ios/swift/ImageLane.swift +9 -4
- package/nitrogen/generated/ios/swift/MessageTemplateConfig.swift +16 -11
- package/nitrogen/generated/ios/swift/NitroAction.swift +16 -11
- package/nitrogen/generated/ios/swift/NitroAttributedStringImage.swift +9 -4
- package/nitrogen/generated/ios/swift/NitroCarPlayDashboardButton.swift +9 -4
- package/nitrogen/generated/ios/swift/NitroGridButton.swift +9 -4
- package/nitrogen/generated/ios/swift/NitroImage.swift +2 -1
- package/nitrogen/generated/ios/swift/NitroMapButton.swift +9 -4
- package/nitrogen/generated/ios/swift/NitroMessageManeuver.swift +16 -11
- package/nitrogen/generated/ios/swift/NitroNavigationAlert.swift +16 -11
- package/nitrogen/generated/ios/swift/NitroRoutingManeuver.swift +25 -15
- package/nitrogen/generated/ios/swift/NitroRow.swift +16 -11
- package/nitrogen/generated/ios/swift/PreferredImageLane.swift +9 -4
- package/nitrogen/generated/ios/swift/RemoteImage.swift +58 -0
- package/nitrogen/generated/ios/swift/{Variant_GlyphImage_AssetImage.swift → Variant_GlyphImage_AssetImage_RemoteImage.swift} +4 -3
- package/nitrogen/generated/shared/c++/GlyphImage.hpp +6 -1
- package/nitrogen/generated/shared/c++/HybridAutoPlaySpec.cpp +4 -0
- package/nitrogen/generated/shared/c++/HybridAutoPlaySpec.hpp +5 -0
- package/nitrogen/generated/shared/c++/ImageLane.hpp +8 -5
- package/nitrogen/generated/shared/c++/MessageTemplateConfig.hpp +8 -5
- package/nitrogen/generated/shared/c++/NitroAction.hpp +8 -5
- package/nitrogen/generated/shared/c++/NitroAttributedStringImage.hpp +8 -5
- package/nitrogen/generated/shared/c++/NitroCarPlayDashboardButton.hpp +8 -5
- package/nitrogen/generated/shared/c++/NitroGridButton.hpp +8 -5
- package/nitrogen/generated/shared/c++/NitroMapButton.hpp +8 -5
- package/nitrogen/generated/shared/c++/NitroMessageManeuver.hpp +8 -5
- package/nitrogen/generated/shared/c++/NitroNavigationAlert.hpp +8 -5
- package/nitrogen/generated/shared/c++/NitroRoutingManeuver.hpp +12 -9
- package/nitrogen/generated/shared/c++/NitroRow.hpp +8 -5
- package/nitrogen/generated/shared/c++/PreferredImageLane.hpp +8 -5
- package/nitrogen/generated/shared/c++/RemoteImage.hpp +94 -0
- package/package.json +2 -3
- package/src/index.ts +1 -0
- package/src/specs/AutoPlay.nitro.ts +39 -1
- package/src/types/Image.ts +65 -16
- package/src/types/Maneuver.ts +3 -10
- package/src/utils/NitroImage.ts +81 -6
- package/android/src/main/res/font/materialsymbolsoutlined_regular.ttf +0 -0
- package/ios/Assets/MaterialSymbolsOutlined-Regular.ttf +0 -0
- package/lib/types/Glyphmap.d.ts +0 -4105
- package/lib/types/Glyphmap.js +0 -4105
- package/nitrogen/generated/android/c++/JVariant_GlyphImage_AssetImage.cpp +0 -26
- package/nitrogen/generated/android/c++/JVariant_GlyphImage_AssetImage.hpp +0 -75
- package/src/types/Glyphmap.ts +0 -4107
package/src/types/Image.ts
CHANGED
|
@@ -1,32 +1,81 @@
|
|
|
1
1
|
import type { ImageSourcePropType } from 'react-native';
|
|
2
2
|
import type { ThemedColor } from '../utils/NitroColor';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Augment this interface in your app to get type-safe glyph name autocompletion.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* // autoplay-glyphs.d.ts
|
|
10
|
+
* import type { GlyphName } from './assets/symbolFont/Glyphmap';
|
|
11
|
+
* declare module '@iternio/react-native-auto-play' {
|
|
12
|
+
* interface AutoPlayGlyphMap extends Record<GlyphName, number> {}
|
|
13
|
+
* }
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
// biome-ignore lint/suspicious/noEmptyInterface: must be an interface for declaration merging
|
|
17
|
+
export interface AutoPlayGlyphMap {}
|
|
18
|
+
|
|
19
|
+
/** Resolves to the augmented glyph name union, or falls back to `string` when not augmented. */
|
|
20
|
+
export type GlyphMapKey = keyof AutoPlayGlyphMap extends never
|
|
21
|
+
? string
|
|
22
|
+
: Extract<keyof AutoPlayGlyphMap, string>;
|
|
23
|
+
|
|
24
|
+
type GlyphStyleFields = {
|
|
25
|
+
/**
|
|
26
|
+
* Sets the icon dark and light mode color or a single color for both.
|
|
27
|
+
* Defaults to white for dark mode and black for light mode if not specified.
|
|
28
|
+
* Might not get applied everywhere like MapTemplate buttons on Android.
|
|
29
|
+
*/
|
|
30
|
+
color?: ThemedColor | string;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Sets the background color for dark and light mode or a single color for both
|
|
34
|
+
* Defaults to transparent if not specified.
|
|
35
|
+
*/
|
|
36
|
+
backgroundColor?: ThemedColor | string;
|
|
37
|
+
fontScale?: number;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/** Glyph by name — looked up in the glyph map registered via {@link setIconFont}. */
|
|
41
|
+
export type AutoGlyphByName = GlyphStyleFields & {
|
|
42
|
+
type: 'glyph';
|
|
43
|
+
/** Key in the glyph map passed to `setIconFont`. */
|
|
44
|
+
name: GlyphMapKey;
|
|
45
|
+
/** Optional override — if set, used instead of the map lookup. */
|
|
46
|
+
codepoint?: number;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/** Glyph by raw Unicode code point. */
|
|
50
|
+
export type AutoGlyphByCodepoint = GlyphStyleFields & {
|
|
51
|
+
type: 'glyph';
|
|
52
|
+
codepoint: number;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export type AutoGlyph = AutoGlyphByName | AutoGlyphByCodepoint;
|
|
4
56
|
|
|
5
57
|
export type AutoImage =
|
|
58
|
+
| AutoGlyph
|
|
6
59
|
| {
|
|
7
|
-
|
|
8
|
-
|
|
60
|
+
image: ImageSourcePropType;
|
|
9
61
|
/**
|
|
10
|
-
*
|
|
11
|
-
* Defaults to white for dark mode and black for light mode if not specified.
|
|
62
|
+
* if specified the image gets tinted, if not it will just use the original image
|
|
12
63
|
* Might not get applied everywhere like MapTemplate buttons on Android.
|
|
13
64
|
*/
|
|
14
65
|
color?: ThemedColor | string;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Sets the background color for dark and light mode or a single color for both
|
|
18
|
-
* Defaults to transparent if not specified.
|
|
19
|
-
*/
|
|
20
|
-
backgroundColor?: ThemedColor | string;
|
|
21
|
-
fontScale?: number;
|
|
22
|
-
type: 'glyph';
|
|
66
|
+
type: 'asset';
|
|
23
67
|
}
|
|
24
68
|
| {
|
|
25
|
-
image
|
|
69
|
+
/** HTTPS URL to a remote image. HTTP is not supported (blocked by App Transport Security). */
|
|
70
|
+
uri: string;
|
|
26
71
|
/**
|
|
27
72
|
* if specified the image gets tinted, if not it will just use the original image
|
|
28
|
-
* Might not get applied everywhere like MapTemplate buttons on Android.
|
|
29
73
|
*/
|
|
30
74
|
color?: ThemedColor | string;
|
|
31
|
-
|
|
75
|
+
/**
|
|
76
|
+
* Network timeout in milliseconds before the remote fetch is abandoned and `null` is returned.
|
|
77
|
+
* Defaults to 500ms when not specified.
|
|
78
|
+
*/
|
|
79
|
+
timeoutMs?: number;
|
|
80
|
+
type: 'remote';
|
|
32
81
|
};
|
package/src/types/Maneuver.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ImageSourcePropType } from 'react-native';
|
|
2
2
|
import type { ThemedColor } from '../utils/NitroColor';
|
|
3
|
-
import type {
|
|
3
|
+
import type { AutoGlyphByCodepoint, AutoGlyphByName } from './Image';
|
|
4
4
|
import type { TravelEstimates } from './Trip';
|
|
5
5
|
|
|
6
6
|
export enum ManeuverType {
|
|
@@ -174,15 +174,8 @@ export interface PreferredLane extends Lane {
|
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
export type ManeuverImage =
|
|
177
|
-
|
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* make sure to specify a color with a proper contrast ratio to cardBackgroundColor otherwise it might not get applied
|
|
181
|
-
* defaults to white/black for dark/light mode
|
|
182
|
-
*/
|
|
183
|
-
color?: ThemedColor | string;
|
|
184
|
-
type: 'glyph';
|
|
185
|
-
}
|
|
177
|
+
| Pick<AutoGlyphByName, 'type' | 'name' | 'codepoint' | 'color'>
|
|
178
|
+
| Pick<AutoGlyphByCodepoint, 'type' | 'codepoint' | 'color'>
|
|
186
179
|
| {
|
|
187
180
|
image: ImageSourcePropType;
|
|
188
181
|
/**
|
package/src/utils/NitroImage.ts
CHANGED
|
@@ -1,8 +1,69 @@
|
|
|
1
1
|
import { Image, type ImageResolvedAssetSource } from 'react-native';
|
|
2
|
-
import { glyphMap } from '../types/Glyphmap';
|
|
3
2
|
import type { AutoImage } from '../types/Image';
|
|
4
3
|
import { type NitroColor, NitroColorUtil } from './NitroColor';
|
|
5
4
|
|
|
5
|
+
let _iconFont: string | undefined;
|
|
6
|
+
let _glyphMap: Record<string, number> | undefined;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Register the icon font and (optionally) a glyph map for name-based lookups.
|
|
10
|
+
* Must be called **once** before creating any templates. Subsequent calls are ignored.
|
|
11
|
+
*
|
|
12
|
+
* The font name maps directly to a native font asset:
|
|
13
|
+
* - **Android** — `res/font/<name>.ttf` (must be lowercase)
|
|
14
|
+
* - **iOS** — `<name>.ttf` in the app bundle (registered via CoreText automatically)
|
|
15
|
+
*
|
|
16
|
+
* For cross-platform compatibility use lowercase with underscores only.
|
|
17
|
+
*
|
|
18
|
+
* @param name Native font asset name (without extension).
|
|
19
|
+
* @param glyphMap Optional map of glyph names to Unicode code points.
|
|
20
|
+
* When provided, glyphs can use `{ type: 'glyph', name: 'icon_name' }`.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* import { glyphMap } from './assets/Glyphmap';
|
|
25
|
+
* setIconFont('material_symbols', glyphMap);
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export function setIconFont(name: string, glyphMap?: Record<string, number>): void {
|
|
29
|
+
if (_iconFont != null) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
_iconFont = name;
|
|
33
|
+
_glyphMap = glyphMap;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function getIconFont(): string {
|
|
37
|
+
if (_iconFont == null) {
|
|
38
|
+
throw new Error(
|
|
39
|
+
'No icon font configured. Call setIconFont("your_font_name") before using glyph images.'
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
return _iconFont;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function resolveGlyph(image: Extract<AutoImage, { type: 'glyph' }>): number {
|
|
46
|
+
if ('name' in image && image.name !== undefined) {
|
|
47
|
+
if (image.codepoint !== undefined) {
|
|
48
|
+
return image.codepoint;
|
|
49
|
+
}
|
|
50
|
+
if (_glyphMap == null) {
|
|
51
|
+
throw new Error(
|
|
52
|
+
`Glyph name "${image.name}" used but no glyph map was provided to setIconFont().`
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
const cp = _glyphMap[image.name];
|
|
56
|
+
if (cp === undefined) {
|
|
57
|
+
throw new Error(`Glyph name "${image.name}" not found in the glyph map.`);
|
|
58
|
+
}
|
|
59
|
+
return cp;
|
|
60
|
+
}
|
|
61
|
+
if (image.codepoint !== undefined) {
|
|
62
|
+
return image.codepoint;
|
|
63
|
+
}
|
|
64
|
+
throw new Error('Glyph image must provide either `name` or `codepoint`.');
|
|
65
|
+
}
|
|
66
|
+
|
|
6
67
|
interface AssetImage extends ImageResolvedAssetSource {
|
|
7
68
|
color?: NitroColor;
|
|
8
69
|
packager_asset: boolean;
|
|
@@ -10,16 +71,22 @@ interface AssetImage extends ImageResolvedAssetSource {
|
|
|
10
71
|
|
|
11
72
|
interface GlyphImage {
|
|
12
73
|
glyph: number;
|
|
74
|
+
fontName: string;
|
|
13
75
|
color: NitroColor;
|
|
14
76
|
backgroundColor: NitroColor;
|
|
15
77
|
fontScale?: number;
|
|
16
78
|
}
|
|
17
79
|
|
|
80
|
+
interface RemoteImage {
|
|
81
|
+
uri: string;
|
|
82
|
+
color?: NitroColor;
|
|
83
|
+
timeoutMs?: number;
|
|
84
|
+
}
|
|
85
|
+
|
|
18
86
|
/**
|
|
19
|
-
*
|
|
20
|
-
* the actual numeric value so we need a nitro specific type
|
|
87
|
+
* NitroModules-compatible image types passed to native.
|
|
21
88
|
*/
|
|
22
|
-
export type NitroImage = GlyphImage | AssetImage;
|
|
89
|
+
export type NitroImage = GlyphImage | AssetImage | RemoteImage;
|
|
23
90
|
|
|
24
91
|
function convert(image: AutoImage): NitroImage;
|
|
25
92
|
function convert(image?: AutoImage): NitroImage | undefined;
|
|
@@ -32,18 +99,26 @@ function convert(image?: AutoImage): NitroImage | undefined {
|
|
|
32
99
|
const {
|
|
33
100
|
color = { darkColor: 'white', lightColor: 'black' },
|
|
34
101
|
fontScale,
|
|
35
|
-
name,
|
|
36
102
|
backgroundColor = 'transparent',
|
|
37
103
|
} = image;
|
|
38
104
|
|
|
39
105
|
return {
|
|
40
|
-
glyph:
|
|
106
|
+
glyph: resolveGlyph(image),
|
|
107
|
+
fontName: getIconFont(),
|
|
41
108
|
color: NitroColorUtil.convert(color),
|
|
42
109
|
backgroundColor: NitroColorUtil.convert(backgroundColor),
|
|
43
110
|
fontScale,
|
|
44
111
|
};
|
|
45
112
|
}
|
|
46
113
|
|
|
114
|
+
if (image.type === 'remote') {
|
|
115
|
+
return {
|
|
116
|
+
uri: image.uri,
|
|
117
|
+
color: NitroColorUtil.convert(image.color),
|
|
118
|
+
timeoutMs: image.timeoutMs,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
47
122
|
// Image.resolveAssetSource is pretty terrible, it will simply return whatever object you pass it is not a number [require(...)]
|
|
48
123
|
// so the input allows all optional parameters which are returned as is even though
|
|
49
124
|
// the return type claims to not have any optional parameters...
|
|
Binary file
|
|
Binary file
|