Giter VIP home page Giter VIP logo

Comments (6)

Kishanjvaghela avatar Kishanjvaghela commented on May 17, 2024

@hmachaharywork Can you share your code here?

from react-native-cardview.

hmachaharywork avatar hmachaharywork commented on May 17, 2024

Sorry, I was away so couldn't reply. I cannot share the original code, but I have created a sample code. I was using RN 0.38.1 in my project. Thought it was due to the version of react native but after testing the below code with RN 0.44.2, found out that its not the version. Solved some problem from here .
But couln't solve the problem below.

import React, { Component } from 'react';
import CardView from 'react-native-cardview';
import { AppRegistry, StyleSheet, Text, View, TouchableOpacity } from 'react-native';

export default class testing extends Component {
constructor() {
super();
this.state = {
data: [
{id: 1, addr: "Hello"},
{id: 2, addr: "Hi, Nice to meet you"},
{id: 3, addr: "Hello, Nice to meet you too."},
{id: 4, addr: "How are you?"}
]
}
}

deleteData(id) {
let filteredData = this.state.data.filter((item) => {
return item.id !== id;
})
this.setState({
data: filteredData
})
}

renderData(data) {
return data.map((item) => {
return(
<View key={item.id} style={{flexDirection: 'row', paddingTop: 5}}>
<View style={{flex: .6, paddingLeft: 10}}>
<Text>{item.addr}</Text>
</View>
<TouchableOpacity
style={{flex: .2}}
onPress={() => this.deleteData(item.id)}
>
<Text>Delete</Text>
</TouchableOpacity>
</View>
)
});
}

render() {
const {data} = this.state;
return (
<View style={styles.container}>
<CardView
style={{paddingBottom: 20}}
cardElevation={2}
cardMaxElevation={2}
cornerRadius={5}
>
<View style={{width: 300}}>
<View style={{padding: 5,borderBottomColor: '#e3e3e3', borderBottomWidth: 1,}}>
<Text style={{fontSize: 16}}>User Information</Text>
</View>
<View>
{
this.renderData(data)
}
</View>
</View>
</CardView>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
});

AppRegistry.registerComponent('testing', () => testing);

from react-native-cardview.

hmachaharywork avatar hmachaharywork commented on May 17, 2024

@Kishanjvaghela have you found the solution for the above issue?

from react-native-cardview.

Kishanjvaghela avatar Kishanjvaghela commented on May 17, 2024

@hmachaharywork
I have fixed your issue. Please use the latest version now

"react-native-cardview": "^1.0.4"

Here is your demo output

peek 2017-06-02 16-18

from react-native-cardview.

Kishanjvaghela avatar Kishanjvaghela commented on May 17, 2024

@hmachaharywork You can find example here

from react-native-cardview.

hmachaharywork avatar hmachaharywork commented on May 17, 2024

@Kishanjvaghela Thanks for the quick fix. Appreciate your hard work.

from react-native-cardview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.