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

6179 Коммитов

Автор SHA1 Сообщение Дата
Luna Wei f9dec99284 Introduce multi-flush logger
Summary:
Changelog:
[Internal][Changed] - export types of performance logger

Reviewed By: rubennorte

Differential Revision: D24099293

fbshipit-source-id: 023459baa3754fb8bfaf6bf7a9061873af5756f9
2020-10-10 02:06:06 -07:00
Panagiotis Vekris 254d455103 Add type annotations to prevent issues with planned Flow changes
Summary:
We're planning a fix in Flow (D24112595) that uncovers some existing errors that were
previously suppressed. Adding these annotations prevents them from surfacing during the
deploy of the fix.

Changelog: [Internal]

Reviewed By: dsainati1

Differential Revision: D24147994

fbshipit-source-id: fef59a9427da6db79d4824e39768dd5ad0a8d1a3
2020-10-09 15:52:21 -07:00
Héctor Ramos b581bcaae0 TurboModule iOS: Use react-native-codegen FBReactNativeSpec output
Summary:
Use the ObjC++ native modules files generated by `react-native-codegen` for the FBReactNativeSpec library.

People working with the core native modules may now re-generate these ObjC++ files using `USE_CODEGEN=1 pod install` or `scripts/generate-native-modules-specs.sh`.

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D22249978

fbshipit-source-id: a12db23defacdba36099a24ce0b8475c8973bd6d
2020-10-09 00:15:16 -07:00
Valentin Shergin 7ebb71a32f Back out "Align multi-line TextInput onSubmitEditing behavior"
Summary:
This is a revert of D22488870 (521b16730d). (https://github.com/facebook/react-native/pull/29177)
We have to revert it because we realized that it's a breaking change without a very good reason. We have to figure out a better way to unify platform behaviors.

Changelog:
[iOS][Fixed] - Reverted recent change in TextInput (#29177)

Reviewed By: fkgozali

Differential Revision: D24200517

fbshipit-source-id: af0e561a6b8d9ade487be6b197a5d79d326442b6
2020-10-08 16:08:24 -07:00
Luna Wei 88174991d9 Close globalLogger when creating scopedLogger
Summary:
# Changelog:
[Internal][Changed] - Close the global perf logger when we create the scoped performance logger and absorb the global perf logger into the scoped logger

Reviewed By: rubennorte

Differential Revision: D23898621

fbshipit-source-id: 0d9bfd95175e660c0bd0bc74974126f92fe409b2
2020-10-06 12:31:31 -07:00
Tim Yung 291668a40c RN: Omit Unused Platform-Specific Code
Summary:
Our Babel plugin that strips irrelevant platform-specific code does not currently know how to deal with early return statements.

This minor change to a couple call sites enables the output bundle for Android to omit code specific to iOS.

Changelog:
[Internal]

Reviewed By: ejanzer

Differential Revision: D24139922

fbshipit-source-id: 467c0c38dd45679b889a8a94d85f73fd969e5b36
2020-10-06 11:19:00 -07:00
Chris Dinh 77f7658e4e Export FlowId type
Summary:
The UserFlow API takes in a FlowId as a parameter on all of its calls. However, this type is currently not exported so consumers cannot store a generated FlowId without creating their own matching type.

Changelog: [Internal]

Reviewed By: dmitry-voronkevich

Differential Revision: D24115983

fbshipit-source-id: 63afbca01343a31aa60042db3693a96a6b854939
2020-10-05 16:28:42 -07:00
Valentin Shergin a977ad0071 Removing outdated warning from View Config infra
Summary:
In theory, view configs can be hierarchical (one can depend on another), at least it was semi-supported on iOS once. And AFAIK there is only one component that seems to use this feature - `RCTComponentHostingView`, all other components essentially inherit RCTView or nothing. At the same time, RCTComponentHostingView does not really need it because RCTComponentHostingView itself does not expose any props.

Changelog: [Internal] Removed outdated warning

Reviewed By: kacieb

Differential Revision: D24095348

fbshipit-source-id: 5629c7433f151b72aae8201c58dd42062990b77e
2020-10-04 11:22:40 -07:00
Dmytro Voronkevych 923b77aef9 Renaming UserFlow methods
Summary: Renaming methods in UserFlow to match other APIs

Reviewed By: swillard13

Differential Revision: D24078270

fbshipit-source-id: c3a65d440e389d7b3c76de7706372265584353c8
2020-10-02 08:09:05 -07:00
Dmytro Voronkevych 2c6d010a50 Adding UserFlow.compleWithFail to RN
Summary: Adding method UserFlow.completeWithFail.

Reviewed By: swillard13

Differential Revision: D24052851

fbshipit-source-id: 1baa30a2d7dfb9ef4e457a74b66fd24e4ffbf21f
2020-10-02 08:09:05 -07:00
Dmytro Voronkevych c4629f7cce UserFlow API for ReactNative
Summary: Creating UserFlow API to track reliability of user interactions

Reviewed By: swillard13

Differential Revision: D23937121

fbshipit-source-id: 83701b8216c9b18c9c3d8c332efa84942ac26ba6
2020-10-02 08:09:05 -07:00
simek 8a31dfe567 chore: update RNTester example link in PanResponder comment (#30051)
Summary:
This PR fixes a small leftover after the RNTester migration to the monorepo package - an invalid link in the `PanResponder` comment.

Refs:
* https://github.com/facebook/react-native/issues/29567
* facebook/react-native-website#2177 (the similar correction was a part of merged PR in the RN docs)

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Internal][Fixed] PanResponder: correct example link in comment

Pull Request resolved: https://github.com/facebook/react-native/pull/30051

Test Plan: N/A

Reviewed By: fkgozali

Differential Revision: D24025065

Pulled By: hramos

fbshipit-source-id: 190486e458fb8e83a35fa2d3c62f4483f3a4334d
2020-09-30 14:36:59 -07:00
Tommy Nguyen 521b16730d Align multi-line TextInput onSubmitEditing behavior (#29177)
Summary:
Aligns behavior to be consistent with Android and the [documentation](https://reactnative.dev/docs/textinput#bluronsubmit). `onSubmitEditing` should not be called when `blurOnSubmit=false`.

## Changelog

[iOS] [Fixed] - Align multi-line TextInput onSubmitEditing behavior

Pull Request resolved: https://github.com/facebook/react-native/pull/29177

Test Plan: ![textinput-blur-align](https://user-images.githubusercontent.com/4123478/85121116-85b4b200-b224-11ea-86c5-065e9e6d22ba.gif)

Reviewed By: shergin

Differential Revision: D22488870

Pulled By: hramos

fbshipit-source-id: 2dec3a55da6384389a8358896ef1fbfd806d0304
2020-09-29 15:57:52 -07:00
Ramanpreet Nara c267b8de72 Rewrite ObjC++ module generator
Summary:
## Misc. Improvements

* We now have 95%+ flow coverage in all generator files. Henceforth, we can make changes to these files with more confidence, and trust flow to catch more errors. This should also improve the DevX of working on these files.
* Better templates: Instead of doing string replace with RegExps, we instead use functions and leverage JS template literals to generate our code. A few benefits: (1) data dependencies of templates are clearly visible, and statically checked by flow, (2) the templates are more readable in VSCode.
* Merged the GenerateModuleHObjCpp.js and GenerateModuleMm.js generators. They can share a lot of logic, so it's not a good idea to keep them separate.
* The ObjC++ module generator no longer generates “dead” structs (i.e structs that aren’t used by type-safety infra). In fact, it explicitly only supports the types in our Wiki. (I know this wasn’t the case with the legacy codegen, because we were generating native code for enums in the legacy codegen). This is a mixed bag. The test to verify correctness will be more difficult to write. However, keeping structs in the codegen needlessly complicates the parsers + generators, and creates technical debt for us to clean up later.

## Abstractions
- **StructCollector:** As we serialize NativeModule methods, when we detect an ObjectTypeAnnotation in the return type of `getConstants()` or inside a method param, we must create a Struct JS object for it. When we detect a type-alias (also in the same locations), we must look up that type-alias and create a Struct from its RHS. A Struct is basically an ObjectTypeAnnotation with a context (i.e: used in getConstants() vs as a method param), that cannot contain other ObjectTypeAnnotations.
- **serializeMethod.js** Given a NativeModule method type annotation, output the protocol method, JS return type, selector, a record of which params were structs, and which structs. Basically, this is all the information necessary to generate the declaration and implementation codegen for a partiular NativeModule method.
- **serializeStruct/*.js**: After creating all these Structs, we need to loop over all of them, and tranform them into ObjC++ code.
  - **serializeStruct.js**: Depending on the struct context, calls either `serializeRegularStruct.js` or `serializeConstantsStruct.js`. Both of these files have the same layout/abstractions. They look very similar.
- **serializeModule.js:** Outputs RCTCxxConvert categories for transforming `NSDictionary *` into C++ structs. Outputs ObjCTurboModule subclass.

## Algorithm
```
for spec in NativeModuleSpecs
  structCollector = new StructCollector
  resolveAlias = (aliasName) => nullthrows(spec.aliases[aliasName])

  methodDatas = []
  for method in methods(spec)
    methodData.push(serializeMethod(method, structCollector, resolveAlias))
  end

  structs = structCollector.getStructs()

  output generateImplCodegen(methodDatas, structs)
  output generateHeaderCodegen(methodDatas, structs)
end
```

Changelog: [Internal]

Reviewed By: hramos

Differential Revision: D23633940

fbshipit-source-id: 7c29f458b65434f4865ef1993061b0f0dc7d04ce
2020-09-29 14:39:40 -07:00
Ramanpreet Nara ef145adb9d Split NativeImageStore into iOS and Android counterparts
Summary:
Split the two specs, so that that we don't have to use Flow unions in the merged spec.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D23800841

fbshipit-source-id: 28b67578832ebd733bd080877e4ab763c013fded
2020-09-29 14:39:37 -07:00
Paige Sun a7c026e667 Remove unused Fabric image instrumentation
Summary:
Remove the older implementation of image instrumentation in Fabric by removing, RCTImageInstrumentationProxy, ImageInstrumentation from ImageRequest, and trackURLImageContentDidSetForRequest from RCTImageLoaderWithAttributionProtocol.

Changelog: [RN][Fabric][Image] Remove unused Fabric image instrumentation

Reviewed By: fkgozali

Differential Revision: D23990606

fbshipit-source-id: 004d04025d031af11377a73e5bfb64b1e0449962
2020-09-29 14:19:09 -07:00
Lulu Wu 121141c86b Convert AndroidDialogPicker to JS view configs
Summary:
Convert AndroidDialogPicker to JS view configs

Changelog: [Internal]

Reviewed By: ejanzer

Differential Revision: D23911673

fbshipit-source-id: d5fefa997432f0096308ab5593ba74c2c07b71e1
2020-09-29 05:16:48 -07:00
simek 2160377574 remove most of tvOS remnants from the code (#29407)
Summary:
Refs: [0.62 release](https://reactnative.dev/blog/#moving-apple-tv-to-react-native-tvos), https://github.com/facebook/react-native/issues/28706, https://github.com/facebook/react-native/issues/28743, https://github.com/facebook/react-native/issues/29018

This PR removes most of the tvOS remnants in the code. Most of the changes are related to the tvOS platform removal from `.podspec` files, tvOS specific conditionals removal (Obj-C + JS) or tvOS CI/testing pipeline related code.

In addition to the changes listed above I have removed the deprecated `Platform.isTVOS` method. I'm not sure how `Platform.isTV` method is correlated with Android TV devices support which is technically not deprecated in the core so I left this method untouched for now.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

* **[Internal] [Removed]** - remove most of tvOS remnants from the code:
  * `TVEventHandler`, `TVTouchable`, `RCTTVView`, `RCTTVRemoteHandler` and `RCTTVNavigationEventEmitter`
* **[Internal] [Removed]** - remove `TARGET_TV_OS` flag and all the usages
* **[iOS] [Removed]** - remove deprecated `Platform.isTVOS` method
* **[iOS] [Removed]** - remove deprecated and TV related props from View:
  * `isTVSelectable`, `hasTVPreferredFocus` and `tvParallaxProperties`
* **[iOS] [Removed]** - remove `BackHandler` utility implementation

Pull Request resolved: https://github.com/facebook/react-native/pull/29407

Test Plan: Local tests (and iOS CI run) do not yield any errors, but I'm not sure how the CI pipeline would react to those changes. That is the reason why this PR is being posted as Draft. Some tweaks and code adjustment could be required.

Reviewed By: PeteTheHeat

Differential Revision: D22619441

Pulled By: shergin

fbshipit-source-id: 9aaf3840c5e8bd469c2cfcfa7c5b441ef71b30b6
2020-09-28 21:26:41 -07:00
Tim Yung 06ce643565 Text: Cleanup Native Component Configuration
Summary:
Cleans up the native component configuration for `RCTText` and `RCTVirtualText`.

This //does// lead to a breaking change because `Text.viewConfig` will no longer exist. However, I think this is acceptable because `viewConfig` has already long stopped being an exported prop on other core components (e.g. `View`).

Changelog:
[General][Removed] - `Text.viewConfig` is no longer exported.

Reviewed By: shergin

Differential Revision: D23708205

fbshipit-source-id: 1ad0b0772735834d9162a65d9434a9bbbd142416
2020-09-28 17:23:49 -07:00
Tim Yung 9da4d87798 Pressability: Support Lazy Hook Initialization
Summary:
Changes `usePressability` so that it accepts a nullable `config` argument.

This makes it possible for a component to use `usePressability` and lazily allocate the `config` and subsequent instance of `Pressability`. This can be useful for components that are commonly allocated but seldom pressed because it lets many usages of `usePressability` avoid allocating many extraneous objects.

Changelog:
[Internal]

Reviewed By: kacieb

Differential Revision: D23708206

fbshipit-source-id: 4a5063067131ce8c957fb16c49a2045e8c0b19fa
2020-09-28 17:23:49 -07:00
Luna Wei b85b4f46af Update PerformanceLogger to nullable timespans, points, extras
Summary: Changelog: [Internal][Fixed] - When we close performance loggers (D23845307 (aebb97b9c6)) we cannot rely that a timespan/point/extra will be in perf logger. Update types to reflect that.

Reviewed By: rubennorte

Differential Revision: D23907741

fbshipit-source-id: 63673aa69cd8c76253e4fee3463e37c86265cf7b
2020-09-28 10:53:55 -07:00
Valentin Shergin 27378b7f10 Animated: Early detection of division by zero in AnimatedDivision
Summary:
Same as D20969087 (be78673755) but a bit more sophisticated.

We currently see a lot of errors happens because of division by zero in AnimatedDivision module. We already have a check for that in the module but it happens during the animation tick where the context of execution is already lost and it's hard to find why exactly it happens.
Adding an additional check to the constructor should trigger an error right inside render function which should make the error actionable.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: fkgozali

Differential Revision: D23908993

fbshipit-source-id: d21be9a72ec04fe4ff0740777d9ff49cf1bcde73
2020-09-26 17:23:15 -07:00
Rob Walker 14042fb76f Don't crash when promise task is cancelled before its resolved (#29969)
Summary:
This pull request fixes a potential `TypeError` in TaskQueue.js, that happens if a promise is added to the task queue, which is cancelled between the promise starting and resolving.

The exact error this resolves is
```js
TypeError: TaskQueue: Error resolving Promise in task gen1: Cannot set property ‘popable’ of undefined
      167 |           queueStackSize: this._queueStack.length,
      168 |         });
    > 169 |       this._queueStack[stackIdx].popable = true;
          |                                              ^
      170 |       this.hasTasksToProcess() && this._onMoreTasks();
      171 |     })
      172 |     .catch(ex => {
      at Libraries/Interaction/TaskQueue.js:169:46
```

This specific error was also reported in https://github.com/facebook/react-native/issues/16321

## Changelog

[General] [Fixed] - Prevent TypeError in TaskQueue when cancelling a started but not resolved promise.

Pull Request resolved: https://github.com/facebook/react-native/pull/29969

Test Plan:
The added test demonstrates the error, if run without the fixed applied to TaskQueue.js.
This is a race condition error, so is difficult to replicate!

Reviewed By: yungsters

Differential Revision: D23785972

Pulled By: appden

fbshipit-source-id: ddb8d06b37d296ee934ff39815cf5c9026d73871
2020-09-25 19:21:56 -07:00
Stanisław Chmiela 663b5a878b Do not override decoders to RCTImageLoader (#29711)
Summary:
I (actually, [we](https://github.com/expo/expo/issues/9858)) noticed GIFs are no longer animating in Expo client after [enabling TurboModules](https://github.com/expo/expo/pull/9687).

## Changelog

[iOS] [Fixed] - Fix `RCTImageLoader` not using decoders provided.

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

Pull Request resolved: https://github.com/facebook/react-native/pull/29711

Test Plan:
![cat](https://user-images.githubusercontent.com/1151041/90775800-90112c00-e2f9-11ea-95cd-ab95a97068f4.gif)

The cat is moving! Before applying this commit `RCTGIFDecoder` provided in the initalizer is removed from the `_decoders` array in the

```objc
_decoders = [_bridge modulesConformingToProtocol:protocol(RCTImageDataDecoder)];
```

Also, compare

8f306cd66a/Libraries/Image/RCTImageLoader.mm (L243-L250)

and

8f306cd66a/Libraries/Image/RCTImageLoader.mm (L177-L184)

This PR makes `_decoders` behave the same as `_loaders`.

Reviewed By: PeteTheHeat

Differential Revision: D23908238

Pulled By: fkgozali

fbshipit-source-id: 1d7a6e0d180277f23d8c28916734713bc1833b8b
2020-09-24 10:36:16 -07:00
Samuel Susla 64ac01dbbe Prevent change of delegate in RCTUITextView
Summary:
Changelog: [internal]

# Problem

`[RCTUITextView setDelegate]` is a public method and if something changes the delegate, appropriate events won't be called on the component (onTextChange, onSelectionChange and the others).

# Solution

Prevent setting of delegate from outside of the class. Ideally we would want to hide `setDelegate` altogether but that would require a rewrite of `RCTUITextView`.

Reviewed By: JoshuaGross, shergin

Differential Revision: D23813095

fbshipit-source-id: 8b76ac86727d262d0f9b81adfc8e75157847284c
2020-09-24 01:02:40 -07:00
Luna Wei aebb97b9c6 Add close() to IPerformanceLogger
Summary:
To represent a final state where a logger should no longer be used

Changelog: [Internal] - To represent a final state where a logger should no longer be used

Reviewed By: rubennorte

Differential Revision: D23845307

fbshipit-source-id: 4b2bfda4f7425ba6bc8e5e1233d9baea60dd8667
2020-09-23 15:49:38 -07:00
Luna Wei 6d355c0abd Sort logger alphabetically
Summary:
Rearranging to alphabetically sort, no functionality changes

Changelog: [Internal]

Reviewed By: rubennorte, motiz88

Differential Revision: D23836997

fbshipit-source-id: 00232b88379e44920ecb74fa6ff43f36d941d93b
2020-09-23 15:49:38 -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
Scott Kyle 23717e48af Call stopObserving on correct queue
Summary:
Since `dealloc` can be called from any thread, this would result `stopObserving` being called on a different thread/queue than the specified `methodQueue`. We specifically encountered this issue with a module needing the main queue having its `stopObserving` called on a background queue.

Changelog:
[iOS][Fixed] - Call [RCTEventEmitter stopObserving] on specified method queue

Reviewed By: RSNara

Differential Revision: D23821741

fbshipit-source-id: 693c3be6876f863da6dd214a829af2cc13a09c3f
2020-09-21 17:30:34 -07:00
Andrei Shikov 22b5f32f74 Add extras to timespan and points in performance logger
Summary:
Changelog:
[Internal][Added] Added point-level extras to performance logger

Reviewed By: lunaleaps, rubennorte

Differential Revision: D23730275

fbshipit-source-id: 285c5d7ac769bd109df7ce0294da024401edf7d3
2020-09-21 07:37:40 -07:00
Kevin Gozali 7c93f5b001 Move TurboModule Core from ReactCommon/turbomodule to ReactCommon/react/nativemodule
Summary:
This diff moves the code of TurboModule Core from ReactCommon/turbomodule to ReactCommon/react/nativemodule

For iOS: Pod spec name stays as "ReactCommon/turbomodule/..." for now, only the source/header location is affected. The target will be renamed/restructured closer to TurboModule rollout.

changelog: [internal] Internal

Reviewed By: RSNara

Differential Revision: D23362253

fbshipit-source-id: c2c8207578e50821c7573255d4319b9051b58a37
2020-09-19 00:42:30 -07:00
Samuel Susla d1b695d343 Propagate nativeID in createAnimatedComponent
Summary:
Changelog: [internal]

https://our.intern.facebook.com/intern/diffusion/FBS/browse/master/xplat/js/react-native-github/Libraries/Animated/createAnimatedComponent.js?commit=1b6ce6c3a69a&lines=82-112

`_isFabric` in `createAnimatedComponent` returns false for Fabric component, that's why nativeID was not being assigned and view got flattened.

To fix this, props.nativeID is propagated. SnackBar already has nativeID https://our.intern.facebook.com/intern/diffusion/FBS/browse/master/xplat/js/RKJSModules/Libraries/FDS/FDSLightweightFeedback/DEPRECATED_FDSSnackBar.js?commit=1b6ce6c3a69a&lines=277

Reviewed By: PeteTheHeat

Differential Revision: D23757304

fbshipit-source-id: 9e4b4599c95b8af8767793bc8cdce717a347a273
2020-09-18 07:44:37 -07:00
Rubén Norte f1b84ddf2c Remove update option from stopTimestamp method in performance loggers
Summary:
Changelog:
[Internal][Changed] Removed `update` option from `stopTimestamp` method in performance loggers

Reviewed By: lunaleaps

Differential Revision: D23759138

fbshipit-source-id: bb83b6f5ff2f640733c2e508779b3bc52800e4f6
2020-09-18 07:14:17 -07:00
Rubén Norte fc4f667cde Remove unnecessary addTimeAnnotation method from performance logger
Summary:
Changelog:
[Internal][Removed] Removed `addTimeAnnotation` method from performance loggers

Reviewed By: lunaleaps

Differential Revision: D23758816

fbshipit-source-id: 98e0abae25266f3dcc5953f25f20cde8e3dac190
2020-09-18 07:14:16 -07:00
Rubén Norte 4d842963fa Remove unused timespan descriptions from performance loggers
Summary:
The `description` parameter is never used so we can simplify the API.

Changelog:
[Internal][Changed] Removed `description` option from performance logger timespans

Reviewed By: lunaleaps

Differential Revision: D23758829

fbshipit-source-id: 10900f86effc3e1f54a408cf8f9fbc9b3b52f569
2020-09-18 07:14:16 -07:00
Rubén Norte 2788ee8ba9 Improve performance logger definition and type safety
Summary:
The way the performance logger is defined now is very unsafe regarding type safety, as all accesses to its properties is untyped (`any`) and it uses several `mixed` types in cases that could be more refined.

This migrates the creation of performance loggers to instances of a class to improve its type safety. If there's an impact in performance, it's expected to be positive.

Changelog:
[Internal][Changed] - Replaced object literals with class instances to create performance loggers

Reviewed By: lunaleaps

Differential Revision: D23758609

fbshipit-source-id: 0734742eb97d92a4a53f7b66a8ca45a2ae90946c
2020-09-18 07:14:16 -07:00
Emily Janzer b352e2da81 Create a ClickableSpan for nested Text components
Summary:
Right now nested Text components are not accessible on Android. This is because we only create a native ReactTextView for the parent component; the styling and touch handling for the child component are handled using spans. In order for TalkBack to announce the link, we need to linkify the text using a ClickableSpan.

This diff adds ReactClickableSpan, which TextLayoutManager uses to linkify a span of text when its corresponding React component has `accessibilityRole="link"`. For example:

  <Text>
    A paragraph with some
    <Text accessible={true} accessibilityRole="link" onPress={onPress} onClick={onClick}>links</Text>
    surrounded by other text.
  </Text>

With this diff, the child Text component will be announced by TalkBack ('links available') and exposed as an option in the context menu. Clicking on the link in the context menu fires the Text component's onClick, which we're explicitly forwarding to onPress in Text.js (for now - ideally this would probably use a separate event, but that would involve wiring it up in the renderer as well).

ReactClickableSpan also applies text color from React if it exists; this is to override the default Android link styling (teal + underline).

Changelog: [Android][Fixed] Make nested Text components accessible as links

Reviewed By: yungsters, mdvacca

Differential Revision: D23553222

fbshipit-source-id: a962b2833d73ec81047e86cfb41846513c486d87
2020-09-15 17:34:35 -07:00
S. Weatherall 9c353b5ab0 Fix typo in invariant message (#29913)
Summary:
Fix a typo in the invariant message presented when ActionSheetManager does not exist (typo was found in 2 places)

## Changelog

[General] [Fixed] - Fix typo in invariant message

Pull Request resolved: https://github.com/facebook/react-native/pull/29913

Test Plan: Run ActionSheetIOS.showActionSheetWithOptions(...) on an Android emulator to get this invariant message to appear.

Reviewed By: hramos

Differential Revision: D23691048

Pulled By: appden

fbshipit-source-id: 469db65a42bf547c7818b45729befa214b5791f2
2020-09-14 16:42:43 -07:00
Tim Yung bdf3c79110 RN: Fix TouchableHighlight w/o `onLongPress`
Summary:
When `TouchableHighlight` was migrated to use `Pressability`, a bug was introduced due to `onLongPress` being unconditionally supplied as a callback. This bug leads to `onPress` not firing if the element is pressed for longer than 500ms, even when `onLongPress` is not supplied.

Closes #29040.

Changelog:
[General][Fixed] - TouchableHighlight fires `onPress` when pressed for >500ms, when `onLongPress` is not supplied.

Reviewed By: TheSavior

Differential Revision: D23664365

fbshipit-source-id: 3a0e92e276871eedd303888346a13433be15ac47
2020-09-11 19:05:54 -07:00
Paige Sun acda299453 6/6 Log image-rendered for Fabric image logging
Reviewed By: fkgozali

Differential Revision: D23450649

fbshipit-source-id: 58265a2c7855a2f4371d68637f09a07921821adf
2020-09-11 15:09:12 -07:00
Paige Sun 13759f192d 3/6 Add IGviewpoint for image visibility callbacks
Summary: Changelog: [Internal] Add IGviewpoint to get image visibility callbacks for when an UIImageView is in or out of view

Reviewed By: fkgozali

Differential Revision: D23428528

fbshipit-source-id: 87e4cee8fbe3c6b7da5153f87bbb530b2f990d96
2020-09-11 15:09:12 -07:00
Tim Yung 0c392bc405 Pressability: Consistently Fire `onPress{In,Out}` w/o `onPress`
Summary:
Currently any component using `Pressability` is quickly tapped and released (i.e. responder grant followed only by reponder release), we fire `onPressIn` and `onPressOut` immediately to ensure that any visual feedback for the interactive element is momentarily visible.

Currently, we were mistakenly skipping this logic if `onPress` was null.

This fixes it so that we fire `onPressIn` and `onPressOut` consistently, even if `onPress` is null.

Changelog:
[General][Fixed] - Pressability now consistently fires `onPressIn` and `onPressOut`, even without an `onPress`.

Reviewed By: lunaleaps

Differential Revision: D23613254

fbshipit-source-id: e316707cbb2a4814262dea4eb1ddf6e3780268d1
2020-09-10 17:04:26 -07:00
Tim Yung a6395d5406 Pressable: Add `unstable_pressDelay` Prop
Summary:
Adds a new `unstable_pressDelay` prop to `Pressable`.

This is intended to be used to experiment with adding a delay for when `onPressIn` fires. The intended purpose of this delay is to prevent `Pressable` elements from activating (i.e. `onPressIn` firing) if a touch gesture is immediately canceled by an enclosing native component (e.g. `ScrollView`).

Changelog:
[General][Added] - Added `unstable_pressDelay` prop to `Pressable`.

Reviewed By: lunaleaps

Differential Revision: D23604581

fbshipit-source-id: 5ce5d15a996c8a7aabaa465aa02fa8bad1044227
2020-09-10 17:04:26 -07:00
Tim Yung 86ffb9c41e Pressability: Remove Default Press Delay
Summary:
Removes the default press delay from `Pressability`, which was introduced in 0.63 and affected `Pressable`. Fixes #29376.

In a subsequent commit, I will bring it back as an `unstable_pressDelay` prop.

Changelog:
[General][Changed] - Removed default 130ms delay from Pressability and Pressable.

Reviewed By: lunaleaps

Differential Revision: D23604582

fbshipit-source-id: c21c72bf8b59fed028f5905ca4f805bb3fa79399
2020-09-10 17:04:26 -07:00
Jayme Deffenbaugh cb719a16cc Fix Xcode warnings in React-Core pod (#29622)
Summary:
With the upgrade to React Native 0.63, we started running into nullability warnings that were breaking our build. This PR fixes those nullability warnings as well as a few other warnings in React-Core.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[iOS] [Fixed] - Fix xcodebuild warnings in React-Core

Pull Request resolved: https://github.com/facebook/react-native/pull/29622

Test Plan:
- Nullability annotations should only affect compilation, but even though RNTester compiles, I'm not fully convinced that this won't break projects downstream. It would be good to get another opinion on this.
- The change in `RCTAllocateRootViewTag` is the only real logic change in this PR. We throw an exception if the root view tag is not in the correct format, so this change seems safe after some basic manual testing in RNTester.

Reviewed By: shergin

Differential Revision: D23386678

Pulled By: appden

fbshipit-source-id: a74875195a4614c3248e8f968aa98602e3ee2de0
2020-09-09 12:48:09 -07:00
Tim Yung b7b0e23202 TextInput: Add `onPressIn` and `onPressOut`
Summary:
Introduces support for `onPressIn` and `onPressOut` on the `TextInput` component.

This makes it possible to add visual feedback when users touch interact with `TextInput` components.

Changelog:
[General][Added] - TextInput now supports `onPressIn` and `onPressOut`.

Reviewed By: TheSavior

Differential Revision: D23514333

fbshipit-source-id: 1790e977b78f1c293d5476aef8613547f27d6731
2020-09-08 15:57:07 -07:00
Tommy Nguyen aaeffdb49a Fix "'RCTBlobPlugins.h' file not found" on iOS (#29684)
Summary:
Fixes iOS builds failing with the following error in certain setups:

```
/~/Pods/React-RCTBlob/Libraries/Blob/RCTBlobPlugins.mm:14:9: fatal error: 'RCTBlobPlugins.h' file not found
#import "RCTBlobPlugins.h"
        ^~~~~~~~~~~~~~~~~~
1 error generated.
```

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[iOS] [Fixed] - "'RCTBlobPlugins.h' file not found" when building iOS

Pull Request resolved: https://github.com/facebook/react-native/pull/29684

Test Plan:
- Existing builds should not fail
- Tested this change internally where we are seeing this build failure

cc hramos

Reviewed By: fkgozali

Differential Revision: D23581090

Pulled By: appden

fbshipit-source-id: 89d2088c362bfbd22df5cd098b110a43d76e784f
2020-09-08 12:56:43 -07:00
Tim Yung 49015b0f5b Text: Remove Extraneous `onResponderGrant` Argument
Summary:
This argument for the `onResponderGrant` event callback on `Text` is extraneous.

Changelog:
[General][Fixed] - Remove extraneous argument for `onResponderGrant` Flow type on `Text`.

Reviewed By: TheSavior

Differential Revision: D23513190

fbshipit-source-id: c4057cf534f4cdf73967e4324db64acc8cf323d0
2020-09-04 16:10:57 -07:00
Tim Yung b11d6ecbb8 EventEmitter: Replace `listeners()` with `listenerCount()`
Summary:
Replaces the `listeners()` method on `EventEmitter` with a `listenerCount()` method.

Changelog:
[General][Removed] - Removed `listeners()` from `DeviceEventEmitter` and `NativeEventEmitter`.
[General][Added] - Added `listenerCount()` to `DeviceEventEmitter` and `NativeEventEmitter`.

Reviewed By: cpojer

Differential Revision: D22204156

fbshipit-source-id: 15029525aeef55de9934a4f319910e666ecbe1d8
2020-09-03 15:21:11 -07:00
Rubén Norte 38062cf8a7 Log renderApplication_React_render timespan to scoped performance logger if available
Summary: Changelog: [Changed] Used scoped performance logger to mark the beginning and end of the call to the renderer, instead of using `GlobalPerformanceLogger`.

Reviewed By: lunaleaps

Differential Revision: D23240784

fbshipit-source-id: 7099f1a4b5da3f29596fcee289a715d295ae0a65
2020-09-03 06:46:09 -07:00