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

18932 Коммитов

Автор SHA1 Сообщение Дата
Joshua Gross cc6b430c3a Annotate UIManager methods to document thread semantics
Summary:
Document which methods can be called on UI thread or ANY thread.

In the future we should see if we can use only `ThreadConfined` or the AndroidX annotations instead of using both / choosing between them at each site.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D18532542

fbshipit-source-id: 3b5406ea5035615a0ebf83484bf8ec0747a6b6f7
2019-11-15 17:01:02 -08:00
Eli White bbc5c35a61 Convert to using forwardRef
Summary:
TextInput now acts as a host component and can be passed directly to our new APIs that require a host component. Callsites no longer need to call

```
inputRef.getNativeRef()
```

We mutate the ref to the host component adding the imperative methods of the TextInput so you can still call `inputRef.clear` and `inputRef.isFocused`.

Changelog:
[General][Changed] TextInput now uses `forwardRef` allowing it to be used directly by new APIs requiring a host component.

Reviewed By: yungsters

Differential Revision: D18458408

fbshipit-source-id: 1f149fd575210d702fa0fdf3d05bb2162436a773
2019-11-15 14:02:42 -08:00
Eli White 99dc4e204e Become compatible with Flow's TypesFirst
Summary:
When the TextInput class is exported directly Flow complains about some definitions because they don't properly define the export type. This change adds those types but still doesn't export the TextInput directly as there are more things that still need to get fixed.

Changelog:
[Internal]

Reviewed By: JoshuaGross

Differential Revision: D18444096

fbshipit-source-id: 18c88bbf1de5504f350681a71ea21d7e41876e49
2019-11-15 14:02:42 -08:00
Eli White 8f601418ab Convert TextInput from NativeMethodsMixin to ES6 Class
Summary:
In order to make this more flow typed and modern we need to get it off of createReactClass. This change converts the class as is with no intended behavior changes to an ES6 class.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D18443018

fbshipit-source-id: 831921976e9de8e965180cdefd1c4a154f04bfea
2019-11-15 14:02:41 -08:00
Eli White ce314ba097 Inline NativeMethodsMixin
Summary:
We need to get rid of NativeMethodsMixin. Normally we'd use forwardRef to the HostComponent, however we can't do this here because TextInput has its own imperative methods. I want to refactor this into a class and after that will revisit how to get rid of these methods.

Changelog:
[Internal]

Reviewed By: JoshuaGross

Differential Revision: D18436162

fbshipit-source-id: 0c81fa8b31b3248cbab8680ff680dd09c61c76e2
2019-11-15 14:02:41 -08:00
Eli White ca78497f73 Reorder methods
Summary:
Reordering the methds in TextInput to be a bit more consistent.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D18435732

fbshipit-source-id: 05a1d9d2c70a4b5fa00a3dc6be0520a216a24106
2019-11-15 14:02:41 -08:00
Eli White c70a093dd2 Refactor props, sort
Summary:
Sorting these props to be consistent

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D18435730

fbshipit-source-id: 259c6902bdaa3a7d4c7bdf8768d7f42191d5398b
2019-11-15 14:02:40 -08:00
Eli White b7bd85a2bf Refactor to not copy props
Summary:
We don't need a local mutable copy of props.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D18435731

fbshipit-source-id: 13ec1a78ca26b1372a4aed484a821204a93b6437
2019-11-15 14:02:40 -08:00
Eli White 854fa96cae Factor out TouchableWithoutFeedback
Summary:
The TouchableWithoutFeedback is almost exactly the same between both branches.

The responderReject prop was added in https://github.com/facebook/react-native/pull/16755.
The PR seems to say that it is the default behavior on Android. I don't want to make risky changes in this refactor so I'm not doing anything special about that prop for now.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D18435733

fbshipit-source-id: 372d17d8e67884930409a6a863757944cec4737e
2019-11-15 14:02:40 -08:00
Eli White eef7de6c6d TextInput merge _renderIOS and _renderAndroid methods
Summary:
These functions are quite similar and I'm going to refactor out the shared pieces. To make it easy to review this change just inlines those two functions with no other changes.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D18435734

fbshipit-source-id: 826f510359358427856993b536d41054ddf8c792
2019-11-15 14:02:39 -08:00
David Vacca cddf9eb1da Extending ThemeReactContext to store surfaceID
Summary:
This diff extends ThemeReactContext class to store the surfaceID field

The getSurfaceID method is being exposed as a public method

Changelog: [internal]

Reviewed By: JoshuaGross

Differential Revision: D18474015

fbshipit-source-id: ee1f859a802d36c51dec537fa91d90022523e88d
2019-11-15 09:30:41 -08:00
David Vacca 9713b63d9a Introducing ReactCallerContextFactory interface
Summary:
This interface is used from ReactImageManager to customize the CallerContext object associated with each instance of ReactImageView.
CallerContext are used on Fresco to customize Debug and logs

Changelog: Introduce ReactCallerContextFactory interface, this interface is intended to customize Debug and logging on Fresco

Reviewed By: JoshuaGross

Differential Revision: D18474017

fbshipit-source-id: eda0fc9d3f64bbcc23ee1b7f5d779b441da1fe6c
2019-11-15 09:30:41 -08:00
Sidharth Guglani b3439a2460 not using templates for updating styles which are used via bitfield
Summary:
We want completely remove usages of Bitfield as it uses templates which bloats binary size
This stack will reduce 2.2 Kb in binary size bringing it down to 61.3KB on armv7

In this diff we are removing usage of template while updating styles.

## Changelog:
[Internal][Yoga] : Not using templates for updating styles

Reviewed By: astreet

Differential Revision: D18519570

fbshipit-source-id: 2324088b8c63154f818b1da1edf24c0533e10082
2019-11-15 06:40:07 -08:00
Michał Pierzchała e523302fbe - Bump CLI to ^3.0.0 (#27235)
Summary:
Upgrading CLI to latest. It's likely not yet compatible with master, because we depend on Metro 0.56, and master is on 0.57. This diff is intended to be cherry-picked to 0.61 and 0.62.

cc grabbou

## Changelog

[Internal] [Changed] - Bump CLI to ^3.0.0
Pull Request resolved: https://github.com/facebook/react-native/pull/27235

Test Plan: None

Differential Revision: D18527709

Pulled By: cpojer

fbshipit-source-id: 44448058c48a66d22a1d71abdc908f532f5aa547
2019-11-15 06:30:04 -08:00
Rick Hanlon e9fd102c33 Remove "reload to reconnect" from the metro disconnected message
Summary:
Changes the Fast Refresh message for when metro disconnects to remove "Reload to reconnect.". The most common use case for this happening is when Metro is stopped, and reloading will not reconnect to a stopped metro server.

Long term we should reconnect to Metro automatically and then this message would be followed up with a "Reconnected to Metro" message, never needing a reload.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18527705

fbshipit-source-id: 40768ce1089348b612e9d86638f07169d2a34b67
2019-11-15 06:18:30 -08:00
Rick Hanlon 9c4afce70f LogBox - Move and improve 'see more' button
Summary:
Feedback from multiple people has been that the "see more" is hard to discover and that it should be at the bottom left, so this diff moves it there.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18487041

fbshipit-source-id: 1543c54e1de5fa16fa5b2e427812b6e72977bfb2
2019-11-15 06:11:08 -08:00
Sidharth Guglani 1d683faf1d use owner's width for resolving the margin and padding for node
Summary:
The margin and padding are resolved incorrectly for leaf nodes (nodes with measure function set) if margin and padding are used in percentages.
Here we were using node's width instead of container width to calculate the margin and padding.

Fixed this to use container's width.

## Changelog:

[General][Yoga] : Fixed an issue where margin and padding were resolved incorrectly for leaf nodes (nodes with measure function set) if margin and padding are used in percentages.

Reviewed By: alickbass

Differential Revision: D17130520

fbshipit-source-id: ac904d432f121973e7739debd9136909b5ca1427
2019-11-15 05:12:26 -08:00
Joshua Gross ce226c1f28 Fix T54997838
Summary:
Fixes T54997838 by preventing any view mutations during `onMeasure` calls.

There might still be places where this is possible, but this is where I'm seeing all the crashes currently.

See comments in ReactRootView for why views were mutated during onMeasure.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D18518591

fbshipit-source-id: 1406af8a6b0bfcc86f4cc5b451b3967f312dfd85
2019-11-14 21:23:32 -08:00
Rick Hanlon c54f5cf72a LogBox - Only dismiss syntax errors when the issue is fixed
Summary:
This change is not only more correct, it's also fixes the modal in the the next diff.

It's more accurate because in the previous location, the redbox dismissal was done as a hack in order to hide non-syntax errors so that the syntax error would be visible when it fired. This is unnecessary for LogBox because it always puts syntax errors on top of any other error.

The main motivation for changing this, however, is that this strategy is broken when switching to the Modal component because the Modal component does not work well with quickly unmounting and remounting. With the old strategy, the inspector would flicker and then collapse even though there was a syntax error.

Changelog: [Internal]

Reviewed By: cpojer, gaearon

Differential Revision: D18461431

fbshipit-source-id: e8ed83e3d2b002e5d45cc13dc9533ed841ed5cae
2019-11-14 12:06:35 -08:00
Rick Hanlon 32eb05ebea LogBox - Add temporary default error boundary for logbox
Summary:
Fixes an issue where unhandled exceptions would unmount the app and LogBox, hiding the exception and leaving the user stuck. This is a temporary solution until we either decide to provide an error boundary by default or move this to a separate root.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18504346

fbshipit-source-id: 4bca8693e63c367bf3070f12606a50824aa4cc23
2019-11-14 11:14:12 -08:00
Ramanpreet Nara 7f637139e7 Make sure that ReactFeatureFlags.useTurboModules is read from memory
Summary:
`ReactFeatureFlags.useTurboModules` can be written to and read from any number of threads. We should use `volatile` to make sure that all threads read/write this data straight from/to memory.

Changelog:
[Android][Fixed] - Make ReactFeatureFlags.useTurboModules volatile

Reviewed By: fkgozali

Differential Revision: D18505673

fbshipit-source-id: 0b2527b8cb95c1e1aedc6b03b12a6b1e6a6cdaa4
2019-11-14 11:03:59 -08:00
Janic Duplessis ec59e60d45 Fix RNTester networking conversion to TurboModule (#27218)
Summary:
Now that the networking module is a TurboModule request handlers need to be passed at module creation. The code was missing for RNTester.

## Changelog

[Internal] [Fixed] - Fix RNTester networking conversion to TurboModule
Pull Request resolved: https://github.com/facebook/react-native/pull/27218

Test Plan: Tested that RNTester XMLHttpRequest example now works on iOS

Differential Revision: D18506038

Pulled By: RSNara

fbshipit-source-id: cd88319e386c7b7b6e11cfb920f2ceb761a4136a
2019-11-14 10:43:18 -08:00
Valentin Shergin dc0ec22e79 Fabric: Removing unnecessary code from State.cpp
Summary:
Why crash in production if we can make potential bug not compile?

Changelog: [INTERNAL]

Reviewed By: sammy-SC

Differential Revision: D18499813

fbshipit-source-id: dc2d7ac12b8a2ae27d1e6b832fccc1555cab3b75
2019-11-14 10:38:24 -08:00
Moti Zilberman 33ee724501 Extract RCTFormatStackTrace function from RCTFormatError
Summary:
Extracts a new `RCTFormatStackTrace` function from `RCTFormatError`.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D18114387

fbshipit-source-id: 4466f52d75d9da3a257cd1cc7067492a0c19a7d5
2019-11-14 10:33:14 -08:00
Rick Hanlon 63b534a745 LogBox - Improve stack frame pressables and counts
Summary:
This diff makes number of improvements to stack frames:

- Adds padding around stack frame pressables
- Fixed wrapping for the closing bracket on component stacks
- Adds passing around "see more" buttons
- Fixed the count for "Show x more frames" when it's 0 and otherwise
- Add more cases for the count text
- Switches button back to minimize (snuck this in here)

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18495331

fbshipit-source-id: 8b9efa88c4205b23e734893d8db6deccce88344c
2019-11-14 04:48:55 -08:00
Rick Hanlon a0d2cd3d13 LogBox - Fix message content rendering in notifications
Summary:
Strips "Error: " and "Warning: " from the log notification.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18491963

fbshipit-source-id: 7c9d18638eee442d521a9aa2135ce6891c673cbe
2019-11-14 04:43:27 -08:00
Rick Hanlon ab751f5c45 LogBox - Add ReactNativeWarningFilter
Summary: Changelog: [Internal]

Differential Revision: D18492212

fbshipit-source-id: 81234c532cdcc8935a0c532950398bc84aa6d4d1
2019-11-13 18:29:47 -08:00
Sidharth Guglani f0f83eb3b1 Remove useVanillaJNI flag and usage of fbjni in yoga build
Summary:
## Changelog:

[General] [Yoga] - Use vanilla jni instead of fbjni for all the jni communication

Reviewed By: astreet

Differential Revision: D17808005

fbshipit-source-id: 5e9a1ed73978f519c71c248774a28e5a294e7c7f
2019-11-13 15:16:47 -08:00
Valentin Shergin 0c8b85402e Fabric: Fixing arguments order in CascadedRectangleEdges::resolve
Summary:
The original implementation had an incorrect order of fields in the struct wich causes bugs with border drowing.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18444733

fbshipit-source-id: e4611e6e90eee85e7cdebcee3c5bb6886417aa26
2019-11-13 14:22:18 -08:00
Valentin Shergin 1da6d2b2c0 Fabric: Removing UIEdgeInsetsFromBorderInsets from RCTViewComponentView
Summary:
We already have the exact same function in RCTConvertions.h, why have a copy of it here?

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18444731

fbshipit-source-id: ba1ebd538f92145c2ec0c30e0f7d14f1d05b381c
2019-11-13 14:22:17 -08:00
Valentin Shergin fa3ab5c653 Fabric: Add and subtract operations for RectangleEdges<T>
Summary:
We will use it soon for `EdgeInsets`

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18444732

fbshipit-source-id: f03aa2a8889d426095a954d88f9cb6172c3e376e
2019-11-13 14:22:17 -08:00
Valentin Shergin d5ec68f841 A workaround for RCTUITextField::secureTextEntry was moved to RCTUITextField
Summary:
The moved code fragment is a workaround for a bug in UITextField in iOS 8. There is no need to have this code in a general base class that serves both UITextField- and UITextView-based components. Especially for such workarounds like that, we have a dedicated class RCTUITextField. This diff moves that there.

Read more about the bug:
https://stackoverflow.com/questions/14220187/uitextfield-has-trailing-whitespace-after-securetextentry-toggle/22537788#22537788

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D18444734

fbshipit-source-id: a3764c19f562231ba3fa3d4c0ad7de069ea04d98
2019-11-13 14:22:17 -08:00
Rick Hanlon 80b4919d77 LogBox - Title render errors "Render Error"
Summary:
This diff changes LogBox to say "Render Error" instead of "Fatal Error" for errors thrown in render.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18466237

fbshipit-source-id: 737759f3febb937f70698dae5f1b1617e233fc98
2019-11-13 11:33:38 -08:00
Rick Hanlon 8335ebaeab Add support for isRenderError
Summary:
This diff adds `isRenderError` to the Log data, and refactors the LogBoxLog object to accept an object in the constructor instead of adding the 7th argument. No visual updates as those are in the next diff.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18466192

fbshipit-source-id: e38ef9032b8074abbc7b40cbe7a84d45285944c4
2019-11-13 11:33:38 -08:00
Rick Hanlon 75deeb32fe LogBox - Errors thrown in render are fatals
Summary:
The React team wants exceptions thrown during render to pop over the screen as fatals.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D18439258

fbshipit-source-id: dded7b9d93271c1a4eff682be521c7567dfe7d7e
2019-11-13 11:33:37 -08:00
Daniel Sainati 0f8ad31745 @allow-large-files deploy Flow v0.112 to xplat
Summary: Changelog: [Internal]

Reviewed By: samwgoldman

Differential Revision: D18466454

fbshipit-source-id: 83c76ba06822a378cb0a8ea72cd0fb9d19f81a4b
2019-11-13 11:18:41 -08:00
Oleksandr Melnykov c5c3264a94 Add setNativeRefreshing command to SwipeRefreshLayoutManager
Summary:
As a part of the migration from `setNativeProps` in Fabric and Paper, we are replacing it by view commands in the RefreshControl component on Android.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D18475428

fbshipit-source-id: f2e978d88e34c74771f8582247ecc82b2b942557
2019-11-13 10:21:04 -08:00
Oleksandr Melnykov cd1e34d4a2 Add setNativeValue command to ReactCheckBoxManager
Summary:
As a part of the migration from `setNativeProps` in Fabric and Paper, we are replacing it by view commands in the Checkbox component on Android.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D18451524

fbshipit-source-id: 566f3574b85a1ae97f78b2fb95548b8529c0c92f
2019-11-13 10:15:50 -08:00
Rick Hanlon 687d3f438f LogBox - Fix animation for source map failure
Summary:
Fixes an issue where the icon for failed source maps would spin like the pending icon.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18479027

fbshipit-source-id: 07c428239122f3f4a8a58dcd8faf09e54170d45b
2019-11-13 10:04:44 -08:00
Rick Hanlon 80ba7f78fb LogBox - Exclude from inspector
Summary:
LogBox should be on top of the inspector so that you can dismiss and view errors without the inspector getting in the way.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D18462490

fbshipit-source-id: 0da2819158c3bc2602a63695222c1601dcf79183
2019-11-13 09:52:44 -08:00
Rick Hanlon 5427211a00 LogBox - Dismiss keyboard when the inspector opens
Summary:
If the keyboard is open when the inspector pops open, dismiss it.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18468221

fbshipit-source-id: 0d51fa90824ed8bef6a3b6e813013fa3c2a4bbda
2019-11-13 09:39:50 -08:00
Sidharth Guglani 0599af2282 using width for calculating margin top percent
Summary:
In Yoga, margin is not calculated correctly when defined in terms of percentage at one place.
According to CSS docs , margin percentage should be calculated according to width of container's block in case of horizontal writing mode. (https://fburl.com/5imus0it)
We were using height of container causing some issues in both android and iOS.

## Changelog:

[Yoga] [Fixed] - margin if defined in percentage should use container's width in horizontal writing mode

Reviewed By: alickbass

Differential Revision: D18395285

fbshipit-source-id: 87ebd013e3cba36da45f6548e4dff1bce69cce9b
2019-11-13 05:28:39 -08:00
Will Holen 39704b8937 Implement Debugger.setBreakpoint
Summary:
setBreakpoint differs from the existing setBreakpointByUrl in that you
can specify a scriptId directly. This was not really possible before
now, since scriptIds were mapped via filenames rather than to
RuntimeModules.

When (re)loading files with the same name, this call can be used to set
breakpoints in a specific one, rather than just the latest version.

Changelog: [Internal]

Reviewed By: bestander

Differential Revision: D18362054

fbshipit-source-id: 6ff1e736c79a4e75dc424316675d426ce9902f5f
2019-11-12 16:28:42 -08:00
Will Holen ae615c33d6 Actually send error when pause-on-exception-mode is unknown
Summary:
We were calling `sendErrorToClient` on error, but this function only
returns a closure that we threw away. Change to actually send an error
response.

Changelog: [Internal]

Reviewed By: bestander

Differential Revision: D18362055

fbshipit-source-id: 2ff1750ffd2c32a9291d3ed74fa0aaecd76c64c6
2019-11-12 16:28:41 -08:00
Will Holen 23feaa56cf Make debugger ScriptIDs per RuntimeModule rather than per filename
Summary:
When a filename (potentially with changes) is loaded multiple times, we keep
multiple instances around but fail to alert the attached debugger about this.

By coupling ScriptIDs to RuntimeModules rather than filenames, we can track
multiple instances of the same name instead.

Changelog: [Internal]

Reviewed By: bestander

Differential Revision: D18362052

fbshipit-source-id: 2147af32bc48c5fd2a2b080ea09dfa4133de7cf5
2019-11-12 16:28:41 -08:00
Ramanpreet Nara a95184cbad Make RCTNativeAnimatedModule a regular NativeModule
Summary: We suspect that RCTNativeAnimatedModule's conversion to TurboModule could be the cause. There could be a memory leak in the TurboModule system that RCTNativeAnimatedModule exposes, or RCTNativeAnimatedModule itself could have a memory leak. Therefore, I'm making RCTNativeAnimatedModule a regular NativeModule for now.

Reviewed By: fkgozali

Differential Revision: D18410852

fbshipit-source-id: dd714fe0fb0267fe5e1a94a26d47a82199b6f2c7
2019-11-12 13:56:09 -08:00
Oleksandr Melnykov bca8fa5a16 Use generated Java delegate for setting properties on ReactViewPagerManager
Summary:
This diff migrates ReactViewPagerManager to use the generated delegate for setting its properties.

Changelog: [Android] [Added] - Use generated Java delegate for setting properties on ReactViewPagerManager

Reviewed By: mdvacca

Differential Revision: D18298049

fbshipit-source-id: f989bedb16e3cabe6a9a8e4238a2b74515041d23
2019-11-12 05:41:28 -08:00
Marc Horowitz 8e750d75ee Switch use of xplat/hermes-inspector to xplat/js/react-native-github/ReactCommon/hermes/inspector
Summary: Changelog: [Internal]

Reviewed By: dulinriley

Differential Revision: D18364013

fbshipit-source-id: 1c077cf4f886ea620a62d8fe83dfd725850bcd31
2019-11-11 18:38:02 -08:00
Marc Horowitz abb4590285 Address folly and flipper version skew
Summary:
There's some incompatibilities which need to be fixed for real,
but this is a temporary fix to make the build work again.

Changelog: [Internal]

Reviewed By: willholen

Differential Revision: D18364011

fbshipit-source-id: c168e6496a504f9b00da0b9d758c50e2c6f314a4
2019-11-11 18:38:01 -08:00
Marc Horowitz e27610819d pull in debugger fixes from internal fork
Summary:
Changelog:
[Android] [Fixed] - Various bug fixes to the hermes inspector/debugger

Reviewed By: cpojer

Differential Revision: D18364014

fbshipit-source-id: d07dc3f4fd076fec3b6a64698ab8af67772a7a55
2019-11-11 18:38:01 -08:00