npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@smartface/extension-listviewindex

v3.0.0

Published

ListviewIndex component for Smartface Native Framework

Downloads

2

Readme

ListviewIndex Extension from Smartface

This Extension is for iOS Only.


NPM Twitter: @Smartface_io License: MIT

An extension to ListviewIndex component with Smartface Native Framework.

Installation

ListviewIndex Extension can be installed via npm easily from our public npm repository. Execute the command on your scripts directory:

yarn add @smartface/extension-listviewindex

How to use

  1. Create ListviewIndex object and add to your page layout as child view.
import Page1Design from 'generated/pages/page1';
import Image from "@smartface/native/ui/image";
import Color from '@smartface/native/ui/color';
import Label from '@smartface/native/ui/label';
import FlexLayout from '@smartface/native/ui/flexlayout';
import ListView from '@smartface/native/ui/listview';
import ListViewItem from '@smartface/native/ui/listviewitem';
import Font from '@smartface/native/ui/font';
import TextAlignment from '@smartface/native/ui/textalignment';
import ListviewIndex from '@smartface/extension-listviewindex';

export default class Page1 extends Page1Design {
    router: any;
    constructor() {
        super();
        // Overrides super.onShow method
        this.onShow = onShow.bind(this, this.onShow.bind(this));
        // Overrides super.onLoad method
        this.onLoad = onLoad.bind(this, this.onLoad.bind(this));
    }
    initListView() {
        const _headerData = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", Image.createFromFile("images://trash.png")];

        const _rowData = [];
        for (let i = 0; i < _headerData.length; i++) {
            _rowData.push(["#ff6c8f", "#ff85a2", "#ff9fb6", "#ffb8c9", "#ffd2dc", "#ffebf0"]);
        }

        const dataArray = [];

        const headerIndex = [];

        function pushDataToArray(headerData, rowData) {
            for (let i = 0; i < headerData.length; i++) {
                dataArray.push({ isHeader: true, data: headerData[i] });
                headerIndex.push(dataArray.length - 1);
                for (let j = 0; j < rowData[i].length; j++) {
                    dataArray.push({ isHeader: false, data: rowData[i][j] });
                }
            }
        };
        pushDataToArray(_headerData, _rowData);

        const myListView = new ListView({
            flexGrow: 1,
            marginLeft: 20,
            itemCount: dataArray.length,
        });

        this.layout.addChild(myListView);

        const listviewindex = new ListviewIndex();
        listviewindex.width = 20;

        listviewindex.indexItems = function () {
            return _headerData;
        }

        listviewindex.indexDidSelect = function (index) {
            myListView.scrollTo(headerIndex[index], false);
            return true; //haptic
        }

        listviewindex.reloadData();

        this.layout.addChild(listviewindex);


        // listviewindex.backgroundView.backgroundColor = Color.GREEN;
        // listviewindex.backgroundColor = Color.BLUE;
        // listviewindex.tintColor = Color.RED;
        // listviewindex.itemSpacing = 5;
        // listviewindex.font = Font.create("TimesNewRomanPS-BoldMT", 16);
        // listviewindex.indexInset = { top: 10, left: 0, bottom: 10, right: 0 };
        // listviewindex.indexOffset = { vertical: -2, horizontal: -2 };
        // listviewindex.listviewIndexMinimumWidth = 40;

        myListView.onRowCreate = function (type) {
            const myListViewItem = new ListViewItem();

            if (type == 1) {
                const myLabelTitle = new Label({
                    flexGrow: 1,
                    margin: 10
                });
                myLabelTitle.textColor = Color.WHITE;
                myLabelTitle.borderRadius = 10;
                myLabelTitle.textAlignment = TextAlignment.MIDCENTER;
                myListViewItem.addChild(myLabelTitle);
                myListViewItem.myLabelTitle = myLabelTitle;
            }
            else { // Header
                const myLabelTitle = new Label({
                    flexGrow: 1,
                    margin: 10
                });
                myLabelTitle.font = Font.create(Font.DEFAULT, 30, Font.BOLD);
                myLabelTitle.backgroundColor = Color.WHITE;
                myListViewItem.addChild(myLabelTitle);
                myListViewItem.myLabelTitle = myLabelTitle;
            }

            return myListViewItem;
        };

        myListView.onRowHeight = function (index) {
            if (dataArray[index].isHeader) {
                return 100;
            }
            return 70;
        };

        myListView.onRowBind = function (listViewItem, index) {
            const myLabelTitle = listViewItem.myLabelTitle;

            if (dataArray[index].isHeader) {
                myLabelTitle.text = (typeof dataArray[index].data === 'string') ? dataArray[index].data : "Image";
            }
            else {
                myLabelTitle.backgroundColor = Color.create(dataArray[index].data);
                myLabelTitle.text = dataArray[index].data;
            }
        };

        myListView.onRowType = function (index) {
            if (dataArray[index].isHeader) {
                return 2;
            }
            else {
                return 1;
            }
        };

        this.layout.flexDirection = FlexLayout.FlexDirection.ROW;
    }
}

/**
 * @event onShow
 * This event is called when a page appears on the screen (everytime).
 */
function onShow(superOnShow: () => void) {
    superOnShow();
}

/**
 * @event onLoad
 * This event is called once when page is created.
 */
function onLoad(superOnLoad: () => void) {
    superOnLoad();
    this.initListView();
}

API Documentation

Full api documentation is in api.md

Used Repositories

MYTableViewIndex

Need Help?

Please submit an issue on GitHub and provide information about your problem.

Support & Documentation & Useful Links

Code of Conduct

We are committed to making participation in this project a harassment-free experience for everyone, regardless of the level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality. Please read and follow our Code of Conduct.

License

This project is licensed under the terms of the MIT license. See the LICENSE file. Within the scope of this license, all modifications to the source code, regardless of the fact that it is used commercially or not, shall be committed as a contribution back to this repository.