testfairy / react-native-testfairy

React Native component for TestFairy SDK
https://www.testfairy.com
Apache License 2.0
33 stars 12 forks source link

hideView() doesn't always work on Android #18

Closed dmitryn closed 6 years ago

dmitryn commented 6 years ago

TestFairy.hideView() doesn't always hide view on Android when you call it from componentDidMount like described in example code https://docs.testfairy.com/SDK/Hiding_Sensitive_Data.html#react-native

const TestFairy = require('react-native-testfairy');
var MyComponent = React.createClass({

    componentDidMount: function() {
        TestFairyBridge.hideView(this.refs.instructions);
    },

    render: function() {
        return (<Text ref="instructions">This will be hidden</Text>);
    }
});

It happens because activity.findViewById() returns null sometimes https://github.com/testfairy/react-native-testfairy/blob/64acb8734b89cf12e9eca2028afdd607b1117d7b/android/src/main/java/com/testfairy/react/TestFairyModule.java#L223

Versions: "react-native: "0.53.3" "react-native-testfairy": "2.8.0"

vijaysharm commented 6 years ago

Hi @dmitryn thanks for reaching out. Can I ask you to send a message to support@testfairy.com with this message? I'd like to have a look at an example session, however, i wouldn't want you to provide that here. I will keep this issue open until we've resolved this issue.

dmitryn commented 6 years ago

Hi @vijaysharm , will send soon, thanks.

vijaysharm commented 6 years ago

After working with @dmitryn, we discovered that there was a bug that has since been resolved in version 2.10.0 commit. Closing issue.