1.0.4 • Published 6 months ago

@ray-js/robot-map-component v1.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

English | 简体中文

@ray-js/robot-map-component

latest download

Robot Map Component

Installation

$ npm install @ray-js/robot-map-component
# or
$ yarn add @ray-js/robot-map-component

Usage

Tuya MiniApp Tools >= 0.5.10 Basic Lib >= 2.15.0 Tuya App Basic Line > 5.8.0

Create copy-scripts.js in the project root directory

const shell = require('shelljs');

shell.cp('-R', 'node_modules/@ray-js/robot-map-component/lib/webview', 'src');

Add postinstall in package.json in the project

  "scripts": {
    "lint": "eslint src --ext .js,.jsx,.ts,.tsx --fix",
    "test": "echo \"Error: no test specified\" && exit 1",
    "start:tuya": "ray start -t tuya --bundler=webpack",
    "build:tuya": "ray build -t tuya --bundler=webpack",
    "postinstall": "node copy-scripts.js"
  },

Re-install dependencies

yarn add @ray-js/robot-map-component

FullScreen component used in the project

import React from 'react';
import { View } from '@ray-js/ray';
import { IndoorMap } from '@ray-js/robot-map-component';
import styles from './index.module.less';

export default function Home() {
  return (
    <View className={styles.view}>
      <IndoorMap.Full />
    </View>
  );
}

Dynamic width and height component used in the project

import React from 'react';
import { View } from '@ray-js/ray';
import { IndoorMap } from '@ray-js/robot-map-component';
import styles from './index.module.less';

export default function Home() {
  return (
    <View className={styles.view}>
      <IndoorMap.Dynamic />
    </View>
  );
}

Call the API of the map component in the project

import React, { useCallback, useRef } from 'react';
import { View } from '@ray-js/ray';
import { IndoorMap, IndoorMapUtils, IndoorMapApi } from '@ray-js/robot-map-component';
import styles from './index.module.less';

export default function Home() {
  const mapId = useRef('');
  const onMapId = useCallback((data: { mapId: string; dataMapId: string; target: number }) => {
    mapId.current = data.mapId;
    IndoorMapApi.getAllMapAreaInfo(IndoorMapUtils.getMapInstance(mapId.current), false).then(
      res => {
        console.log('getAllMapAreaInfo ==>', res);
      }
    );
  }, []);

  const onLoggerInfo = useCallback((data: { info: string; theme: string; args: any }) => {
    console.log(data.info || '', data.theme || '', ...Object.values(data.args || {}));
  }, []);

  return (
    <View className={styles.view}>
      <IndoorMap.Dynamic eventProps={{ onMapId, onLoggerInfo }} />
    </View>
  );
}
1.0.2-beta-1

9 months ago

1.0.2-beta-2

9 months ago

1.0.2-beta-3

9 months ago

0.0.23-beta-9

11 months ago

0.0.23-beta-5

11 months ago

0.0.23-beta-6

11 months ago

0.0.23-beta-7

11 months ago

0.0.23-beta-8

11 months ago

0.0.23-beta-1

12 months ago

0.0.23-beta-2

12 months ago

0.0.23-beta-3

12 months ago

0.0.23-beta-4

11 months ago

0.0.16-beta-1

1 year ago

0.1.0-beta-11

10 months ago

0.1.0-beta-10

10 months ago

0.1.0-beta-13

10 months ago

0.1.0-beta-12

10 months ago

0.1.0-beta-18

10 months ago

0.1.0-beta-15

10 months ago

0.0.17-beta-2

1 year ago

0.1.0-beta-14

10 months ago

0.1.0-beta-17

10 months ago

0.1.0-beta-16

10 months ago

2.0.0-beta-8

6 months ago

2.0.0-beta-7

6 months ago

2.0.0-beta-6

6 months ago

0.0.17-beta-1

1 year ago

2.0.0-beta-1

7 months ago

2.0.0-beta-5

6 months ago

2.0.0-beta-4

6 months ago

2.0.0-beta-3

7 months ago

2.0.0-beta-2

7 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago

1.0.4-beta-1

8 months ago

1.0.0-beta-1

9 months ago

1.0.4-beta-2

8 months ago

1.0.0-beta-2

9 months ago

1.0.0-beta-3

9 months ago

1.0.0-beta-4

9 months ago

1.0.4

7 months ago

1.0.3

8 months ago

1.0.0-beta-9

9 months ago

1.0.0-beta-5

9 months ago

1.0.0-beta-6

9 months ago

1.0.0-beta-7

9 months ago

1.0.0-beta-8

9 months ago

0.0.25-beta-1

11 months ago

0.0.21-beta-2

12 months ago

0.0.25-beta-2

11 months ago

0.0.21-beta-1

12 months ago

0.0.13-beta-5

1 year ago

0.0.13-beta-4

1 year ago

0.1.0

10 months ago

0.0.20

12 months ago

0.0.21

12 months ago

0.0.22

12 months ago

0.0.24

11 months ago

1.0.3-beta-1

9 months ago

1.0.1-beta-1

9 months ago

1.0.3-beta-2

9 months ago

0.0.23-beta-14

11 months ago

0.0.23-beta-11

11 months ago

0.0.23-beta-10

11 months ago

0.0.23-beta-13

11 months ago

0.0.23-beta-12

11 months ago

0.0.15

1 year ago

0.0.16

1 year ago

0.0.17

1 year ago

0.0.18

1 year ago

0.0.19

1 year ago

0.1.0-beta-2

11 months ago

0.1.0-beta-1

11 months ago

0.1.0-beta-4

11 months ago

0.1.0-beta-3

11 months ago

0.0.13

1 year ago

0.0.14

1 year ago

0.1.0-beta-9

11 months ago

0.1.0-beta-6

11 months ago

0.1.0-beta-5

11 months ago

0.1.0-beta-8

11 months ago

0.1.0-beta-7

11 months ago

0.0.13-beta-1

1 year ago

0.0.13-beta-3

1 year ago

0.0.13-beta-2

1 year ago

0.0.12

1 year ago

0.0.11

1 year ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4-beta-3

1 year ago

0.0.4

1 year ago

0.0.4-beta-4

1 year ago

0.0.4-beta-2

1 year ago

0.0.4-beta-1

1 year ago

0.0.3

1 year ago