首页 > 解决方案 > 使用按钮 [Expo] 在 React Native App 中打开 Measure App (iOS)

问题描述

我正在尝试在我的 react 本机应用程序中打开Measure iPhone 应用程序。我曾尝试使用链接,但正如此 stackoverflow 问题中所述,Measure 不支持 URL 方案或深度链接。有没有其他方法可以在内部打开 Measure App 或从我的应用程序重定向到 Measure App 以反应原生?

import React, { Component } from 'react';
import { Button, Linking, View, StyleSheet } from 'react-native';
import Constants from 'expo-constants';

export default class App extends Component {
  render() {
    return (
      <View style={styles.container}>
        <Button
          title="Open Measure App"
          onPress={this._handleOpenWithLinking}
          style={styles.button}
        />
      </View>
    );
  }

  _handleOpenWithLinking = () => {
    // Should open the Measure App
    // This does not work as mentioned - Linking.openURL("measure://")
  };
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
    paddingTop: Constants.statusBarHeight,
    backgroundColor: '#ecf0f1',
  },
  button: {
    marginVertical: 10,
  },
});

标签: iosreact-nativeexpo

解决方案


推荐阅读