fixes image url

master
Atul R 5 years ago
parent b8756ab420
commit 4f946abfb3
  1. 4
      src/index.tsx
  2. 3
      webpack.config.js

@ -7,10 +7,12 @@ import {
Image, Image,
useEventHandler useEventHandler
} from "@nodegui/react-nodegui"; } from "@nodegui/react-nodegui";
import path from "path";
import React, { useState } from "react"; import React, { useState } from "react";
import { AspectRatioMode, QPushButtonEvents } from "@nodegui/nodegui"; import { AspectRatioMode, QPushButtonEvents } from "@nodegui/nodegui";
import imageUrl from "../assets/sample.jpg"; import imageUrl from "../assets/sample.jpg";
const distImgUrl = path.resolve(__dirname, imageUrl);
const fixedSize = { width: 500, height: 500 }; const fixedSize = { width: 500, height: 500 };
const App = () => { const App = () => {
@ -27,7 +29,7 @@ const App = () => {
<Text id="result">{`Time in epoc: ${time.getTime()}`}</Text> <Text id="result">{`Time in epoc: ${time.getTime()}`}</Text>
<Image <Image
style={imageStyle} style={imageStyle}
src={imageUrl} src={distImgUrl}
aspectRatioMode={AspectRatioMode.KeepAspectRatio} aspectRatioMode={AspectRatioMode.KeepAspectRatio}
/> />
</View> </View>

@ -8,6 +8,9 @@ module.exports = {
path: path.resolve(__dirname, "dist"), path: path.resolve(__dirname, "dist"),
filename: "index.js" filename: "index.js"
}, },
node: {
__dirname: false
},
module: { module: {
rules: [ rules: [
{ {

Loading…
Cancel
Save