Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create advanced example using an Obj-C category #3

Open
dsibiski opened this issue Sep 8, 2015 · 2 comments
Open

Create advanced example using an Obj-C category #3

dsibiski opened this issue Sep 8, 2015 · 2 comments
Assignees

Comments

@dsibiski
Copy link
Owner

dsibiski commented Sep 8, 2015

Try making the "Native Modal With RN Navigation" example using a category like the following example:

https://github.com/alinz/react-native-webview-bridge/blob/master/WebViewBridge/RCTWebViewManager%2BWebViewManager.m

@dsibiski dsibiski self-assigned this Sep 8, 2015
@chirag04
Copy link

chirag04 commented Sep 8, 2015

Also, at times composition could help extend a RN component. Not sure if this applies to Native Modal with RN Nav example.

Both these techniques(category, composition) are used here:

  1. [composition] github.com/chirag04/react-native-tooltip
  2. [category] https://github.com/chirag04/tooltip

@dsibiski
Copy link
Owner Author

dsibiski commented Sep 8, 2015

@chirag04 Thanks! I've looked at your tooltip project many times before as it has some very interesting solutions.

Essentially, the example referred to here is when you have an Obj-C view that loads a RCTBridge or RCTRootView. Sometimes you may want to expose methods from that base view to RN as a bridge module. However, when you create the bridge, JS has access to a different instance than Obj-C, since the bridge instantiates all bridge modules at load. This prevents you from being able to call methods on the view actually visible from JS. (I hope that isn't too confusing! hah)

I've discovered a couple different ways to do this, and an Obj-C category was suggested as one of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants