Skip to content

Commit

Permalink
Merge pull request #2 from tryfoobar/fix/conflicting-event-emitter
Browse files Browse the repository at this point in the history
fix: conflicting RNEventEmitter name clashes with other libraries
  • Loading branch information
Cavallando authored Apr 1, 2024
2 parents ac0a81c + d5f3dcb commit 73ba436
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 121 deletions.
2 changes: 1 addition & 1 deletion example/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ target 'CommandbarExample' do
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
:flipper_configuration => flipper_config,
# :flipper_configuration => flipper_config,
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."
)
Expand Down
112 changes: 3 additions & 109 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
PODS:
- boost (1.76.0)
- CocoaAsyncSocket (7.6.5)
- CommandBarIOS (1.0.10)
- DoubleConversion (1.1.6)
- FBLazyVector (0.72.6)
Expand All @@ -11,71 +10,12 @@ PODS:
- React-Core (= 0.72.6)
- React-jsi (= 0.72.6)
- ReactCommon/turbomodule/core (= 0.72.6)
- Flipper (0.182.0):
- Flipper-Folly (~> 2.6)
- Flipper-Boost-iOSX (1.76.0.1.11)
- Flipper-DoubleConversion (3.2.0.1)
- Flipper-Fmt (7.1.7)
- Flipper-Folly (2.6.10):
- Flipper-Boost-iOSX
- Flipper-DoubleConversion
- Flipper-Fmt (= 7.1.7)
- Flipper-Glog
- libevent (~> 2.1.12)
- OpenSSL-Universal (= 1.1.1100)
- Flipper-Glog (0.5.0.5)
- Flipper-PeerTalk (0.0.4)
- FlipperKit (0.182.0):
- FlipperKit/Core (= 0.182.0)
- FlipperKit/Core (0.182.0):
- Flipper (~> 0.182.0)
- FlipperKit/CppBridge
- FlipperKit/FBCxxFollyDynamicConvert
- FlipperKit/FBDefines
- FlipperKit/FKPortForwarding
- SocketRocket (~> 0.6.0)
- FlipperKit/CppBridge (0.182.0):
- Flipper (~> 0.182.0)
- FlipperKit/FBCxxFollyDynamicConvert (0.182.0):
- Flipper-Folly (~> 2.6)
- FlipperKit/FBDefines (0.182.0)
- FlipperKit/FKPortForwarding (0.182.0):
- CocoaAsyncSocket (~> 7.6)
- Flipper-PeerTalk (~> 0.0.4)
- FlipperKit/FlipperKitHighlightOverlay (0.182.0)
- FlipperKit/FlipperKitLayoutHelpers (0.182.0):
- FlipperKit/Core
- FlipperKit/FlipperKitHighlightOverlay
- FlipperKit/FlipperKitLayoutTextSearchable
- FlipperKit/FlipperKitLayoutIOSDescriptors (0.182.0):
- FlipperKit/Core
- FlipperKit/FlipperKitHighlightOverlay
- FlipperKit/FlipperKitLayoutHelpers
- YogaKit (~> 1.18)
- FlipperKit/FlipperKitLayoutPlugin (0.182.0):
- FlipperKit/Core
- FlipperKit/FlipperKitHighlightOverlay
- FlipperKit/FlipperKitLayoutHelpers
- FlipperKit/FlipperKitLayoutIOSDescriptors
- FlipperKit/FlipperKitLayoutTextSearchable
- YogaKit (~> 1.18)
- FlipperKit/FlipperKitLayoutTextSearchable (0.182.0)
- FlipperKit/FlipperKitNetworkPlugin (0.182.0):
- FlipperKit/Core
- FlipperKit/FlipperKitReactPlugin (0.182.0):
- FlipperKit/Core
- FlipperKit/FlipperKitUserDefaultsPlugin (0.182.0):
- FlipperKit/Core
- FlipperKit/SKIOSNetworkPlugin (0.182.0):
- FlipperKit/Core
- FlipperKit/FlipperKitNetworkPlugin
- fmt (6.2.1)
- glog (0.3.5)
- hermes-engine (0.72.6):
- hermes-engine/Pre-built (= 0.72.6)
- hermes-engine/Pre-built (0.72.6)
- libevent (2.1.12)
- OpenSSL-Universal (1.1.1100)
- RCT-Folly (2021.07.22.00):
- boost
- DoubleConversion
Expand Down Expand Up @@ -376,7 +316,7 @@ PODS:
- React-jsinspector (0.72.6)
- React-logger (0.72.6):
- glog
- react-native-commandbar (1.0.1):
- react-native-commandbar (1.0.2):
- CommandBarIOS (= 1.0.10)
- RCT-Folly (= 2021.07.22.00)
- React-Core
Expand Down Expand Up @@ -492,46 +432,22 @@ PODS:
- React-perflogger (= 0.72.6)
- SocketRocket (0.6.1)
- Yoga (1.14.0)
- YogaKit (1.18.1):
- Yoga (~> 1.14)

DEPENDENCIES:
- boost (from `../node_modules/react-native/third-party-podspecs/boost.podspec`)
- DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
- FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`)
- FBReactNativeSpec (from `../node_modules/react-native/React/FBReactNativeSpec`)
- Flipper (= 0.182.0)
- Flipper-Boost-iOSX (= 1.76.0.1.11)
- Flipper-DoubleConversion (= 3.2.0.1)
- Flipper-Fmt (= 7.1.7)
- Flipper-Folly (= 2.6.10)
- Flipper-Glog (= 0.5.0.5)
- Flipper-PeerTalk (= 0.0.4)
- FlipperKit (= 0.182.0)
- FlipperKit/Core (= 0.182.0)
- FlipperKit/CppBridge (= 0.182.0)
- FlipperKit/FBCxxFollyDynamicConvert (= 0.182.0)
- FlipperKit/FBDefines (= 0.182.0)
- FlipperKit/FKPortForwarding (= 0.182.0)
- FlipperKit/FlipperKitHighlightOverlay (= 0.182.0)
- FlipperKit/FlipperKitLayoutPlugin (= 0.182.0)
- FlipperKit/FlipperKitLayoutTextSearchable (= 0.182.0)
- FlipperKit/FlipperKitNetworkPlugin (= 0.182.0)
- FlipperKit/FlipperKitReactPlugin (= 0.182.0)
- FlipperKit/FlipperKitUserDefaultsPlugin (= 0.182.0)
- FlipperKit/SKIOSNetworkPlugin (= 0.182.0)
- glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`)
- hermes-engine (from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`)
- libevent (~> 2.1.12)
- OpenSSL-Universal (= 1.1.1100)
- RCT-Folly (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`)
- RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`)
- RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety`)
- React (from `../node_modules/react-native/`)
- React-callinvoker (from `../node_modules/react-native/ReactCommon/callinvoker`)
- React-Codegen (from `build/generated/ios`)
- React-Core (from `../node_modules/react-native/`)
- React-Core/DevSupport (from `../node_modules/react-native/`)
- React-Core/RCTWebSocket (from `../node_modules/react-native/`)
- React-CoreModules (from `../node_modules/react-native/React/CoreModules`)
- React-cxxreact (from `../node_modules/react-native/ReactCommon/cxxreact`)
Expand Down Expand Up @@ -563,21 +479,10 @@ DEPENDENCIES:

SPEC REPOS:
trunk:
- CocoaAsyncSocket
- CommandBarIOS
- Flipper
- Flipper-Boost-iOSX
- Flipper-DoubleConversion
- Flipper-Fmt
- Flipper-Folly
- Flipper-Glog
- Flipper-PeerTalk
- FlipperKit
- fmt
- libevent
- OpenSSL-Universal
- SocketRocket
- YogaKit

EXTERNAL SOURCES:
boost:
Expand Down Expand Up @@ -664,24 +569,14 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
boost: 57d2868c099736d80fcd648bf211b4431e51a558
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
CommandBarIOS: c1a23c99189904541272206b66593ed9008c0d25
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
FBLazyVector: 748c0ef74f2bf4b36cfcccf37916806940a64c32
FBReactNativeSpec: 966f29e4e697de53a3b366355e8f57375c856ad9
Flipper: 6edb735e6c3e332975d1b17956bcc584eccf5818
Flipper-Boost-iOSX: fd1e2b8cbef7e662a122412d7ac5f5bea715403c
Flipper-DoubleConversion: 2dc99b02f658daf147069aad9dbd29d8feb06d30
Flipper-Fmt: 60cbdd92fc254826e61d669a5d87ef7015396a9b
Flipper-Folly: 584845625005ff068a6ebf41f857f468decd26b3
Flipper-Glog: 70c50ce58ddaf67dc35180db05f191692570f446
Flipper-PeerTalk: 116d8f857dc6ef55c7a5a75ea3ceaafe878aadc9
FlipperKit: 2efad7007d6745a3f95e4034d547be637f89d3f6
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b
hermes-engine: 8057e75cfc1437b178ac86c8654b24e7fead7f60
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c
RCT-Folly: 424b8c9a7a0b9ab2886ffe9c3b041ef628fd4fb1
RCTRequired: 28469809442eb4eb5528462705f7d852948c8a74
RCTTypeSafety: e9c6c409fca2cc584e5b086862d562540cb38d29
Expand All @@ -697,7 +592,7 @@ SPEC CHECKSUMS:
React-jsiexecutor: 3bf18ff7cb03cd8dfdce08fbbc0d15058c1d71ae
React-jsinspector: 194e32c6aab382d88713ad3dd0025c5f5c4ee072
React-logger: cebf22b6cf43434e471dc561e5911b40ac01d289
react-native-commandbar: d89f11f54c7b37a6da6bcc853cd716dd78e0510b
react-native-commandbar: d3d448f081992977aab4fe9b056ed1c443ebe362
React-NativeModulesApple: 02e35e9a51e10c6422f04f5e4076a7c02243fff2
React-perflogger: e3596db7e753f51766bceadc061936ef1472edc3
React-RCTActionSheet: 17ab132c748b4471012abbcdcf5befe860660485
Expand All @@ -717,8 +612,7 @@ SPEC CHECKSUMS:
ReactCommon: dd03c17275c200496f346af93a7b94c53f3093a4
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
Yoga: b76f1acfda8212aa16b7e26bcce3983230c82603
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a

PODFILE CHECKSUM: 06225a65a3da2ed681342fd9abd8d07b9d6df5ba
PODFILE CHECKSUM: 06a2174cbe5a4489922c51f2ca9ad31758bfa9db

COCOAPODS: 1.14.2
8 changes: 4 additions & 4 deletions ios/HelpHubViewManager.swift
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import CommandBarIOS


@objc(RNEventEmitter)
class RNEventEmitter : RCTEventEmitter {
@objc(RNCommandBarEventEmitter)
class RNCommandBarEventEmitter : RCTEventEmitter {

public static var emitter: RCTEventEmitter!

override init() {
super.init()
RNEventEmitter.emitter = self
RNCommandBarEventEmitter.emitter = self
}

override func supportedEvents() -> [String] {
Expand Down Expand Up @@ -46,7 +46,7 @@ class RNHelpHubView : UIView {

extension RNHelpHubView: HelpHubWebViewDelegate {
func didReceiveFallbackAction(_ action: [String : Any]) {
RNEventEmitter.emitter.sendEvent(withName: "onFallbackAction", body: action)
RNCommandBarEventEmitter.emitter.sendEvent(withName: "onFallbackAction", body: action)
}
}

Expand Down
3 changes: 1 addition & 2 deletions ios/RNCommandBar.mm
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ + (BOOL)requiresMainQueueSetup
}
@end


@interface RCT_EXTERN_MODULE(RNEventEmitter, RCTEventEmitter)
@interface RCT_EXTERN_MODULE(RNCommandBarEventEmitter, RCTEventEmitter)

RCT_EXTERN_METHOD(supportedEvents)

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@commandbar/react-native",
"version": "1.0.1",
"version": "1.0.2",
"description": "Copilot & HelpHub in React Native",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down
4 changes: 2 additions & 2 deletions src/CommandBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ export const RNCommandBar = NativeModules.RNCommandBar
}
);

export const RNEventEmitter = NativeModules.RNEventEmitter
? NativeModules.RNEventEmitter
export const RNCommandBarEventEmitter = NativeModules.RNCommandBarEventEmitter
? NativeModules.RNCommandBarEventEmitter
: new Proxy(
{},
{
Expand Down
4 changes: 2 additions & 2 deletions src/HelpHubView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from 'react-native';
import type { CommandBarOptions } from './CommandBar';
import type { ViewStyle } from 'react-native';
import { RNEventEmitter } from './CommandBar';
import { RNCommandBarEventEmitter } from './CommandBar';

export type HelpHubViewProps = {
options: CommandBarOptions;
Expand All @@ -17,7 +17,7 @@ export type HelpHubViewProps = {

const EventEmitter =
Platform.OS === 'ios'
? new NativeEventEmitter(RNEventEmitter)
? new NativeEventEmitter(RNCommandBarEventEmitter)
: DeviceEventEmitter;

export const HelpHubViewNative: React.ComponentClass<HelpHubViewProps> =
Expand Down

0 comments on commit 73ba436

Please sign in to comment.