1.1.9 • Published 8 months ago

react-native-sjzt-booknavi v1.1.9

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

USAGE

/** 书籍位置信息 */
const location = {
  "clc": {
    "area": "智图办公区",
    "class": "小智书架",
    "shelf": 1,
    "direct": "B",
    "column": 2,
    "layer": 2,
    "deviceId": "1238aaa904a11c8",
    "layerId": 20
  }
};
export default function App() {
  let mapNativeRef = useRef<MapNativeRef | null>(null).current;
  const [mapConfig, setMapConfig] = useState<any>();
  const [direction, setDirection] = useState<directionProps>('side');
  /** 获取地图配置 */
  async function _getMapConfig() {
    const data = await getMapConfig();
    if (data.status === 200) {
      setMapConfig(data.results);
    }
  }
  /** 初始化 */
  useEffect(() => {
    _getMapConfig();
  }, [])
  return <View style={style.main}>
    {mapConfig && (
      <MapNative
        ref={(ref) => { mapNativeRef = ref }}
        width={800}
        height={500}
        mapConfig={mapConfig}
        borderRadius={20}
        location={location.clc}
        shelfInfo={{ shelfNum: 2 } || 2}
        showTips={true}
        background={`red`}
        onChange={(e)=>{console.log(e.direction)}}
      />
    )}
    <TouchableOpacity
      onPress={() => mapNativeRef?.toSwitch(setDirection)}
      style={style.button}
    >
      <Text style={style.button_text}>
        切换地图{direction === 'side' ? '正面' : '侧面'}
      </Text>
    </TouchableOpacity>
  </View>
}

const style = StyleSheet.create({
  main: {
    width: Dimensions.get('screen').width,
    height: Dimensions.get('screen').height,
    backgroundColor: `#CCCCCC`,
    display: 'flex',
    flexDirection: 'column',
    alignItems: 'center',
    justifyContent: 'center'
  },
  button: {
    marginTop: 50,
    width: `50%`,
    height: 70,
    backgroundColor: '#1890ff',
    display: 'flex',
    flexDirection: 'row',
    alignItems: 'center',
    justifyContent: 'center',
    borderRadius: 20
  },
  button_text: {
    fontSize: 30,
    color: `#FFFFFF`
  }
})
  • VERSION

    • 1.1.9

      • 优化地图尺寸自动适配
      • 优化地图文字标注文字自动适配
    • 1.1.8

      • 优化只有正面图时,禁用ref切换
    • 1.1.7

      • 更新当没有侧面视图时,直接使用正面视图
1.1.9

8 months ago

1.1.8

8 months ago

1.1.7

8 months ago

1.1.6

8 months ago

1.1.5

8 months ago

1.1.4

8 months ago

1.1.3

8 months ago

1.1.2

8 months ago

1.1.1

8 months ago

1.1.0

8 months ago

1.0.9

8 months ago

1.0.8

8 months ago

1.0.7

9 months ago

1.0.6

9 months ago

1.0.5

9 months ago

1.0.4

9 months ago

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago