Commit Graph

10 Commits

Author SHA1 Message Date
REDMOND\acoates 8826d8b233 Allow CxxModules to implement methods with two callbacks (#21586)
Summary:
When writing a native module in C++ using CxxModule, its not currently possible to write async methods which take two callbacks, that shouldn't be projected to JS as a promise.  I hit this when trying to implement the AppState module in c++.  AppState has a single method on it, getCurrentAppState, which takes two callbacks (a success and a failure callback).

This change adds a couple of new CxxModule::Method ctors, which allow devs to specify that they want two callbacks, but not a promise.  This is done using an extra tag in the ctor, similar to how you specify that you want to make a synchronous method.  I used the existing AsyncTag to indicate that the 2 callback version should be async, and not a promise.
Pull Request resolved: https://github.com/facebook/react-native/pull/21586

Reviewed By: shergin

Differential Revision: D10520204

Pulled By: fkgozali

fbshipit-source-id: bcb2dbd91cba3c1db987dc18960247218fdbc032
2018-11-13 19:52:40 -08:00
Héctor Ramos 1151c096da Update copyright headers to yearless format
Summary: This change drops the year from the copyright headers and the LICENSE file.

Reviewed By: yungsters

Differential Revision: D9727774

fbshipit-source-id: df4fc1e4390733fe774b1a160dd41b4a3d83302a
2018-09-11 15:33:07 -07:00
Héctor Ramos da7873563b Migrate Android sources to MIT license header
Reviewed By: fkgozali

Differential Revision: D8065619

fbshipit-source-id: 719c303b40c96950bab8e5dde9a75f449b2956c6
2018-05-31 15:37:30 -07:00
Pieter De Baets c1c791fb59 Provide default implementation of getConstants
Reviewed By: kathryngray

Differential Revision: D5453963

fbshipit-source-id: cf3d42a86c3262991697e9c1a23ab90b7f742afe
2017-08-01 03:33:41 -07:00
Pieter De Baets cb12080179 Replace exported method registration with statically allocated struct
Reviewed By: fromcelticpark

Differential Revision: D5389383

fbshipit-source-id: 9eb29b254b616574966b43ad24aa880d44589652
2017-07-24 07:01:53 -07:00
Pieter De Baets e2628f93b5 Rename Executor to JSExecutor
Summary:
* Cleanup some header files so we use more forward declarations
* Rename Executor to JSExecutor.h
* Move some typedefs to more appropriate locations

Reviewed By: mhorowitz

Differential Revision: D5301913

fbshipit-source-id: e75154797eb3f531d2f42a5e95409f4062b85f91
2017-06-23 17:01:25 -07:00
Marc Horowitz e622d51e20 Support ModuleHolder-based lazy init of C++ modules with C++ bridge on android
Reviewed By: AaaChiuuu

Differential Revision: D4614479

fbshipit-source-id: 109ac34b8688f0113675e4a4479d1ddcc6169ed4
2017-03-14 15:35:01 -07:00
Sean Kinsey c38d56d9db Expose the bridge instance to CxxModule via a weak_ptr
Summary:
In order for `CxxModule` modules to be able to do things like emit events, we need to expose the bridge instance.

To allow classes derived from `CxxModule` in other projects to include `<cxxreact/Instance.h> I also needed to convert all the header includes to non-relative  ones.

Reviewed By: javache

Differential Revision: D4564145

fbshipit-source-id: a5bc28dd9b40e2b141af9e867105c56083fbdcdc
2017-02-15 10:04:17 -08:00
Marc Horowitz e5ccdc4c2d add support for registering and calling sync methods in C++ modules
Differential Revision: D3574800

fbshipit-source-id: 4c238fd96c8f83e9424c8e2bf2c8ebb1d39d397a
2016-08-03 18:13:44 -07:00
Chris Hopman 5e8f1716fc Build new bridge with gradle
Reviewed By: bestander

Differential Revision: D3324351

fbshipit-source-id: 41fa18a23c8661440a7deff244c93278f418e1d9
2016-05-27 16:13:37 -07:00