react-native-collapsing-toolbar icon indicating copy to clipboard operation
react-native-collapsing-toolbar copied to clipboard

bug when the phone is turned off in the app with the component

Open magestein opened this issue 6 years ago • 10 comments

Hello, I found a bug.. When the phone is turned off in the application and then the phone is turned on again then the collapsing component no longer works, is there any way to solve this? I add a video of the problem: https://streamable.com/7e3g8

Regards,

magestein avatar May 08 '18 16:05 magestein

Hi, thanks for report, have you experience this issue even with a production build? which react-native version are you using?

cesardeazevedo avatar May 08 '18 21:05 cesardeazevedo

Hi Cesar, thats happen in react-native 0.55.0.. and also happen with '--variant=release'. Is there a suggestion of compatibility with some version of react-native? Thanks

magestein avatar May 08 '18 22:05 magestein

I haven't tried new version from react-native yet, so i presume that new versions "just works".

Have you tried call the redraw() function from the AppBarLayout ref on componentDidMount or when the app came back from the background (by AppState)?

cesardeazevedo avatar May 08 '18 22:05 cesardeazevedo

I have try:

_handleAppStateChange = (nextAppState) => {
    if (this.state.appState.match(/inactive|background/) && nextAppState === 'active') {
        this.appBar.redraw();
    }
    this.setState({appState: nextAppState});
};

componentDidMount() {
    AppState.addEventListener('change', this._handleAppStateChange);
}

componentWillUnmount() {
    AppState.removeEventListener('change', this._handleAppStateChange);
}

<AppBarLayout ref={(ref) => { this.appBar = ref }}>
</AppBarLayout>

but without luck :(

magestein avatar May 08 '18 23:05 magestein

I have noted that redraw() some times work and some times not. Maybe the code that I showed is wrong?

magestein avatar May 08 '18 23:05 magestein

Interesting, i will take a look at it as soon as i get some time this week

cesardeazevedo avatar May 08 '18 23:05 cesardeazevedo

Thank you! I appreciate that very much!

magestein avatar May 09 '18 00:05 magestein

Hi, sorry for delayed response, i've fully reproduced your issue on my simulator, and i have tested your code and worked, i tested multiple times and never had any single attempt that didn't worked.

Here's a demonstration collapsing

Or maybe i am testing wrong? any idea?

I also don't think this is the best solution at all, it's actually really hard to understand how native modules behave in certain situations, i will still think in some pleasant solution.

cesardeazevedo avatar May 14 '18 07:05 cesardeazevedo

try it in on real device you will see the problem

mahmoudelfeky avatar Oct 15 '18 14:10 mahmoudelfeky

@magestein Hello, how did you solve it? I'm just like you, but I happened when the application was started, not when the application was waked up. #21

A-ANing avatar Aug 08 '19 03:08 A-ANing