Skip to content

NO ACTIVITY Error  #183

Closed
Closed
@DivyaAndavarapu264

Description

@DivyaAndavarapu264

Which platform(s) does your issue occur on?

ANDROID
REAL DEVICE

Please, provide the following version numbers that your issue occurs with:

  • CLI: (run react-native --version to fetch it)-0.61.5
  • inappbrowser Version - 3.4.0

Please, tell us how to recreate the issue in as much detail as possible.

Describe the steps to reproduce it.

Is there any code involved?

import React, { Component } from "react";
import {
Platform,
StyleSheet,
Text,
View,
Button,
Alert,
TextInput,
StatusBar,
Linking,
BackHandler,
NativeModules,
ActivityIndicator
} from "react-native";
import InAppBrowser from "react-native-inappbrowser-reborn";
import NetInfo from "@react-native-community/netinfo";
import RNExitApp from 'react-native-exit-app';

export default class LoginScreen extends Component {
constructor(props) {
super(props);
this.state = {
url: "https://google.com/",
statusBarStyle: "dark-content",
isConnected: false
};
}

sleep(timeout) {
    return new Promise((resolve) => setTimeout(resolve, timeout));
}

async  componentDidMount() {
    await this.openLink()
}


async openLink() {
    const { url, statusBarStyle } = this.state;
    try {
        if (await InAppBrowser.isAvailable()) {
            // A delay to change the StatusBar when the browser is opened
            const animated = true;
            const delay = animated && Platform.OS === "ios" ? 400 : 0;
            // let url = "https://authenticity-stg.syngentadigitalapps.com"
            // setTimeout(() => StatusBar.setBarStyle('light-content'), delay);
            const result = await InAppBrowser.open(url, {
                // iOS Properties
                //   dismissButtonStyle: "cancel",
                //   preferredControlTintColor: "white",
                readerMode: false,
                modalPresentationStyle: "fullScreen",
                modalEnabled: true,
                enableBarCollapsing: true,

                // Android Properties
                showTitle: false,
                secondaryToolbarColor: "black",
                enableUrlBarHiding: false,
                enableDefaultShare: true,
                forceCloseOnRedirection: false,
                // Specify full animation resource identifier(package:anim/name)
                // or only resource name(in case of animation bundled with app).
                animations: {
                    startEnter: "slide_in_right",
                    startExit: "slide_out_left",
                    endEnter: "slide_in_left",
                    endExit: "slide_out_right",
                },
            }).then(async (res) => {
                // Alert.alert('Response', JSON.stringify(res));
                Platform.OS === "android" ? BackHandler.exitApp() : NativeModules.RNNativeModule.exitApp();
                // await this.sleep(800);
                // setTimeout(() => {
                //     Platform.OS === "android" ? BackHandler.exitApp() : NativeModules.RNNativeModule.exitApp();
                // }, 500)
            })
        } else {
            Linking.openURL(url);
        }
    } catch (error) {
        console.log("error", error)
    } finally {
        // StatusBar.setBarStyle(statusBarStyle);
    }
}
render() {
    return (
        <View style={styles.container}>
            <ActivityIndicator
                animating={true}
                style={styles.indicator}
                size="large"
            />
        </View>
    );
}

}

const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: "center",
alignItems: "center",
backgroundColor: "#F5FCFF",
padding: 30,
},
indicator: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
height: 80
},
welcome: {
fontSize: 20,
textAlign: "center",
margin: 10,
},
instructions: {
textAlign: "center",
color: "#333333",
marginBottom: 5,
},
urlInput: {
height: 40,
width: "100%",
borderColor: "gray",
borderWidth: 1,
},
openButton: {
paddingTop: Platform.OS === "ios" ? 0 : 20,
paddingBottom: Platform.OS === "ios" ? 0 : 20,
},
});

it is going to catch block no activity error is coming

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions