Skip to content

Unrecognised selector sent to instance #69

@nikesh8

Description

@nikesh8

Hello,
I am trying with the demo code and return a simple view with color. But when I have passed 'exampleprop' it will be throwing an error. My code Will looks like Below. Please refer attached screenshot for error.

RNVideoModule-Bridging-Header.h

//  Created by react-native-create-bridge
// RNVideoModule-Bridging-Header.h

// import RCTBridgeModule
#if __has_include(<React/RCTBridgeModule.h>)
#import <React/RCTBridgeModule.h>
#elif __has_include(“RCTBridgeModule.h”)
#import “RCTBridgeModule.h”
#else
#import “React/RCTBridgeModule.h” // Required when used as a Pod in a Swift project
#endif

// import RCTEventEmitter
#if __has_include(<React/RCTViewManager.h>)
#import <React/RCTViewManager.h>
#elif __has_include(“RCTViewManager.h”)
#import “RCTViewManager.h”
#else
#import “React/RCTViewManager.h” // Required when used as a Pod in a Swift project
#endif

RNVideoModule.m

//  Created by react-native-create-bridge

// import RCTViewManager
#if __has_include(<React/RCTViewManager.h>)
#import <React/RCTViewManager.h>
#elif __has_include(“RCTViewManager.h”)
#import “RCTViewManager.h”
#else
#import “React/RCTViewManager.h” // Required when used as a Pod in a Swift project
#endif

// import RCTEventDispatcher
#if __has_include(<React/RCTEventDispatcher.h>)
#import <React/RCTEventDispatcher.h>
#elif __has_include(“RCTEventDispatcher.h”)
#import “RCTEventDispatcher.h”
#else
#import “React/RCTEventDispatcher.h” // Required when used as a Pod in a Swift project
#endif

// Export a native module
// https://facebook.github.io/react-native/docs/native-modules-ios.html#exporting-swift
@interface RCT_EXTERN_MODULE(RNVideoModule, RCTViewManager)

// Map native properties to React Component props
// https://facebook.github.io/react-native/docs/native-components-ios.html#properties
RCT_EXPORT_VIEW_PROPERTY(exampleProp, NSString)

// Export methods to a native module
// https://facebook.github.io/react-native/docs/native-modules-ios.html#exporting-swift
RCT_EXTERN_METHOD(exampleMethod)

@end

RNVideoModuleManager.swift

//  Created by react-native-create-bridge

import Foundation

@objc(RNVideoModule)
class RNVideoModuleManager : RCTViewManager {
  // Export constants to use in your native module
//  override func constantsToExport() -> [String : Any]! {
//    return ["EXAMPLE_CONSTANT": "example"]
//  }

  // Return the native view that represents your React component
  override func view() -> UIView! {
    let player : UIView = UIView(frame: CGRect(origin: CGPoint(x: 0, y: 0), size: CGSize(width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.width)))
    player.backgroundColor = UIColor.red
    return player
  }

  // Implement methods that you want to export to the native module
  @objc func exampleMethod() {
    // The bridge eventDispatcher is used to send events from native to JS env
    // No documentation yet on DeviceEventEmitter: https://github.com/facebook/react-native/issues/2819
    self.bridge.eventDispatcher().sendAppEvent(withName: "EXAMPLE_EVENT", body: nil)
  }
}
<View style={{ flex: 1 }}>
             <RNVideoModuleView style={{ height: 300, width: 300 }} exampleProp={'Nikesh'} />
</View>

Please help me out with this issue to how to overcome.

NOTE: I am using Swift Modules for this

Simulator Screen Shot - iPhone 11 - 2020-07-15 at 16 30 53

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions