1

In the code below, I try to display an image with a local path that I create to navigate to a specific directory in my project.

for example:

props.item.url = 'assets/logos/some-id/some-image-name.png'

<Image source={require(`../../../../${props.item.url}`)} style={{ width: "100%", height: "100%" }} resizeMode={"contain"} />

Look at the warning below, some warnings in different file are appear

Compiled with warnings. ./components/menu/sub-menu/new/templates/test.json Module parse failed: Unexpected token { in JSON at position 7651 while parsing near '... "direction": 1 }

{ "lock": 2, ...' You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders SyntaxError: Unexpected token { in JSON at position 7651 while parsing near '... "direction": 1 }

{ "lock": 2, ...' at JSON.parse ()

./services/localization/config/translate_thai.json Module parse failed: Unexpected token ​ in JSON at position 165 while parsing near '...TeamShortName" :{ ​ }, "TeamLo...' You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders SyntaxError: Unexpected token ​ in JSON at position 165 while parsing near '...TeamShortName" :{ ​ }, "TeamLo...' at JSON.parse ()

Tair Miron
  • 11
  • 1

1 Answers1

0
<Image source={{require("../picture/View.png")}} style={{height:"20%",width:"20%}}/>
ND verma
  • 171
  • 1
  • 9
  • Please don't post only code as answer, but also provide an explanation what your code does and how it solves the problem of the question. Answers with an explanation are usually more helpful and of better quality, and are more likely to attract upvotes. – Mark Rotteveel Jun 23 '22 at 10:51