react-native-ui-lib icon indicating copy to clipboard operation
react-native-ui-lib copied to clipboard

Card.Image syntax error

Open biapar opened this issue 3 years ago • 7 comments

I try your library with RN. I wish to try the card component with an image but the compiler give this error:

image

Why? I follow your docs.


"@react-native-community/blur": "^4.2.0",
"@react-navigation/native": "^6.0.12",
"@react-navigation/native-stack": "^6.8.0",
"galio-framework": "^0.8.0",
"react": "18.0.0",
"react-native": "0.69.4",
"react-native-gesture-handler": "^2.5.0",
"react-native-reanimated": "^2.10.0",
"react-native-safe-area-context": "^4.3.3",
"react-native-screens": "^3.16.0",
"react-native-svg": "^13.0.0",
"react-native-svg-transformer": "^1.0.0",
"react-native-ui-lib": "^6.20.1"

biapar avatar Aug 25 '22 08:08 biapar

This is just a syntax error, you need wrap your uri with quotes:

source={{uri: "https://xxx"}}

XHMM avatar Aug 26 '22 11:08 XHMM

There is an error into the docs

image

I tried again but the image don't appear. <Card.Image source={{ uri: "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/assets/images/card-example.jpg"}}/>

image

biapar avatar Aug 26 '22 11:08 biapar

you need to set height to Card.Image, try height="100%" or a fixed value such as 200

XHMM avatar Aug 26 '22 12:08 XHMM

I tried. Don't work in any manner into Card tag.

`/* eslint-disable @typescript-eslint/no-unused-vars */ import React, { Component } from 'react'; import { SafeAreaView, ScrollView, StatusBar, StyleSheet, useColorScheme,

} from 'react-native'; import { View, Text, Card, Button, Icon, TouchableOpacity, Toast, Incubator, Image } from 'react-native-ui-lib';

class Page extends React.Component<Props> {

render() {
const { navigation } = this.props;
return (
    <View flex padding-page>
        <Text heading marginB-s4 blue30>My Screen</Text>
        <Card height={200} center marginT-5 onPress={() => console.log('pressed 1')}>
            <Card.Image height={200} source={{ uri: "https://images.unsplash.com/photo-1461988320302-91bde64fc8e4?ixid=2yJhcHBfaWQiOjEyMDd9&fm=jpg&q=80"}}/>

            <Card.Section
                content={[{ text: 'Card content here', text70: true, grey10: true }]}
                contentStyle={{ alignItems: 'center' }}
            />
        </Card>
        <Card height={200} center marginT-5 onPress={() => console.log('pressed 2')}>
            <Card.Section
                content={[{ text: 'Card content here', text70: true, grey10: true }]}
                contentStyle={{ alignItems: 'center' }}
            />
            <Image height={200} source={{ uri: "https://images.unsplash.com/photo-1461988320302-91bde64fc8e4?ixid=2yJhcHBfaWQiOjEyMDd9&fm=jpg&q=80" }}></Image>
        </Card>
        <Text body>This is an example card </Text>
        <Image height={200} source={{ uri: "https://images.unsplash.com/photo-1461988320302-91bde64fc8e4?ixid=2yJhcHBfaWQiOjEyMDd9&fm=jpg&q=80" }}></Image>
        <Button label="Button" body bg-blue30 square></Button>

  </View>
);

} }

export default Page;`

biapar avatar Aug 27 '22 08:08 biapar

I tried you code and the image not showed as you said.

After searching source code ,I find width and height to Card.Image were used to set container size, not image actually, you can try this code:

<Card
  height={200}
  style={{backgroundColor: 'blue'}}
  center
  marginT-5
  onPress={() => console.log('pressed 1')}>
  <Card.Image
    source={{
      uri: 'https://images.unsplash.com/photo-1461988320302-91bde64fc8e4?ixid=2yJhcHBfaWQiOjEyMDd9&fm=jpg&q=80',
    }}
    style={{
      // add this, and remove width/height of Card.Image, set them on Card
      width: '100%',
      height: '100%',
    }}
  />
</Card>

By the end, the official doc really has many issues, it's not ready to use I think.

XHMM avatar Aug 27 '22 09:08 XHMM

You are right. The docs seems in alpha version and then I think that this UI is not ready to use on mass.

biapar avatar Aug 27 '22 10:08 biapar

It works. image

biapar avatar Aug 28 '22 15:08 biapar

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 29 '22 00:10 stale[bot]