Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling ImageMarker causes 'Illegal callback invocation from native module' on Android #12

Closed
richardkarsten opened this issue Apr 3, 2018 · 5 comments

Comments

@richardkarsten
Copy link

richardkarsten commented Apr 3, 2018

  • "react": "16.2.0"
  • "react-native": "0.53.3"
  • "react-native-image-marker": "^0.1.3"

bildschirmfoto 2018-04-03 um 14 49 56

_markImageWithOverlay = () => {
        ImageMarker.markWithImage(this.state.rawImage, this.state.overlay, 0, 0, 0.81).then((path) => {
            this.setState({
                editedImage: Platform.OS === 'android' ? 'file://' + path : path,
            });
        }).catch((err) => {
            console.log(err);
        });
    }
    render() {
        return (
            <View style={styles.container}>
                <Image source={{ uri: this.state.editedImage }} style={styles.imagePreview} />
                <TouchableOpacity onPress={this._markImageWithOverlay}>
                    <Text>Test</Text>
                </TouchableOpacity>
            </View>
        );
    }
}
@richardkarsten richardkarsten changed the title Calling ImageMarker causes 'Illegal callback invocation from native module' Calling ImageMarker causes 'Illegal callback invocation from native module' on Android Apr 3, 2018
@richardkarsten
Copy link
Author

Solved:

this.state.overlay was an url-string. This method is working on iOS but not on Android. Any solution for dealing whith images from a network?

@JimmyDaddy
Copy link
Owner

Yes, Android only support mark local image for now. I'm working on marking remote image

@richardkarsten
Copy link
Author

Maybe there should be a new issue for this?

@richardkarsten
Copy link
Author

Workaround: Use the downloadFile function from RNFS. Cache all your images to local storage and use cached images for marking. I think this is also a good solution, if you working with a lot of files from an API or something.

@JimmyDaddy
Copy link
Owner

Downloading to local storage is a good solution, good job

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants