Coder Social home page Coder Social logo

quran / api-js Goto Github PK

View Code? Open in Web Editor NEW
30.0 30.0 3.0 884 KB

Quran.com's API Javascript SDK https://npmjs.com/package/@quranjs/api

Home Page: https://quranjs.com

License: MIT License

TypeScript 100.00%
javascript quran quran-api-client quranjs

api-js's People

Contributors

ahmedriad1 avatar dependabot[bot] avatar osamasayed avatar teezzan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

api-js's Issues

Not getting the proper formatted verse

Environment:

  • React Native
  • @quranjs/api : "^1.5.0"
  • UI framework: UI Kitten

Problem:
I have queried verse by chapter id quran.v4.verses.findByChapter(1,{language:'ms', words: true}) and stored it in AsyncStorage.
I then display the list of verses via FlatList(React Native) or List(UI Kitten). This is where the problem occurs.

I believe that I got the correct array of objects for the queried id.
This is what I got:

[
    {"hizbNumber": 1, 
    "id": 1, 
    "juzNumber": 1, 
    "manzilNumber": 1, 
    "pageNumber": 1, 
    "rubElHizbNumber": 1, 
    "rukuNumber": 1, 
    "sajdahNumber": null, 
    "verseKey": "1:1", 
    "verseNumber": 1, 
    "words": [[Object], [Object], [Object], [Object], [Object]]
}, {
    "hizbNumber": 1, 
    "id": 2, 
    "juzNumber": 1, 
    "manzilNumber": 1, 
    "pageNumber": 1, 
    "rubElHizbNumber": 1, 
    "rukuNumber": 1, 
    "sajdahNumber": null, 
    "verseKey": "1:2", 
    "verseNumber": 2, 
    "words": [[Object], [Object], [Object], [Object], [Object]]
}, { ... } //concatenated for breivity

so in the renderItem of the FlatList, I use .map function to get the list of texts from the words, but they are not the actual verses of the Surah.

The renderItem :

const VerseItem = ({item, index}) => {
        return(
            <View style={{ backgroundColor:'blue', flexDirection: 'row', justifyContent: 'flex-end', alignItems: 'center', padding: 20}}>
                {
                    item.words.map((word) => {
                        return (
                            <Text style={{ color: '#fff' }} key={ word.id }>{word.text}</Text>
                        )
                    })
                }
            </View>
        )
    }

Result:
Screenshot 2022-10-18 at 11 45 40 PM

Word to Word

Would like to have word to word translations available.

CDN

Is there a possibility to provide the script in a cdn

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.