# @shopfe/shreact-freetemplate-common

> ## 说明 店铺装修ISV模板通用方法

Latest version **0.0.1** (published 2019-10-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install @shopfe/shreact-freetemplate-common
pnpm add @shopfe/shreact-freetemplate-common
yarn add @shopfe/shreact-freetemplate-common
bun add @shopfe/shreact-freetemplate-common
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2019-10-12 |
| First published | 2019-10-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 57.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | carvetime |

## Links

- npm: https://www.npmjs.com/package/@shopfe/shreact-freetemplate-common
- npm.io page: https://npm.io/package/@shopfe/shreact-freetemplate-common

## Dependencies (3)

- [prop-types](https://npm.io/package/prop-types.md) ^15.5.10
- [@areslabs/jdreact-core-web](https://npm.io/package/@areslabs/jdreact-core-web.md) ^1.0.0
- [@areslabs/jdreact-core-scripts](https://npm.io/package/@areslabs/jdreact-core-scripts.md) ^1.0.0

## Recent versions

- 0.0.1 (latest) — 2019-10-12
- 2.4.0 — 2019-10-12
- 2.3.0 — 2019-10-12
- 2.2.0 — 2019-10-12
- 2.0.0 — 2019-10-11
- 1.2.0 — 2019-10-11
- 1.1.0 — 2019-10-11
- 1.0.1 — 2019-10-11
- 1.0.0 — 2019-10-11

## README

# jdreact-plugin-freetemplate-common

## 说明
店铺装修ISV模板通用方法

## 安装
`npm install @ares/jdreact-plugin-freetemplate-common --save`

## 使用

```jsx
import React from 'react'
import { View } from 'react-native'
import { JDTouchable, JDLog } from '@areslabs/jdreact-core-scripts'

import { Floor } from '@ares/jdreact-plugin-freetemplate-common'

export default class Example extends React.Component {
    constructor(props) {
        super(props)
        this.state = {
            data: this.props.data
        };
        // 注册监听楼层刷新
        FloorManager.addFloorDataUpdateListener(this, this.props.id);
    }

    render() {
        this.addListener();
        return (<JDTouchable onPress={this.clickHandle.bind(this)} >
            <Floor {...this.props}>
                <View style={{ backgroundColor: this.state.data.color, height: this.state.data.height }} >
                </View>
            </Floor>
        </JDTouchable>
        )
    }

    clickHandle(event) {
        let { uid } = FloorManager.getFloorIdentiInfo(this, this.props.id);
        JDLog.d(`uid=${uid}-event=${event}`);
    }

    /**
     * 监听楼层刷新后的回调方法
     * 
     * @param {Object} data
     * @memberof Example
     */
    onFloorDataUpdate(data) {
        this.setState({
            data
        })
    }
}
```

## 组件props
使用`Floor`或`NavTab`时需要通过`{...this.props}`传递原生参数

## 组件API

### FloorManager


#### addFloorDataUpdateListener
FloorManager.addFloorDataUpdateListener(Object object, string id)
注册楼层数据更新的监听

object
楼层组件this

id
楼层的参数id

#### onFloorDataUpdate
onFloorDataUpdate(Object data)
楼层数据更新的回调函数

data
楼层的数据

---
_Source: https://npm.io/package/@shopfe/shreact-freetemplate-common · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
