Commit Graph

18 Commits

Author SHA1 Message Date
Sophie Alpert 1490ab12ef Update license headers for MIT license
Summary:
Includes React Native and its dependencies Fresco, Metro, and Yoga. Excludes samples/examples/docs.

find: ^(?:( *)|( *(?:[\*~#]|::))( )? *)?Copyright (?:\(c\) )?(\d{4})\b.+Facebook[\s\S]+?BSD[\s\S]+?(?:this source tree|the same directory)\.$
replace: $1$2$3Copyright (c) $4-present, Facebook, Inc.\n$2\n$1$2$3This source code is licensed under the MIT license found in the\n$1$2$3LICENSE file in the root directory of this source tree.

Reviewed By: TheSavior, yungsters

Differential Revision: D7007050

fbshipit-source-id: 37dd6bf0ffec0923bfc99c260bb330683f35553e
2018-02-16 18:31:53 -08:00
Tim Yung 2fff445b13 RN: Improve NativeEventEmitter Flow Types
Reviewed By: fkgozali

Differential Revision: D6050987

fbshipit-source-id: 1c911bed23f7d26800aafed4b7e7c30a1197f64b
2017-10-13 08:04:17 -07:00
Eli White dd92dba3da Turn on Flow for EventEmitter
Reviewed By: sahrens

Differential Revision: D5732809

fbshipit-source-id: b8241120188b2b64af12249b2f00a43bea3b58a4
2017-08-30 11:52:28 -07:00
Pieter De Baets db3df3400a Breaking - make RCTDeviceEventEmitter warnings fatal
Reviewed By: davidaurelio

Differential Revision: D5469832

fbshipit-source-id: 1eb4ad3a2b3e1fa10d75e42d1d2f7baa291cb6f4
2017-07-24 03:47:59 -07:00
Spencer Ahrens 365aea3415 Libraries/Shared --> Libraries/www-shared, EventEmitter --> vendor/emitter
Reviewed By: fkgozali

Differential Revision: D5455575

fbshipit-source-id: 0eb4da4b1d8688b704f2f751143610e6ed836ce7
2017-07-21 09:40:15 -07:00
Alex Dvornikov 485bb70691 Allow lazy modules registration with the BatchedBridge
Reviewed By: javache

Differential Revision: D5181849

fbshipit-source-id: f63562c360488a9818605b25c1338214daac7411
2017-06-06 07:07:19 -07:00
Alex Dvornikov a93b7a2da0 Added stubs for some native modules
Reviewed By: javache

Differential Revision: D5111649

fbshipit-source-id: eef2f84556611dec01978d845b89fa145ec5d4db
2017-06-01 08:31:19 -07:00
Janic Duplessis 87b0378eb8 Native Animated - Restore, reorganize and add new tests
Summary:
Native Animated tests were removed a while back because they were failing, this restores the existing tests and reorganize / cleanup them. It also adds new ones so we have at least one test for each public API. These tests mostly assert that the native animated module is called with the proper args.
Closes https://github.com/facebook/react-native/pull/12775

Differential Revision: D4684968

Pulled By: ericvicenti

fbshipit-source-id: 4783d5edd08101cab7c0ce2eec4f3ccd0fbc1d27
2017-03-27 11:46:05 -07:00
David Aurelio 2b4762f184 Only use `EventValidator` in development mode
Summary: Only pulls in `EventValidator` for development mode, as warnings about invalid events are pointless in production builds.

Reviewed By: javache

Differential Revision: D4745852

fbshipit-source-id: dbab1026df35d54a82e1e620fac08304c58fbeae
2017-03-21 10:09:38 -07:00
David Aurelio a34956f2fb Remove `copyProperties`
Summary: remove `copyProperties` module, and replace the functionality with `Object.assign`

Reviewed By: javache

Differential Revision: D4745771

fbshipit-source-id: 2440620757e7539dbd7fd39f5920ac0b5b4183c5
2017-03-21 08:01:58 -07:00
Tim Yung 23331df5a4 RN: Cleanup OSS JS & Flow Declarations
Reviewed By: vjeux

Differential Revision: D4210763

fbshipit-source-id: 5abaa547100b8badd13bcf311ceffc5b4098d252
2016-11-20 17:58:29 -08:00
Tim Yung a3868722f8 Cleanup: Remove `@typechecks`
Reviewed By: spicyj

Differential Revision: D4010629

fbshipit-source-id: b243b2ca09cdfcaeec49b5f6850139d0461b80c5
2016-10-12 19:28:42 -07:00
Pieter De Baets 292cc82d0e Reorganize core JS files
Reviewed By: lexs

Differential Revision: D3987463

fbshipit-source-id: fa8f1d1bea7ed699120b9705ddc1c83767fcf8e4
2016-10-11 10:14:28 -07:00
David Aurelio 94666f16c7 Auto-fix lint errors
Reviewed By: bestander

Differential Revision: D3683952

fbshipit-source-id: 9484d0b0e86859e8edaca0da1aa13a667f200905
2016-08-09 06:43:46 -07:00
Eric Kreutzer 73bea8f7e6 Fixes EventEmitter#once arguments not getting passed to the listener
Summary:
Arrow functions do not have their own arguments. Fix EventEmitter#once to pass the correct arguments to the listener callback.
Closes https://github.com/facebook/react-native/pull/8479

Differential Revision: D3495086

Pulled By: javache

fbshipit-source-id: 4492d13bfb2cc255afdc41d39fbf2f35da6b7094
2016-06-28 16:13:21 -07:00
Rahul Jiresal 0e8c3ff463 Add a removeListener method to DeviceEventEmitter for Framework consi…
Summary:
The Framework is inconsistent in how listeners are removed in certain classes. This issue has been discussed in https://github.com/facebook/react-native/issues/6493.

For example,

**DeviceEventEmitter**

```javascript
/* Current */
this.keyboardHideObserver = DeviceEventEmitter.addListener('keyboardWillHide', this.keyboardWillHide);
this.keyboardHideObserver.remove();

/* Expected (maybe in addition to the current API) */
DeviceEventEmitter.addListener('keyboardWillHide', this.keyboardWillHide);
DeviceEventEmitter.removeListener('keyboardWillHide', this.keyboardWillHide);
```
**AppStateIOS**

```javascript
AppStateIOS.addEventListener('change', this.handleAppStateChange);
AppStateIOS.removeEventListener('change', this.handleAppStateChange);
```

The API should be consistent, and preferably should allow both ways of removing the listeners.

Currently, developers who tried to use the second way of removing the listeners get an error for function not found. Due to the lack of documenta
Closes https://github.com/facebook/react-native/pull/6884

Differential Revision: D3341235

Pulled By: nicklockwood

fbshipit-source-id: 87431e8b667f46ad002d4a6e3ca07cbc1e6b4007
2016-05-24 11:45:51 -07:00
Nick Lockwood d9737571c4 Updated AppState module to use new emitter system
Summary: AppState now subclasses NativeEventEmitter instead of using global RCTDeviceEventEmitter.

Reviewed By: javache

Differential Revision: D3310488

fbshipit-source-id: f0116599223f4411307385c0dab683659d8d63b6
2016-05-23 09:13:37 -07:00
Nick Lockwood 516bf7bd94 Fixed NativeEventListener deregistration
Summary:
The `EmitterSubscription.remove()` method was previously calling `this.subscriber.removeSubscription(this)` directly, bypassing the mechanism in `NativeEventEmitter` that keeps track of the number of subscriptions.

This meant that native event modules (subclasses of `RCTEventEmitter`) would keep sending events even after all the listeners had been removed. This wasn't a huge overhead, since these modules are singletons and only send one message over the bridge per event, regardless of the number of listeners, but it's still undesirable.

This fixes the problem by routing the `EmitterSubscription.remove()` method through the `EventEmitter` so that `NativeEventEmitter` can apply the additional native calls.

I've also improved the architecture so that each `NativeEventEmitter` uses its own `EventEmitter`, but they currently all still share the same `EventSubscriptionVendor` so that legacy code which registers events via `RCTDeviceEventEmitter` still works.

Reviewed By: vjeux

Differential Revision: D3292361

fbshipit-source-id: d60e881d50351523d2112473703bea826641cdef
2016-05-16 04:13:56 -07:00