how can i open an external application in React Native?

Viewed 28

I want to know how to open an external application to the current one by pressing a button, because I was commissioned to create an application that makes changes in a database and then another already developed one is executed. I don't know if it's possible but I hope you can help me. From already thank you very much.

I tried with expo-linking, react-native-app-link, OpenAplication and rn-openapp. With OpenAplication it gives me an error that causes the application to close and in the others I didn't get good results, maybe it's that I didn't understand the documentation well or I don't know.

There is the code that I use and below I attach the app that I want to open, if you need anything else tell me.

import React from "react";
import { StatusBar } from "expo-status-bar";
import { StyleSheet, Text, TouchableOpacity, View } from "react-native";
import { MotiView } from "moti";
import * as Linking from "expo-linking";

const App = () => {

  return (
    <View>
      <StatusBar hidden={false} />
      <View style={{ marginTop: 150 }}>
        <Text style={{ fontSize: 25 }}>Cargando...</Text>
        <TouchableOpacity
          onPress={() => {
            Linking.openURL("https://stackoverflow.com/")
              .then((res) => {
                console.log(res);
              })
              .catch((err) => {
                console.log(err);
              });
          }}
        >
          <Text>Boton</Text>
        </TouchableOpacity>
      </View>
    </View>
  );
};

export default App;

const styles = StyleSheet.create({
  shape: {
    justifyContent: "center",
    height: 100,
    width: 100,
    borderRadius: 25,
    marginRight: 10,
    backgroundColor: "black",
  },
  container: {
    flex: 1,
    alignItems: "center",
    justifyContent: "center",
    flexDirection: "column",
    backgroundColor: "#fff",
  },
});

App i want to open

0 Answers
Related