software-mansion / react-native-svg

SVG library for React Native, React Native Web, and plain React web projects.
MIT License
7.34k stars 1.11k forks source link

Using with svg files question #1654

Open LuLuSaBee opened 2 years ago

LuLuSaBee commented 2 years ago

Hi, I'm ready to use this in my project, but I have a question about this.

If use babel-plugin-inline-import, can svg be normal when build ?

Rynxiao commented 2 years ago

I encounter an issue when using the babel-plugin-line-import.

Path '/proj/assets/icons/edit.svg' could not be found for '/Users/xxh/Documents/proj/src/components/Icon.tsx'

RCTFatal
__28-[RCTCxxBridge handleError:]_block_invoke
_dispatch_call_block_and_release
_dispatch_client_callout
_dispatch_main_queue_callback_4CF
__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
__CFRunLoopRun
CFRunLoopRunSpecific
-[NSRunLoop(NSRunLoop) runMode:beforeDate:]
-[NSRunLoop(NSRunLoop) runUntilDate:]
+[RNSplashScreen show]
-[AppDelegate application:didFinishLaunchingWithOptions:]
-[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:]
-[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:]
-[UIApplication _runWithMainScene:transitionContext:completion:]
-[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:]
_UIScenePerformActionsWithLifecycleActionMask
__101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke
-[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:]
-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]
-[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:]
__186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke
+[BSAnimationSettings(UIKit) tryAnimatingWithSettings:actions:completion:]
_UISceneSettingsDiffActionPerformChangesWithTransitionContext
-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]
__64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke.573
-[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:]
-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]
-[UIApplication workspace:didCreateScene:withTransitionContext:completion:]
-[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:]
-[FBSScene _callOutQueue_agent_didCreateWithTransitionContext:completion:]
__94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke.180
-[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:]
__94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke
_dispatch_client_callout
_dispatch_block_invoke_direct
__FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__
-[FBSSerialQueue _targetQueue_performNextIfPossible]
-[FBSSerialQueue _performNextFromRunLoopSource]
__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
__CFRunLoopDoSource0
__CFRunLoopDoSources0
__CFRunLoopRun
CFRunLoopRunSpecific
GSEventRunModal
-[UIApplication _run]
UIApplicationMain
main
start_sim
0x0
LuLuSaBee commented 2 years ago

@Rynxiao Check your import path or name in Icon.tsx

Rynxiao commented 2 years ago

@Rynxiao Check your import path or name in Icon.tsx

Have you solved your problem?

I double-checked my import path but still report this error.

LuLuSaBee commented 2 years ago

My question is that I wanna know is babel solution can be normal when building iOS app(ipa) or android app(apk).

LuLuSaBee commented 2 years ago

@Rynxiao Are you already setting this in .babelrc ?

Rynxiao commented 2 years ago

@LuLuSaBee Yes, I follow the guide and add the setting to the babel config file.

bohdanprog commented 1 week ago

Hello @LuLuSaBee, If you still have a problem with it please share with us the simple repro of what you want to achieve. Thank you