Commit Graph

74 Commits

Author SHA1 Message Date
Vojtech Novak 1de9a35f14 document how to export consts from a swift native module
Summary:
I documented how to export consts from a swift native module.
Closes https://github.com/facebook/react-native/pull/15340

Differential Revision: D5556264

Pulled By: hramos

fbshipit-source-id: 0374f1c291e3c15424c8e53fef7ab30c60643165
2017-08-03 13:13:25 -07:00
Finian 4a8ad10b4d Docs: fix typo
Summary:
Fix typo in NativeModulesIOS.md doc
Closes https://github.com/facebook/react-native/pull/15306

Differential Revision: D5536657

Pulled By: javache

fbshipit-source-id: da8d183ef97995baa3b44595ff63ca3b1ced6b4e
2017-08-02 03:12:44 -07:00
Hector Ramos d1c9746902 Move CONTRIBUTING guidelines to a standalone doc in the website.
Reviewed By: TheSavior

Differential Revision: D5448961

fbshipit-source-id: c8491b003413e8af22987ea578d6f7bbe1552b31
2017-07-19 10:23:06 -07:00
Liron Yahdav dec62ffc3e Clarify JavaScript module naming edge case
Summary:
I've been burned by https://stackoverflow.com/questions/35052565/undefined-is-not-an-object-from-native-module-in-react-native/36580178 a few times, when I name a native module with RCT prefix. This will hopefully save me and others from that pain in the future.

<!--
Thank you for sending the PR!

If you changed any code, please provide us with clear instructions on how you verified your changes work. In other words, a test plan is *required*. Bonus points for screenshots and videos!

Please read the Contribution Guidelines at https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md to learn more about contributing to React Native.

Happy contributing!
-->
Closes https://github.com/facebook/react-native/pull/14903

Differential Revision: D5390343

Pulled By: hramos

fbshipit-source-id: 73667d703b097e70e15ff42c54b7ccc6b480104f
2017-07-10 11:36:48 -07:00
Ethan Lillie 2083516f45 Correct its/it's homophone in NativeModulesIOS.md
Summary: Closes https://github.com/facebook/react-native/pull/14522

Differential Revision: D5254055

Pulled By: javache

fbshipit-source-id: aa764fc15baaeb349573b443ec24bbdea1255de9
2017-06-15 03:30:33 -07:00
Hector Ramos 0a6935618c Add support for syntax highlighting for languages other than JS
Summary:
The current website defaults to using JavaScript for any code block, regardless of language tag. This PR adds syntax highlighting support by passing the necessary language prop and by adding any missing languages to Marked.js.

Depends on #14212, #14065
Closes https://github.com/facebook/react-native/pull/14215

Differential Revision: D5149897

Pulled By: hramos

fbshipit-source-id: 95a817af2168d5743c75dd1ac030d399a68fb93c
2017-05-30 14:36:06 -07:00
Jeff kang b11dc39430 Add missing semicolon in NativeModulesIOS.md
Summary:
` ConstantsconstantsToExport` in` EnumConstants` has an error. It is a missing a closing curly braces after `return`.

Do not need a test.
Closes https://github.com/facebook/react-native/pull/13911

Differential Revision: D5145977

Pulled By: shergin

fbshipit-source-id: 267ea7d69253d10aaef763879318824b6e02d2c5
2017-05-29 16:15:13 -07:00
Liron Yahdav cf5c549633 Update NativeModulesIOS.md
Summary:
Incorrectly says "seconds" while JS `getTime` returns milliseconds.

Documentation fix.

N/A
Closes https://github.com/facebook/react-native/pull/13719

Differential Revision: D4978003

Pulled By: javache

fbshipit-source-id: 6568e90b6e0650078ebc1c8652f71fb94bfe8a59
2017-05-01 06:03:20 -07:00
Robin Chou 269458c613 Update docs to clarify `RCT_REMAP_METHOD` usage.
Summary:
The current docs (iOS) for promises make use of the `RCT_REMAP_METHOD` macro but it's not clear about the proper usage for the macro. Specifically, it points to a selector of `resolver:rejector:` and makes it seem like `findEvents` is assumed as both the alias and method name.

This has led to some confusion (#9070) on how to use `RCT_REMAP_METHOD`.

No tests needed since this is just a small docs update.
Closes https://github.com/facebook/react-native/pull/13302

Differential Revision: D4831755

Pulled By: javache

fbshipit-source-id: e842c16ade27088eafdac7509373cdf7780f9ece
2017-04-05 11:00:31 -07:00
Hector Ramos c503dae446 Merge Android UI Performance into Performance doc, reorder sidebar
Summary:
Doing some cleanup in preparation for CRNA.
Recommend `FlatList` and React Navigation for perf.
Tag docs that may only apply to apps ejected from CRNA. Currently has no effect.
Closes https://github.com/facebook/react-native/pull/12692

Differential Revision: D4654077

Pulled By: hramos

fbshipit-source-id: 1245d80d66e37d9dca9e9daf23e8b93c65cd1bf7
2017-03-06 10:10:04 -08:00
Kevin Lacker f43d0a9678 Clearer information regarding RCT_EXPORT_MODULE
Summary:
I think this update is Critical as I wanted to add a different module name to be the same as the Android module name. I simply lost 6 hours until I found out that the Macro does not accept String syntax. Almost drove me crazy. Please, at least do something about it. Thanks.

Thanks for submitting a pull request! Please provide enough information so that others can review your pull request:

> **Unless you are a React Native release maintainer and cherry-picking an *existing* commit into a current release, ensure your pull request is targeting the `master` React Native branch.**

Explain the **motivation** for making this change. What existing problem does the pull request solve?

Prefer **small pull requests**. These are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it.

**Test plan (required)**

Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI
Closes https://github.com/facebook/react-native/pull/11634

Differential Revision: D4533312

Pulled By: lacker

fbshipit-source-id: 2c547f791ed76ba62e0c7e5cabc2830dbae34075
2017-02-08 16:46:13 -08:00
Kevin Lacker edd957007d Docs: add warining about possible memory leaks while using native mod…
Summary:
Currently callbacks passed to native method are stored in [MessageQueue](https://github.com/facebook/react-native/blob/master/Libraries/BatchedBridge/MessageQueue.js#L160-L162) and [will be removed after invocation](https://github.com/facebook/react-native/blob/master/Libraries/BatchedBridge/MessageQueue.js#L273-L274), so to avoid memory leak in js-side the passed callback(s) must be invoked by native method.

Because of this significant nuance of callbacks usage, which is not (or not directly) mentioned  in docs, we have gained huge increase of ooms count in our app. So, I think this warning will help other developers to avoid this issue
Closes https://github.com/facebook/react-native/pull/11444

Differential Revision: D4532764

Pulled By: lacker

fbshipit-source-id: 34e99fa4944c3333b2198c1abd53c0da10732749
2017-02-08 16:00:12 -08:00
janus_wel bc432ae324 fix typo RTC to RCT
Summary:
Explain the **motivation** for making this change. What existing problem does the pull request solve?

Descriptions about class names are incorrect.
Closes https://github.com/facebook/react-native/pull/11898

Differential Revision: D4418957

fbshipit-source-id: fc7d0b61149ed9f850a436a35ad98f179b5e3e19
2017-01-13 18:58:23 -08:00
Rob Hogan 8729d27206 Document subclassing RCTEventEmitter
Summary:
Sending global events with `eventDispatcher` has been [deprecated](d9737571c4) since 0.28, with a recommendation to subclass `RCTEventEmitter` instead, but there were no docs for this.

This updates the iOS native module to use the recommended way, and also documents the use of `stopObserving` and `startObserving`.

Tested and working in a real app.

cc nicklockwood
Closes https://github.com/facebook/react-native/pull/11792

Differential Revision: D4394626

fbshipit-source-id: 68b26d35944a521bf683a50ec1ab21f03b5e99d8
2017-01-09 14:43:50 -08:00
Rob Hogan c31f44814c - Update iOS native module #imports
Summary:
`#import` paths changed in 0.40 - this updates the docs accordingly.
Closes https://github.com/facebook/react-native/pull/11765

Differential Revision: D4390996

fbshipit-source-id: 3b391fe6e462952efa461bb61fc91675611e3dfa
2017-01-07 12:13:33 -08:00
Michael Weibel aa41dfbcf7 Fix typo
Summary:
**Motivation:** Fixing a typo
Closes https://github.com/facebook/react-native/pull/10446

Differential Revision: D4048865

Pulled By: lacker

fbshipit-source-id: 1ba55f61f50e656cd110291c658a034535040895
2016-10-19 17:58:52 -07:00
Joshua May 0f3d24c7fb Updates Swift @objc export for recent Swift versions
Summary:
As of Swift 3, [Swift converts Objective-C API names based on parameters](https://github.com/apple/swift-evolution/blob/master/proposals/0005-objective-c-name-translation.md), so the docs should explicitly declare what the Objective-C API is (because it's also used in the JavaScript side too).

An alternative to this would be to update the Objective-C and JavaScript calls to be `addEventWithName:location:date:` / `addEventWithName()` based on the default Swift API, but I think the approach in the PR is most correct here.
Closes https://github.com/facebook/react-native/pull/10176

Differential Revision: D4001604

Pulled By: hramos

fbshipit-source-id: cd4143d19d2d375288a086b9d7995e75fe1e9170
2016-10-11 07:43:52 -07:00
Tim Creasy 707aba822e Added RCTLog.h import for clarity
Summary:
Explicitly show import statements in example implementation file.  Xcode build fails unless RCTLog is imported.  Adding this clarifies this, as it is not stated anywhere else.
Closes https://github.com/facebook/react-native/pull/10117

Differential Revision: D3952631

Pulled By: javache

fbshipit-source-id: f268ff53ee2cf69aabd83c3305c5c25add338d83
2016-09-30 12:58:37 -07:00
Josh Hargreaves 66abc86c9a Doc. Update For Module Dependency Injection
Summary:
Added details about how IOS Native Modules can be initialized & registered manually with custom initializers so that dependencies can be injected to said modules.

Please let me know if there is a more appropriate place to detail this in the documentation or this is in fact detailed elsewhere; I also believe we do not have documentation on how to do the equivalent on Android, however it is a bit more obvious as the automatic MACRO registration mechanism does not exist on Android and modules need to be initialized manually anyway. As I currently understand there isn't currently any documentation detailing this apart from comments in the source.

Please let me know if you would require any style changes (variable names etc), to be more en-keeping with the rest of the documentation.
Closes https://github.com/facebook/react-native/pull/8406

Differential Revision: D3843018

Pulled By: javache

fbshipit-source-id: 5f4001df32d1ddc00a9dacc4fc99b63b408f1536
2016-09-09 12:28:46 -07:00
Arian Stolwijk a02c238464 Fix code example: NSNumber should be marked `nonnull` for compatibility with Android
Summary:
I was following the Native Modules guide for iOS, when I noticed this error in the example code:

> Argument 2 (NSNumber) of CalendarManager.addEvent has unspecified nullability but React requires that all NSNumber arguments are explicitly marked as `nonnull` to ensure compatibility with Android.

Marking the parameter NSNumber type as `nonnull` fixes the error in the example.
Closes https://github.com/facebook/react-native/pull/9705

Differential Revision: D3804661

Pulled By: JoelMarcey

fbshipit-source-id: 92ec8a08ff2a179e4a8935de4cecd7b8d993469b
2016-09-01 08:43:48 -07:00
Joel Marcey b1e49832ef Make prev links work in guides and APIs.
Summary:
We had rendering support for prev links, but we never had any previous links in our metadata. Only next links. This adds that support to both Guides and APIs.

**For guides**: `previous` is manually inserted into the metadata of the actual markdown file.
**For APIs/Components**: `previous` is established via code within `extractDocs.js`

> This isn't totally perfect. For example, the transition from the last guide to the first API/component has a next link from the guide, but not a previous link from the API since the way you get the previous links are different from guides and APIs. But this gets us really close.
Closes https://github.com/facebook/react-native/pull/8754

Differential Revision: D3557972

Pulled By: hramos

fbshipit-source-id: e270bb51e7a4f59f61dad28ae0928d27d0af3d4a
2016-07-13 14:58:27 -07:00
sunnylqm 4301998e15 map -> object
Summary: Closes https://github.com/facebook/react-native/pull/8450

Differential Revision: D3488018

fbshipit-source-id: a30269c89e87b546f77da7a32b1c4c65d978459d
2016-06-27 03:13:23 -07:00
Alper Cugun 2fe67162ae Added objective-c class/module semantics
Summary:This really stumped me and I thought it could be added to the docs.
Closes https://github.com/facebook/react-native/pull/6136

Differential Revision: D2973912

Pulled By: mkonicek

fb-gh-sync-id: 0da1a946e2c2ad00056037a6492be3e99096582e
shipit-source-id: 0da1a946e2c2ad00056037a6492be3e99096582e
2016-03-08 07:07:27 -08:00
Xing Zheng b8850df31b typo with in code, replace date.toTime with date.getTime
Summary:There is no toTime method on a Date object, It should be getTime.
Closes https://github.com/facebook/react-native/pull/6054

Differential Revision: D2971217

fb-gh-sync-id: 4140be25f0704f251cc0e2f47db8fa83992dc0f0
shipit-source-id: 4140be25f0704f251cc0e2f47db8fa83992dc0f0
2016-02-24 06:20:32 -08:00
briancaw 5c18158aa9 Fixes NativeModules documentation typo
Reviewed By: svcscm

Differential Revision: D2938100

fb-gh-sync-id: f2a3a479fb504fdbbae3a864009e290ef9b5539d
shipit-source-id: f2a3a479fb504fdbbae3a864009e290ef9b5539d
2016-02-15 14:56:33 -08:00
Mateusz Zatorski 3ae99d0fea replace require with es6 import in docs
Reviewed By: svcscm

Differential Revision: D2936839

fb-gh-sync-id: 7a921709a37de5e9aadf324d5438d51851326348
shipit-source-id: 7a921709a37de5e9aadf324d5438d51851326348
2016-02-14 15:03:34 -08:00
Thomas Parslow b5579e807e Updated RCTPromiseRejectBlock example to use new 3 argument form
Reviewed By: svcscm

Differential Revision: D2931949

fb-gh-sync-id: d5da545c882e662f9c5d5b33cc3b152a4269bbb8
shipit-source-id: d5da545c882e662f9c5d5b33cc3b152a4269bbb8
2016-02-12 05:29:31 -08:00
Nader Dabit e2b035acf2 fixed documentation error for native modules docs page 2015-12-14 15:10:46 -06:00
zjlovezj e6c8848c07 fix sample code error by removing the extra chars
fix sample code error by removing the extra ',' and ')'
2015-12-12 19:21:31 +08:00
Satyajit Sahoo fdca4224bc Added docs on using Promisesin Native Modules 2015-11-24 02:51:51 +05:30
sunnylqm ab654b129f fix typo
fix: date.toTime() => date.getTime()
2015-11-11 11:06:40 +08:00
Divyendu Singh 484e6403b3 add missing curly brace in NativeModulesIOS.md 2015-10-25 01:04:59 +05:30
Nikita Gusakov e55b373a61 Split iOS and Android docs into different categories 2015-09-18 20:54:05 +03:00
Martin Konicek 42eb5464fd Release React Native for Android
This is an early release and there are several things that are known
not to work if you're porting your iOS app to Android.

See the Known Issues guide on the website.

We will work with the community to reach platform parity with iOS.
2015-09-14 18:13:39 +01:00
Martin Konicek 01911e5e06 [docs] Make it clear which Guides are platform-specific
This is in preparation for open sourcing React Native for Android.
Also add hyphens to URLs for consistency. This can break people's
browser bookmarks but it's better to be consistent and we can
redirect to docs: https://github.com/facebook/react-native/issues/2137

Test plan: Ran the website locally using `cd website; npm start`
and checked all pages render correctly.
http://i.imgur.com/RrPNgRr.png

Will update "Getting Started", "Tutorial", "Debugging" and
"Testing" separately.
2015-07-27 18:17:54 +01:00
Tj 1e5f22dc9c Updating for Code Review
Using UIStatusBarAnimation for real world example
2015-07-21 18:11:58 -04:00
Tj 4d3c3e625e Enum Constants Explanation
Explains the use of `RCT_ENUM_CONVERTER` for using `NS_ENUM` arguments in exported functions
2015-07-21 16:46:40 -04:00
Colin Ramsay b13e2e8c2e Update NativeModule documentation to show correct event emitter usage
It looks like in the various changes to native module events, the documentation has become a little confused. As far as I can tell, if you use `sendAppEventWithName` then the `NativeAppEventEmitter` is used and if `sendDeviceEventWithName` then it should be `DeviceEventEmitter`.
2015-07-07 15:04:50 +01:00
Amjad Masad e5ba0f388b Don't encourage the use of internal modules 2015-06-30 13:12:00 -07:00
Brent Vatne 9dc9648504 [Docs] Fix missing parameter in NativeModules addEvent date example 2015-06-13 12:05:23 -07:00
Kevin deLeon 40b1976233 Fixes spelling error in requested change. 2015-06-07 16:42:06 -05:00
Kevin deLeon b39aed4d0a Adds additional info for creating Swift modules
This may be common knowledge for most Swift/ObjC guys, but it took me quite a while to figure out why I was getting an error when creating/exporting my module. As a web guy coming to the "native" world, it was a bit confusing. I would imagine a lot of RCTN users will be in the same boat.
2015-06-07 16:31:40 -05:00
Brent Vatne 731335eb7c [Docs] Add DeviceEventEmitter require to NativeModulesIOS docs 2015-05-27 09:43:44 -07:00
Patrick Williams 0466bbd616 Add doc warning stating that TouchableOpacity can only support a single child 2015-05-25 22:03:43 -07:00
Brent Vatne d662a307b7 [Docs] Fix missing : in Swift NativeModules doc 2015-04-27 23:32:11 -07:00
Brent Vatne bfdd1d6443 Merge pull request #1021 from robertjpayne/master
Documentation for exporting Swift Native Modules
2015-04-27 23:24:04 -07:00
Nick Lockwood 89495635da Update NativeModulesIOS.md 2015-04-26 19:44:55 +01:00
Robert Payne 8c8b28969e Documentation for exporting Swift Native Modules 2015-04-26 18:06:43 +12:00
Spencer Ahrens c5d367ad39 Add Native Components guide. 2015-04-21 16:22:32 -07:00
Nick Lockwood 74252c9ec7 Update NativeModulesIOS.md
Updated documentation to include enhanced support for custom method types.
2015-04-19 18:04:45 +01:00