Coder Social home page Coder Social logo

Comments (16)

cgav avatar cgav commented on May 18, 2024 2

@gtokman could you please check whether #157 fixes the problem?

@kirillzyusko I had the same issue and applying the patch from your PR fixes the crash for me. Thank you 👍

from react-native-keyboard-controller.

kirillzyusko avatar kirillzyusko commented on May 18, 2024 2

Awesome @cgav Glad to know the fix is actually working!
I'm going to merge this PR within this week and prepare a new release, since it's quite impactful change 😎

from react-native-keyboard-controller.

bcgilliom avatar bcgilliom commented on May 18, 2024 2

@kirillzyusko it seems to be extremely rare - we had a few reports early on, so I wasn't sure at first. I'll bump the library to latest and report back 👍 Thanks for all of your help and work on this lib. It's been great!

from react-native-keyboard-controller.

kirillzyusko avatar kirillzyusko commented on May 18, 2024 1

@gtokman I guess it happens on latest version of the library, right?

As an intermediate solution I can suggest to revert back to 1.4.4

In a meantime I'll try to find a solution and provide a fix 🙂

from react-native-keyboard-controller.

gtokman avatar gtokman commented on May 18, 2024 1

@kirillzyusko yes, on the latest version of the library and 2.14 for reanimated.

from react-native-keyboard-controller.

gunnartorfis avatar gunnartorfis commented on May 18, 2024 1

@kirillzyusko Thanks for the info. I will downgrade for now and keep a close eye on this.

Feel free to tag me if there's anything I can do to help out.

from react-native-keyboard-controller.

kirillzyusko avatar kirillzyusko commented on May 18, 2024 1

@bcgilliom can you please test 1.11.0 and if it's still reproducible, then open a new issue? 🙏

And maybe you can shed some light on additional aspects, such as how frequently it happens, how much users are affected (in percentage, like 0.02% or smth like that), and maybe when it happens (maybe user navigated from modal screen to non-modal or something else)?

from react-native-keyboard-controller.

kirillzyusko avatar kirillzyusko commented on May 18, 2024

@gtokman could you please also tell more about how do you use the library and when this exception occurs?

How many KeyboardProviders do you have? When this exception occurs (I guess when keyboard becomes hidden, but how long do you need to show/hide keyboard before you meet an exception? Maybe you see the exception when you switch between different type of keyboards (like number/alphabetical keyboard)?

from react-native-keyboard-controller.

kirillzyusko avatar kirillzyusko commented on May 18, 2024

@gtokman also, if you are able to test, could you please try to change:

keyboardView?.removeObserver(self, forKeyPath: "center", context: nil)

to

_keyboardView?.removeObserver(self, forKeyPath: "center", context: nil)

Just add _ to keyboardView variable.

I have an assumption, that when we refer to keyboardView it may re-run a process of finding a view and return a new instance without a listener 🤷‍♂️

from react-native-keyboard-controller.

kirillzyusko avatar kirillzyusko commented on May 18, 2024

@gtokman could you please check whether #157 fixes the problem?

from react-native-keyboard-controller.

gunnartorfis avatar gunnartorfis commented on May 18, 2024

FYI I'm also having this issue. I'm just using the KeyboardProvider in my App.tsx, and then in one place in my app:

 React.useEffect(() => {
    const show = KeyboardEvents.addListener('keyboardWillShow', () => {
      bottomSheetRef.current?.expand();
    });

    return () => {
      show.remove();
    };
}, []);

The thing is that I can't reproduce this myself but Sentry has reported over 2.5k users experiencing this. What's weird to me about that 2.5k number is that the feature where the above code is, isn't much used. Could it be that the crash occurs when just applying the KeyboardProvider?

from react-native-keyboard-controller.

kirillzyusko avatar kirillzyusko commented on May 18, 2024

Hi @gunnartorfis

Yes, the issue will occur when you've wrapped app into KeyboardProvider (underhood it'll render KeyboardControllerView which setup all listeners and etc.).

@gunnartorfis could you please try to apply patch from #157 and see whether the amount of errors will be decreased?

from react-native-keyboard-controller.

gunnartorfis avatar gunnartorfis commented on May 18, 2024

Hi @gunnartorfis

Yes, the issue will occur when you've wrapped app into KeyboardProvider (underhood it'll render KeyboardControllerView which setup all listeners and etc.).

@gunnartorfis could you please try to apply patch from #157 and see whether the amount of errors will be decreased?

I see, thanks. Since I'm unable to reproduce the issue myself I don't want to release the patch to production until it has been released. If you have any ideas on how I might reproduce this myself then I'd be happy to. It seems to be hitting quite the range of iOS versions, etc - I'm on 16.3 myself.

Screenshot 2023-06-01 at 09 12 22 Screenshot 2023-06-01 at 09 12 58 Screenshot 2023-06-01 at 09 12 18

from react-native-keyboard-controller.

kirillzyusko avatar kirillzyusko commented on May 18, 2024

@gunnartorfis that's the problem that I don't know how to reproduce this crash 🤷‍♂️ I can not reproduce the problem in example app and I don't have reproducible example.

I have only guesses, that the reference to the keyboard view is changing and I'm trying to remove an observer which doesn't exist anymore... I really hope this patch can fix everything - if not, then I'll be happy to continue investigation on how to resolve the problem. The new version of the library 1.5.4 will be published today.

@gunnartorfis since you are not using other functionality apart of keyboardWillShow you can safely downgrade keyboard-controller version to 1.4.4 - this version will not have crashes, since I'm not using KVO mechanism in this version.

from react-native-keyboard-controller.

kirillzyusko avatar kirillzyusko commented on May 18, 2024

GitHub automatically closed this issue since PR that had a reference to this issue was merged.

I've published 1.5.4 to npm-registry. Hopefully the issue is resolved, but in any case feel free to re-open this issue or feel free to create a new one.

from react-native-keyboard-controller.

bcgilliom avatar bcgilliom commented on May 18, 2024

I'm seeing this issue in bugsnag with 1.10.3 Here's the stack trace:

Hardware Model:     iPhone14,5
Process:            App
Identifier:         com.app
Role:               Foreground
OS Version:         iOS 16.5


NSRangeException: Cannot remove an observer <KeyboardMovementObserver 0x283160310> for the key path "center" from <UIInputSetHostView 0x10b613c70> because it is not registered as an observer.

0  CoreFoundation +0x9cb0      ___exceptionPreprocess
1  libobjc.A.dylib +0x183cc    _objc_exception_throw
2  Foundation +0x6621c         -[NSObject(NSKeyValueObserverRegistration) _removeObserver:forProperty:]
3  Foundation +0x65f5c         -[NSObject(NSKeyValueObserverRegistration) removeObserver:forKeyPath:]
4  Foundation +0x65e6c         -[NSObject(NSKeyValueObserverRegistration) removeObserver:forKeyPath:context:]
5  App +0x571850           KeyboardMovementObserver.removeKVObserver() (KeyboardMovementObserver.swift:98:20)
6  App +0x572b50           @objc KeyboardMovementObserver.keyboardWillAppear(_:)
7  CoreFoundation +0x3758c     ___CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__
8  CoreFoundation +0xdb824     ____CFXRegistrationPost_block_invoke
9  CoreFoundation +0xbe8b4     __CFXRegistrationPost
10 CoreFoundation +0x4baf8     __CFXNotificationPost
11 Foundation +0x5cd34         -[NSNotificationCenter postNotificationName:object:userInfo:]
12 UIKitCore +0xb7ed9c         -[UIInputWindowController postNotificationName:userInfo:]
13 UIKitCore +0x39245c         ___68-[UIInputWindowController postValidatedStartNotifications:withInfo:]_block_invoke
14 UIKitCore +0x3b2e28         -[UIInputWindowController postValidatedStartNotifications:withInfo:]
15 UIKitCore +0x314424         -[UIInputWindowController postStartNotifications:withInfo:]
16 UIKitCore +0xb7fad4         ___77-[UIInputWindowController moveFromPlacement:toPlacement:starting:completion:]_block_invoke_4
17 UIKitCore +0x3d8ad0         +[UIView(UIViewAnimationWithBlocksPrivate) _modifyAnimationsWithPreferredFrameRateRange:updateReason:animations:]
18 UIKitCore +0xcd2ac          +[UIView _setupAnimationWithDuration:delay:view:options:factory:animations:start:animationStateGenerator:completion:]
19 UIKitCore +0x5538c0         +[UIView(UIViewAnimationWithBlocks) _animateWithDuration:delay:options:animations:start:completion:]
20 UIKitCore +0x2ce2b4         -[UIInputViewAnimationStyle launchAnimation:afterStarted:completion:forHost:fromCurrentPosition:]
21 UIKitCore +0x2ce174         -[_UIViewControllerKeyboardAnimationStyle _launchAnimation:afterStarted:completion:forHost:fromCurrentPosition:]
22 UIKitCore +0x2cde80         +[UIView(Animation) _performWithAnimation:]
23 UIKitCore +0x2cddc8         -[_UIViewControllerKeyboardAnimationStyle launchAnimation:afterStarted:completion:forHost:fromCurrentPosition:]
24 UIKitCore +0xb807d0         ___77-[UIInputWindowController moveFromPlacement:toPlacement:starting:completion:]_block_invoke.459
25 UIKitCore +0x36f4e4         -[UIInputWindowController chainPlacementsIfNecessaryFrom:toPlacement:transition:completion:]
26 UIKitCore +0x36ca9c         -[UIInputWindowController moveFromPlacement:toPlacement:starting:completion:]
27 UIKitCore +0x36bc00         -[UIInputWindowController setInputViewSet:]
28 UIKitCore +0x36b638         -[UIInputWindowController performOperations:withAnimationStyle:]
29 UIKitCore +0x27b92c         -[UIKeyboardSceneDelegate setKeyWindowSceneInputViews:animationStyle:]
30 UIKitCore +0x27ae20         -[UIKeyboardSceneDelegate setInputViews:animationStyle:]
31 UIKitCore +0x204678         -[UIKeyboardSceneDelegate setInputViews:animated:]
32 UIKitCore +0x20168c         -[UIKeyboardSceneDelegate setInputViews:]
33 UIKitCore +0x8ea2e4         ___102-[UIKeyboardSceneDelegate _reloadInputViewsForKeyWindowSceneResponder:force:fromBecomeFirstResponder:]_block_invoke.329
34 UIKitCore +0x8e9d74         -[UIKeyboardSceneDelegate _reloadInputViewsForKeyWindowSceneResponder:force:fromBecomeFirstResponder:]
35 UIKitCore +0x8e8a30         -[UIKeyboardSceneDelegate _reloadInputViewsForResponder:force:fromBecomeFirstResponder:]
36 UIKitCore +0x27c8c0         -[UIResponder(UIResponderInputViewAdditions) reloadInputViews]
37 UIKitCore +0x21a44c         -[UIResponder becomeFirstResponder]
38 UIKitCore +0xfdb73c         ___99-[_UIRemoteViewController _serviceWantsKeyboardEventsWithPromotedFirstResponder:completionHandler:]_block_invoke

from react-native-keyboard-controller.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.