question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unsupported top level event type "topLoadingStart" dispatched in Custom WebView

See original GitHub issue

Is this a bug report?

I believe so.

Have you read the Contributing Guidelines?

Yes.

Environment

Environment: OS: macOS Sierra 10.12.6 Node: 8.7.0 Yarn: 1.2.1 npm: 5.4.2 Watchman: 4.7.0 Xcode: Xcode 9.1 Build version 9B55 Android Studio: 2.3 AI-162.4069837

Packages: (wanted => installed) react: 16.0.0 => 16.0.0 react-native: 0.50.3 => 0.50.3

Target Platform: iOS (11.1)

Steps to Reproduce

We implemented a Custom WebView. It used to work in RN 0.49 (we were using the components/WebView.ios.js from master). I’m not an Objective-C developer and probably I’m doing something wrong. Our implementation looks like this:

// RCTCustomWebViewManager.h
#import <React/RCTWebViewManager.h>
#import <React/RCTWebView.h>

@interface RCTCustomWebViewManager : RCTWebViewManager

@end


// RCTCustomWebViewManager.m
#import "RCTCustomWebViewManager.h"

@interface RCTCustomWebViewManager () <RCTWebViewDelegate>

@end

@implementation RCTCustomWebViewManager { }
RCT_EXPORT_MODULE()
RCT_REMAP_VIEW_PROPERTY(keyboardDisplayRequiresUserAction, _webView.keyboardDisplayRequiresUserAction, BOOL)

- (UIView *)view
{
  RCTWebView *webView = [RCTWebView new];
  webView.delegate = self;
  return webView;
}

@end

Expected Behavior

I expect it works.

Actual Behavior

simulator screen shot - iphone 6 - 2017-11-15 at 17 19 15

Reproducible Demo

https://github.com/juangl/with-custom-webview

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
cbrevikcommented, Jan 23, 2018

Seems related to how events are resolved in requireNativeComponent.js

Spent a bit of time investigating this, and was about to submit a PR, but seems like @shergin already fixed this in master: https://github.com/facebook/react-native/commit/2afe7d4765ffc0d0c71d233211edd1d21972040e

So it will probably be working again in a future version of RN 👍

Edit: The reason why topLoadingStart was not referenced in the iOS code is because there’s a name-normalization method for events for iOS: https://github.com/facebook/react-native/blob/d2c569795ca07b6b7c0227cfc6d0b3bf5dd23b99/React/Base/RCTEventDispatcher.m#L20 Bit hacky, and makes debugging more difficult, but oh well. Yet another gotcha 😃

1reaction
cbrevikcommented, Nov 26, 2017

Quickly tested it out, and was able to reproduce the same error.

Regarding:

You’ll have to duplicate RCTWebViewManager.m, since the exported macro-defined methods/properties (with RCT_REMAP_VIEW_PROPERTY, RCT_EXPORT_METHOD, etc) are only picked up from the subclass, and not from the parent.

This should not be the case any more. With #14775 inheritance works on iOS as well.

I am not sure where the topLoadingStart event is coming from though. Searching through the code base I only find references in Android-code. Might be something changed with events on iOS from RN 0.49 -> 0.50.

Maybe @javache knows?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unsupported top level event type "topScroll" dispatched
The error occurs when running in the simulator and on the device (from xcode). This is the code to my application. I'm sure...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found