Граф коммитов

31 Коммитов

Автор SHA1 Сообщение Дата
Andres Suarez 8bd3edec88 Update copyright headers from Facebook to Meta
Reviewed By: aaronabramov

Differential Revision: D33367752

fbshipit-source-id: 4ce94d184485e5ee0a62cf67ad2d3ba16e285c8f
2021-12-30 15:11:21 -08:00
Micha Reiser 93377ff508 Remove "use strict" directive from ES Modules
Summary:
ES Modules implicitly enable strict mode. Adding the "use strict" directive is, therefore, not required.

This diff removes all "use strict" directives from ES modules.

Changelog:

[Internal]

Reviewed By: motiz88

Differential Revision: D26172715

fbshipit-source-id: 57957bcbb672c4c3e62b1db633cf425c1c9d6430
2021-02-02 11:12:56 -08:00
Ramanpreet Nara 09d4cb7b9f Remove @react-native/codegen lint ignores
Summary:
There's no reason for us to have lint ignores for `react-native/codegen/react-native-modules`. This diff removes all such ignores. I'll address any actual problems with the specs in subsequent diffs.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D24529238

fbshipit-source-id: bbd2f4fb5dace65d803a8f93bd0d9a1c5a1cfb34
2020-10-26 16:23:03 -07:00
Ramanpreet Nara 3a6327a5d9 Open source react-native-modules ESLint rule
Summary:
Open source this ESLint rule so that we can lint our open source NativeModule specs.

Changelog: [Internal]

Reviewed By: shergin, cpojer

Differential Revision: D23791748

fbshipit-source-id: e44444bc87eaa9dc9b7f2b3ed03151798a35e8a5
2020-09-22 11:32:37 -07:00
Rubén Norte 4409642811 Migrate large amount of modules to flow strict and strict-local
Summary:
| Group | Before | After | Change |
| Untyped | 50 | 49 | -1 |
| flow | 197 | 155 | -42 |
| flow strict-local | 226 | 185 | -41 |
| flow strict | 33 | 117 | +84

Changelog: [Changed] Improved Flow typing of multiple modules (with migrations to `flow strict` and `flow strict-local`

Reviewed By: motiz88

Differential Revision: D22549140

fbshipit-source-id: ed29415332cfce15b244ee4dea9e13d035543175
2020-07-22 09:46:16 -07:00
Ramanpreet Nara 96fdaa541e Cache constants for MP Search NativeModules
Summary: TurboModules doesn't cache invocations of getConstants(). This diff looks at which NativeModules' getConstants() methods gets repeated called in Marketplace, and caches those invocations in JS.

Reviewed By: fkgozali

Differential Revision: D21874123

fbshipit-source-id: a44b98b3ac8621f67c9c0f3b7c4003a561d1e15d
2020-06-03 20:48:28 -07:00
Janic Duplessis d72e078df4 Add missing NativeEventListener methods to NativeDevSettings (#27838)
Summary:
Since migrating to Turbomodules (8fe04cf) the addMenuItem method crashes because the NativeEventListener methods are missing from the codegen flow type. Added the same methods based on what we do in AppState which is another native module that extends NativeEventListener.

## Changelog

[Internal] [Fixed] - Add missing NativeEventListener methods to NativeDevSettings
Pull Request resolved: https://github.com/facebook/react-native/pull/27838

Test Plan:
|Before|After|
|{F226978596}|{F226978628}

Differential Revision: D19518474

Pulled By: PeteTheHeat

fbshipit-source-id: acddba9f18dd558df1d6df78b539689fdfd0062f
2020-01-23 13:20:53 -08:00
Rick Hanlon 6b22a4e802 Add NativeLogBox module on iOS
Summary:
This diff adds a NativeLogBox module implementation on iOS to manage rendering LogBox the way we render RedBox, except rendering a React Native component instead of a native view.

The strategy here is:
- initialize: will create a hidden window (the way redbox does) and render the LogBox to it
- show: will show the window
- hide: will hide the window

Most of this is copied from the way RedBox works, the difference here is that we eagerly initialize the window with the `initialize` function so that it's warm by the time LogBox needs to render.

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D18750008

fbshipit-source-id: 013e55ded55c8572bb08e0219ff4cd0060ebe0da
2019-12-10 02:31:37 -08:00
Eli White e362470305 Convert easy files to flow strict-local
Summary:
This diff was generated by this script used by WWW
https://our.intern.facebook.com/intern/diffusion/WWW/browse/master/scripts/flow/upgrade_to_flow_strict_local.sh?lines=0

Changelog:
[Internal] Upgrade flow to flow strict-local

Reviewed By: zackargyle, rickhanlonii

Differential Revision: D18833630

fbshipit-source-id: e64d4e9a49a0db5e6bf70a0c489567862b578d7f
2019-12-05 16:06:46 -08:00
Kevin Gozali fb627dac6a TM JS: Revert to import from TurboModuleRegistry.js
Summary:
Changelog: [Internal]

Reverting the import to the previous local module style since importing from react-native seems to introduce some perf regression. We'll revisit this later in the future.

Reviewed By: yungsters

Differential Revision: D18383893

fbshipit-source-id: f11d46a4545768f39199fd6fd22fcf14905d0a74
2019-11-08 11:44:16 -08:00
Kevin Gozali dd06f85bd0 TM JS: cleaned up TurboModuleRegistry types [2]
Summary:
Changelog: [Internal]

Moved the imports for `TurboModuleRegistry` and `TurboModule` from `react-native`. This was a jscodeshift with the script: P120688078

Reviewed By: yungsters

Differential Revision: D18262538

fbshipit-source-id: 48fac15229c897408928511c5ecbb42f17ec7b42
2019-11-04 18:51:05 -08:00
Ramanpreet Nara 7e5de4e241 Make RedBox TurboModule-compatible
Summary:
See title.

Changelog:
[iOS][Added] - Make RedBox TurboModule-compatible

Reviewed By: PeteTheHeat

Differential Revision: D18142255

fbshipit-source-id: 2d130aca93a88ac7c983ce0e4848955ffb0be518
2019-11-04 16:07:23 -08:00
Ramanpreet Nara fe3ae9dce8 Make RCTDevMenu and RCTDevSettings TurboModule-compatible
Summary:
Changelog:
[iOS][Added] - Make RCTDevMenu and RCTDevSettings TurboModule-compatible

Reviewed By: shergin

Differential Revision: D18148890

fbshipit-source-id: bd4f0b2797e299cd963e34fa47044a9e1232efe0
2019-11-04 16:07:23 -08:00
Rick Hanlon 2d95668aa8 Add fastRefresh to NativeDevSettings
Summary: This diff adds a method to call whenever a fast refresh happens. Right now this is only useful for reporting.

Reviewed By: cpojer

Differential Revision: D17528033

fbshipit-source-id: 17e82abe7a3e2bab6829de5adecda853fe5335c5
2019-09-30 07:03:51 -07:00
Rick Hanlon 549cac63cb Add reloadWithReason to DevSettings
Summary:
This diff adds reloadWithReason to the NativeDevSettings and updates the exposed DevSettings.reload method to send to it if it's available (setting an 'uncategorized' reason if one isn't set.

[General][Feature] Update DevSettings.reload to accept a reason

Reviewed By: RSNara

Differential Revision: D17499343

fbshipit-source-id: e8c9724800f93d3b9a5d2a8fe9f689d51947d39b
2019-09-30 07:03:50 -07:00
Janic Duplessis cc068b0551 Export the DevSettings module, add `addMenuItem` method (#25848)
Summary:
I wanted to configure the RN dev menu without having to write native code. This is pretty useful in a greenfield app since it avoids having to write a custom native module for both platforms (and might enable the feature for expo too).

This ended up a bit more involved than planned since callbacks can only be called once. I needed to convert the `DevSettings` module to a `NativeEventEmitter` and use events when buttons are clicked. This means creating a JS wrapper for it. Currently it does not export all methods, they can be added in follow ups as needed.

## Changelog

[General] [Added] - Export the DevSettings module, add `addMenuItem` method
Pull Request resolved: https://github.com/facebook/react-native/pull/25848

Test Plan:
Tested in an app using the following code.

```js
if (__DEV__) {
 DevSettings.addMenuItem('Show Dev Screen', () => {
    dispatchNavigationAction(
      NavigationActions.navigate({
        routeName: 'dev',
      }),
    );
  });
}
```

Added an example in RN tester

![devmenu](https://user-images.githubusercontent.com/2677334/62000297-71624680-b0a1-11e9-8403-bc95c4747f0c.gif)

Differential Revision: D17394916

Pulled By: cpojer

fbshipit-source-id: f9d2c548b09821c594189d1436a27b97cf5a5737
2019-09-17 06:38:10 -07:00
Christoph Nakazawa 90a8e3012c Remove live reloading option from RN iOS
Summary: See previous diff in this stack

Reviewed By: motiz88

Differential Revision: D17156649

fbshipit-source-id: 12bdba248481258b9c6ca001472a41ca19fb4b6f
2019-09-06 03:48:49 -07:00
Logan Daniels 91f139b941 xplat/js/react-native-github
Reviewed By: panagosg7

Differential Revision: D16657770

fbshipit-source-id: 4e260842c838a35317515044c54ccf55a083da33
2019-08-09 10:11:15 -07:00
Ramanpreet Nara a5b925d950 Fix up NativeDialogManagerAndroid PR
Summary:
This diff has three changes:
1. Remove all references to `Stringish` from `NativeDialogManagerAndroid`. (All Fbt objects expose a `.toString` method we could call).
2. Make sure that we only access `DialogManagerAndroid` through `NativeDialogManagerAndroid`.
3. Removed a bunch of `$FlowFixMes` in the files I touched. Probably not the best idea to bite into this cleanup on this diff, but what's done is done.

Since this diff is fairly large, I've commented on parts of it I thought were note-worthy. I've also commented on the changes I had to make to fix flow after removing the `$FlowFixMe`s.

Reviewed By: PeteTheHeat

Differential Revision: D16428855

fbshipit-source-id: 0e6daf2957f4b086ebb1e78e0a59930668c65576
2019-08-05 12:16:46 -07:00
Michał Osadnik 7a62e7e333 Fix types for DialogManagerAndroid
Summary: We doesn;t support `onError: (string) => void,` is codegen so I change it to `onError: (error: string) => void,`

Reviewed By: TheSavior

Differential Revision: D16284628

fbshipit-source-id: a80a5da54823c827aa0bbe1f1f99613a35605489
2019-07-17 06:21:50 -07:00
Kevin Gozali db7e00250c Reland "[react-native][PR] [TM] Add spec for DevSettings"
Summary: Original commit changeset: 70b4842f5cde

Reviewed By: cpojer

Differential Revision: D15578852

fbshipit-source-id: 6389a6f5ed2115182d88dcc777e6457c376750f6
2019-05-31 10:58:02 -07:00
Petr Nikolaev a944ebd7da Revert D15558093: [react-native][PR] [TM] Add spec for DevSettings
Differential Revision:
D15558093

Original commit changeset: 3adcb640a6ad

fbshipit-source-id: 70b4842f5cdef878b18786c6a13e76694ffb1581
2019-05-31 06:36:09 -07:00
Jarvis Luong 85252a6cac Add spec for DevSettings (#25084)
Summary:
Part of #24875, adds a spec for DevSettings.

## Changelog

[General] [Added] - TM spec for DevSettings
Pull Request resolved: https://github.com/facebook/react-native/pull/25084

Reviewed By: hramos

Differential Revision: D15558093

Pulled By: fkgozali

fbshipit-source-id: 3adcb640a6ad80c84c831905bda114e27177f1fe
2019-05-30 21:05:11 -07:00
James Ide 33ee6f8b99 Add a lint rule to disallow Haste imports (#25058)
Summary:
This is an ESLint plugin that infers whether an import looks like a Haste module name. To keep the linter fast and simple, it does not look in the Haste map. Instead, it looks for uppercase characters in single-name import paths, since npm has disallowed uppercase letters in package names for a long time. There are some false negatives (e.g. "merge" is a Haste module and this linter rule would not pick it up) but those are about 1.1% of the module names in the RN repo, and unit tests and integration tests will fail anyway once Haste is turned off.

You can disable the lint rule on varying granular levels with ESLint's normal disabling/enabling mechanisms.

Also rewrote more Haste imports so that the linter passes (i.e. fixed lint errors as part of this PR).

## Changelog

[General] [Changed] - Add a lint rule to disallow Haste imports
Pull Request resolved: https://github.com/facebook/react-native/pull/25058

Differential Revision: D15515826

Pulled By: cpojer

fbshipit-source-id: d58a3c30dfe0887f8a530e3393af4af5a1ec1cac
2019-05-30 07:45:16 -07:00
James Ide a7a7970e54 Replace more Haste imports with path-based imports (#25001)
Summary:
This is another step in moving RN towards standard path-based requires, updating more code to use path-based requires. See the umbrella issue at https://github.com/facebook/react-native/issues/24316 for more detail.

## Changelog

[General] [Changed] - Replace more Haste imports with path-based imports
Pull Request resolved: https://github.com/facebook/react-native/pull/25001

Differential Revision: D15467829

Pulled By: cpojer

fbshipit-source-id: 58c364bb4c1c757689907d5ed0d0f3fac0e22f3f
2019-05-23 00:51:31 -07:00
Ramanpreet Nara b355ba56db Fix flow errors
Summary: This diff fixes the flow errors that surfaced from flow-typing DialogManagerAndorid and deleting NativeDialogManagerAndroid. I also migrated all imports of NativeDialogManagerAndorid to import the module from `react-native-implementation.js`.

Reviewed By: fkgozali

Differential Revision: D15440162

fbshipit-source-id: 2fdfb68104bc8ffb93c0c77fe15aacadc182f62f
2019-05-22 18:22:17 -07:00
Uilque Messias 32340d377b Add spec for DialogManagerAndroid (#24912)
Summary:
Part of #24875.

## Changelog

[General] [Added] - TM add spec for DialogManagerAndroid
Pull Request resolved: https://github.com/facebook/react-native/pull/24912

Reviewed By: fkgozali

Differential Revision: D15433854

Pulled By: RSNara

fbshipit-source-id: e7234debe16de5afbc770f8feee2471f41b54427
2019-05-22 18:22:17 -07:00
Jean Regisser 163fb08792 Add spec for SourceCode (#24901)
Summary:
Part of #24875

## Changelog

[General] [Added] - Add TurboModule spec for SourceCode
Pull Request resolved: https://github.com/facebook/react-native/pull/24901

Reviewed By: fkgozali

Differential Revision: D15391727

Pulled By: rickhanlonii

fbshipit-source-id: 9d4622d809efdc3955d435c5a51b72c38cedccc5
2019-05-22 03:27:54 -07:00
Eric Lewis c44d4f9ef6 add spec for RedBox (#24922)
Summary:
part of #24875.

## Changelog

[General] [Added] - add TM spec for RedBox
Pull Request resolved: https://github.com/facebook/react-native/pull/24922

Reviewed By: RSNara

Differential Revision: D15423532

Pulled By: fkgozali

fbshipit-source-id: 3c30e5b32a29628caf0bb9286c0628597ac64fb7
2019-05-20 18:05:55 -07:00
Eric Lewis 00fe438003 Add spec for AnimationsDebugModule (#24915)
Summary:
Part of #24875.

## Changelog

[General] [Added] - Add TM spec for AnimationsDebugModule
Pull Request resolved: https://github.com/facebook/react-native/pull/24915

Reviewed By: RSNara

Differential Revision: D15421499

Pulled By: fkgozali

fbshipit-source-id: f52780773f5947097b75c4d776a0b80e0bc1d387
2019-05-20 18:05:54 -07:00
Uilque Messias 580088c199 Add spec for NativeDeviceEventManager (#24914)
Summary:
Part of #24875.

## Changelog

[General] [Added] - TM add spec for NativeDeviceEventManager
Pull Request resolved: https://github.com/facebook/react-native/pull/24914

Reviewed By: RSNara

Differential Revision: D15421462

Pulled By: fkgozali

fbshipit-source-id: 78b90c615cd031ecd010a552751e506406ab739a
2019-05-20 18:05:54 -07:00