Skip to content

How to set image width and height? #66

@v1rtl

Description

@v1rtl

I try to set custom width and height but it seems like these props are ignored. Am I doing it wrong?

QuarkPlayer on  master [!] is 📦 v1.0.0 via ⬢ v12.13.0 
❯ yarn start
yarn run v1.19.1
$ qode --inspect ./dist/index.js
Debugger listening on ws://127.0.0.1:9229/782a4de1-09c1-45b1-9e31-c1bba1328b18
For help, see: https://nodejs.org/en/docs/inspector
[2019-11-19 13:51:42.230] [info] EventWidget: subscribed to Resize : 14, size: 1
[2019-11-19 13:51:42.235] [info] flexlayout: count 0
[2019-11-19 13:51:42.238] [info] flexlayout: count 0
[2019-11-19 13:51:42.242] [info] flexlayout: count 0
[2019-11-19 13:51:42.243] [info] flexlayout: count 0
Could not parse stylesheet of object NWidget(0x31435c0)
[2019-11-19 13:51:42.302] [info] set border: nan
Could not parse stylesheet of object NWidget(0x31435c0)
[2019-11-19 13:51:42.304] [info] set border: nan
[2019-11-19 13:51:42.304] [info] set alignItems: center
[2019-11-19 13:51:42.304] [info] set flex: 1
[2019-11-19 13:51:42.304] [info] set alignItems: center
[2019-11-19 13:51:42.304] [info] set flex: 1
[2019-11-19 13:51:42.304] [info] set yWidth: 100%
[2019-11-19 13:51:42.304] [info] set yHeight: 100%
Done in 3.42s.

Here's the code:

import React from 'react'
import { Image, View } from '@nodegui/react-nodegui'
import { AspectRatioMode } from '@nodegui/nodegui'

type ImageProps = {
  src: string
}

const coverStyle = `
  flex: 2;
  #img {
    flex: 1;
    height: '40px';
    width: '40px';
    qproperty-alignment: 'AlignCenter';
  }
`

const Cover = ({ src }: ImageProps) => (
  <View styleSheet={coverStyle}>
    <Image
      id="img"
      src={src}
      aspectRatioMode={AspectRatioMode.KeepAspectRatio}
    />
  </View>
)

export default Cover

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions