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

4759 Коммитов

Автор SHA1 Сообщение Дата
zhongwuzw eecf651e59 Prettier Image loader code (#23701)
Summary:
We use indent width with 2 spaces, but `RCTImageLoader` use 4 spaces, it's hard to code, code one line, adjust indent, or change Xcode's preference temporary. So let's prettier it.

[iOS] [Fixed] - Prettier Image loader code
Pull Request resolved: https://github.com/facebook/react-native/pull/23701

Differential Revision: D14278082

Pulled By: cpojer

fbshipit-source-id: 6e7db50741b0981f45622c19981cb5fd9bbc0a97
2019-02-28 22:48:09 -08:00
zhongwuzw e64aff80d2 Add lock guard for getter and setter of cancelLoad block when load images (#23696)
Summary:
`cancelLoad` block has race condition, let's add a lock to protect it.

[iOS] [Fixed] - Add lock guard for getter and setter of cancelLoad block when load images
Pull Request resolved: https://github.com/facebook/react-native/pull/23696

Differential Revision: D14275444

Pulled By: cpojer

fbshipit-source-id: aea6c05f5d5863fd9c31fda5a94f2045d97e0ff7
2019-02-28 18:31:48 -08:00
Eli White c5b8b292e2 Add setNativeProps type to FabricUIManager.js
Summary: This matches the types here: diffusion/FBS/browse/master/xplat/js/react-native-github/ReactCommon/fabric/uimanager/UIManagerBinding.cpp;7032ef8ae8c8f6c9129c9d821ff2276d99ae215e$316-332

Reviewed By: cpojer

Differential Revision: D14253790

fbshipit-source-id: 17b3aa38ace0c7bbc6ea102baf39df182034ba21
2019-02-28 13:25:55 -08:00
Rubén Norte ee1e15a3d9 Upgrade fbjs-scripts to 1.1.0
Summary: This new version uses paths relative to the `rootDir` option to compute cache keys, so it is compatible with remote caching.

Reviewed By: rickhanlonii

Differential Revision: D14241858

fbshipit-source-id: fbf244bbf389bf873fb8a42f35c9b023fb06182f
2019-02-28 09:46:05 -08:00
Alexey Lang 60640485e1 Introduce PerformanceLoggerContext and use it with renderApplication
Reviewed By: sahrens

Differential Revision: D14167646

fbshipit-source-id: 3f8dd27ba1c8866471e2af493c4cc0bc84706042
2019-02-28 03:39:40 -08:00
Alexey Lang 1aabbf5dce Allow to create local performance loggers
Reviewed By: bestander

Differential Revision: D14159631

fbshipit-source-id: 62830f67060e575841cbc864dde30c7bee7e7c4c
2019-02-28 03:39:40 -08:00
zhongwuzw 5b98adf629 Fixed wrong placeholder size calculation in multiline text input mode (#23682)
Summary:
We have the wrong calculation of placeholder size currently, leads `contentSize` or some things inaccuracy.

[iOS] [Fixed] - Fixed wrong placeholder size calculation in multiline text input mode
Pull Request resolved: https://github.com/facebook/react-native/pull/23682

Differential Revision: D14255932

Pulled By: cpojer

fbshipit-source-id: a1f40e90fc2c848579694965da8316fae9e5c4c5
2019-02-27 22:00:14 -08:00
zhongwuzw c2071c216e Fixed wrong contentSize calculation when placeholder is hidden in multiline text input (#23683)
Summary:
Currently, we pick the max size of text view's contentSize and placeholder's size, actually, if placeholder is be hidden, we should only return text view's contentSize.

[iOS] [Fixed] - Fixed wrong contentSize calculation when placeholder is hidden in multiline text input
Pull Request resolved: https://github.com/facebook/react-native/pull/23683

Differential Revision: D14255915

Pulled By: cpojer

fbshipit-source-id: 198faa7e1c5657371eb920973345194aedf72e41
2019-02-27 21:55:24 -08:00
Greg Nelson fceba0cabe Allow linking to non-http/https system schemes
Summary:
If you try linking to a system URL scheme that isn't http or https such a tel, the linking promise will be rejected. I'm fixing this by relying on the output of `BOOL canOpen = [RCTSharedApplication() canOpenURL:URL];` to resolve the promise, but still falling back on the better error message if the given URL cannot be opened.

Changelog:
[iOS][fixed] - Allow linking to system URL schemes other than http or https

Reviewed By: cpojer

Differential Revision: D14250507

fbshipit-source-id: d74b2bd615eb6e320a39a956424e0ee34d476dab
2019-02-27 20:49:11 -08:00
zhongwuzw 3b3e6a0eb3 Fixed onScroll prop in mulitline TextInput (#23668)
Summary:
We lose the support of `onScroll` prop for multiline TextInput, let's add it again.

[iOS] [Fixed] - Fixed onScroll prop in mulitline TextInput
Pull Request resolved: https://github.com/facebook/react-native/pull/23668

Differential Revision: D14253996

Pulled By: cpojer

fbshipit-source-id: 43ed191e18fdb716f6c53be3bf0f59f917b34b59
2019-02-27 18:26:27 -08:00
Héctor Ramos d4ce8463a8 React sync for revisions f24a0da...8e25ed2
Summary:
This sync includes the following changes:

- **[8e25ed20b](https://github.com/facebook/react/commit/8e25ed20b )**: Unify noop and test renderer assertion APIs (#14952) //<Andrew Clark>//
- **[870214f37](https://github.com/facebook/react/commit/870214f37 )**: Deprecate ref.setNativeProps in favor of ReactNative.setNativeProps (#14912) //<Eli White>//
- **[3989c0950](https://github.com/facebook/react/commit/3989c0950 )**: eslint-plugin-react-hooks@1.3.0 //<Dan Abramov>//
- **[1bbfbc98d](https://github.com/facebook/react/commit/1bbfbc98d )**: [ESLint] Add more cases to exhaustive-deps rule (#14930) //<Dan Abramov>//
- **[412f88296](https://github.com/facebook/react/commit/412f88296 )**: fix(eslint-plugin-react-hooks): node engine updated to version 7 because of object.entries(#14951) //<Farhad Yasir>//
- **[ba708fa79](https://github.com/facebook/react/commit/ba708fa79 )**: Remove ReactNoop.flushDeferredPri and flushUnitsOfWork (#14934) //<Andrew Clark>//
- **[920b0bbb3](https://github.com/facebook/react/commit/920b0bbb3 )**: [scheduler] Pass didTimeout argument to callbacks (#14931) //<Andrew Clark>//
- **[f99fca3cb](https://github.com/facebook/react/commit/f99fca3cb )**: Fix sample ESLint configuration (#14926) //<Matt Thomson>//
- **[22bb94764](https://github.com/facebook/react/commit/22bb94764 )**: Release eslint-plugin-react-hooks@1.2.0 //<Dan Abramov>//
- **[a77bbf1a1](https://github.com/facebook/react/commit/a77bbf1a1 )**: [ESLint] Warn against assignments from inside Hooks (#14916) //<Dan Abramov>//
- **[219ce8a9c](https://github.com/facebook/react/commit/219ce8a9c )**: Fix tracing fixture (#14917) //<Dan Abramov>//
- **[8c1966590](https://github.com/facebook/react/commit/8c1966590 )**: Release 16.8.3 //<Dan Abramov>//
- **[7de4d2391](https://github.com/facebook/react/commit/7de4d2391 )**: Fix UMD builds by re-exporting the scheduler priorities (#14914) //<Dan Abramov>//
- **[d0318fb3f](https://github.com/facebook/react/commit/d0318fb3f )**: Updating copyright headers, dropping the year (#14893) //<Nathan Hunzaker>//
- **[f978d5fde](https://github.com/facebook/react/commit/f978d5fde )**: Fix warning message for new setNativeProps method. on -> with (#14909) //<Eli White>//
- **[b0f45c0fc](https://github.com/facebook/react/commit/b0f45c0fc )**: Adding ReactNative.setNativeProps that takes a ref (#14907) //<Eli White>//
- **[4f4aa69f1](https://github.com/facebook/react/commit/4f4aa69f1 )**: Adding setNativeProps tests for NativeMethodsMixin (#14901) //<Eli White>//
- **[b96b61dc4](https://github.com/facebook/react/commit/b96b61dc4 )**: Use the canonical nativeTag for Fabric's setNativeProps (#14900) //<Eli White>//
- **[dab2fdbbb](https://github.com/facebook/react/commit/dab2fdbbb )**: Add eslint-plugin-react-hooks/exhaustive-deps rule to check stale closure dependencies (#14636) //<Dan Abramov>//
- **[1493abd7e](https://github.com/facebook/react/commit/1493abd7e )**: Deleted empty App.css (#14149) //<Josh R>//
- **[13645d224](https://github.com/facebook/react/commit/13645d224 )**: Deal with fallback content in Partial Hydration (#14884) //<Sebastian Markbåge>//
- **[c506ded3b](https://github.com/facebook/react/commit/c506ded3b )**: Don't discard render phase state updates with the eager reducer optimization (#14852) //<Dan Abramov>//
- **[0e67969cb](https://github.com/facebook/react/commit/0e67969cb )**: Prompt to include UMD build artifact links in GitHub release (#14864) //<Brian Vaughn>//
- **[fad0842fd](https://github.com/facebook/react/commit/fad0842fd )**: Release scripts documentation (#14863) //<Brian Vaughn>//
- **[ab7a67b1d](https://github.com/facebook/react/commit/ab7a67b1d )**: Fix react-dom/server context leaks when render stream destroyed early (#14706) //<overlookmotel>//
- **[3e5556043](https://github.com/facebook/react/commit/3e5556043 )**: Release 16.8.2 //<Dan Abramov>//
- **[dfabb77a9](https://github.com/facebook/react/commit/dfabb77a9 )**: Include another change in 16.8.2 //<Dan Abramov>//
- **[c555c008b](https://github.com/facebook/react/commit/c555c008b )**: Include component stack in 'act(...)' warning (#14855) //<Sunil Pai>//
- **[ff188d666](https://github.com/facebook/react/commit/ff188d666 )**: Add React 16.8.2 changelog (#14851) //<Dan Abramov>//
- **[c4d8ef643](https://github.com/facebook/react/commit/c4d8ef643 )**: Fix typo in code comment (#14836) //<Deniz Susman>//
- **[08e955435](https://github.com/facebook/react/commit/08e955435 )**: Statically enable suspense/partial hydration flag in www (#14842) //<Sebastian Markbåge>//
- **[0e4135e8c](https://github.com/facebook/react/commit/0e4135e8c )**: Revert "[ShallowRenderer] Queue/rerender on dispatched action after render component with hooks (#14802)" (#14839) //<Dan Abramov>//
- **[6d4038f0a](https://github.com/facebook/react/commit/6d4038f0a )**: [ShallowRenderer] Queue/rerender on dispatched action after render component with hooks (#14802) //<Rodrigo Ribeiro>//
- **[fa6205d52](https://github.com/facebook/react/commit/fa6205d52 )**: Special case crossOrigin for SVG image elements (#14832) //<Brandon Dail>//
- **[c6bee765b](https://github.com/facebook/react/commit/c6bee765b )**: Remove false positive warning and add TODOs about `current` being non-null (#14821) //<DanAbramov>//
- **[3ae94e188](https://github.com/facebook/react/commit/3ae94e188 )**: Fix ignored sync work in passive effects (#14799) //<Dan Abramov>//
- **[f3a14951a](https://github.com/facebook/react/commit/f3a14951a )**: Partial Hydration (#14717) //<Sebastian Markbåge>//

Changelog:

[GENERAL] [Changed] React sync for revisions f24a0da...22bb947

Reviewed By: gaearon

Differential Revision: D14160361

fbshipit-source-id: fffdc922f3ee5dfeeee656a8f213a6d3c03e8481
2019-02-27 07:57:19 -08:00
Joshua Gross 57afad1c1f RCTCameraRollManager: fix "all" photos filter
Summary: Currently, trying to fetch "all" photos will loop and never complete. Now it appears to produce the expected results (acting like the "All Photos" smart library in Photos) and doesn't loop. Confirmed console log results, showing no loops: P60994983

Reviewed By: PeteTheHeat

Differential Revision: D14221545

fbshipit-source-id: 31381b1ba2c673fd210cb95f3b7d0f8ffc23ec3f
2019-02-26 11:29:56 -08:00
zhongwuzw f3ad49be67 Fixed placeholder font not consistent with text's font when in multiline mode (#23654)
Summary:
Placeholder's font not consistent with text's font, it leads to cursor dislocation. We need to keep consistent between placeholder and text.

[iOS] [Fixed] - Fixed placeholder font not consistent with text's font when in multiline mode
Pull Request resolved: https://github.com/facebook/react-native/pull/23654

Differential Revision: D14226174

Pulled By: hramos

fbshipit-source-id: 7cfb3b73d8799d22d5cbbfe557df8de3f5fcf034
2019-02-26 09:36:45 -08:00
zhongwuzw 06c6c7c673 Remove compatible system code for iOS8 and before (#23656)
Summary:
We already only support `iOS9+`, so we can remove all compatible codes now.

[iOS] [Fixed] - Remove compatible system code for iOS8 and before
Pull Request resolved: https://github.com/facebook/react-native/pull/23656

Differential Revision: D14224986

Pulled By: hramos

fbshipit-source-id: cac9ffe6788dd3eaf4f4f5f2b219f325ba78e85f
2019-02-26 07:58:52 -08:00
Masayuki Iwai 58c956768a Update _scrollAnimatedValue offset of ScrollViews. (#19481)
Summary:
`_scrollAnimatedValue` offset of ScrollView is set once in `UNSAFE_componentWillMount` but it is never updated.
It causes unexpected render result.

![rn-scrollview-fix1](https://user-images.githubusercontent.com/143255/40640292-61843eca-6350-11e8-9412-f5383ea65ea0.gif)

So I suggest to update `_scrollAnimatedValue` offset when ScrollView contentInset is updated.
Pull Request resolved: https://github.com/facebook/react-native/pull/19481

Differential Revision: D14223304

Pulled By: cpojer

fbshipit-source-id: 4191cfcf6414adf3a0abd156517d5f9778565671
2019-02-26 01:42:28 -08:00
Christoph Nakazawa 14d9b2d68d Remove ListView and SwipeableListView from React Native
Summary:
This diff removes ListView and SwipeableListView from React Native:
* Removes the code and all examples
* Removes the exports on `react-native-implementation` but leaves an error message in dev mode only
* Uses `deprecated-react-native-listview` for `ListView` and `deprecated-react-native-swipeable-listview` for `SwipeableListView`

Both ListView and SwipeableListView are now fully removed from React Native in open source and we will continue to use the deprecated packages internally.

Reviewed By: TheSavior

Differential Revision: D14181708

fbshipit-source-id: 5030c33791f998567de058fee934449c16fa1d54
2019-02-25 22:40:10 -08:00
zhongwuzw 9ac219e077 fix getter of result from Image query cache (#23602)
Summary:
We assume `map` is the type of `Map`, but actually it's not, so we would get type error.

[iOS] [Fixed] - [RNTester] fix getter of result from Image query cache
Pull Request resolved: https://github.com/facebook/react-native/pull/23602

Differential Revision: D14221747

Pulled By: cpojer

fbshipit-source-id: 06cf08078a330e4d5731ad72010c87e9e69fcd7b
2019-02-25 20:34:44 -08:00
Albert Sun 24b9889fb2 Location (iOS): Call back on requests only if they pass age and accuracy filters
Summary:
iOS pretty much always immediately updates location with the last cached location. This leads to the getCurrentPosition() API often returning this stale location. This change adds filtering to keep waiting until CLLocationManager provides a location fix that passes the requirements for each pending request.

This is potentially breaking in that clients that rely upon getCurrentPosition being extremely fast may find that location fixes take longer than before. However in such cases they should relax their requirements for maximumAge and/or accuracy.

Reviewed By: mmmulani

Differential Revision: D13889626

fbshipit-source-id: f566314ed5968151dad0839b99e0d3c9a562af13
2019-02-25 14:21:36 -08:00
Spencer Ahrens ea54ceca13 basic useNativeDriver functionality
Summary:
Not super clean, but not terrible.

Unfortunately this still relies on the old Paper UIManager calling delegate methods to flush the operations queues. This will work for Marketplace You since Paper will be active, but we need to fix this, along with Animated Events which don't work at all yet.

Random aside: it seems like taps are less responsive in fabric vs. paper, at least on iOS. There is a sporadic delay between the touches event coming in nativly to the JS callback invoking the native module function to start the animation - this will need some debugging.

Reviewed By: shergin

Differential Revision: D14143331

fbshipit-source-id: 63a17eaafa1217d77a532a2716d9f886a96fae59
2019-02-25 12:25:34 -08:00
Pim de Witte 7c4dbd617d Prop to disable the default pan responder on ScrollView that blocks touches when snapToInterval is enabled (#19110)
Summary:
The ScrollView component seems to have been written for a default touch up / touch down scrolling behavior. However, when using snapToInterval, this default behavior of adding PanResponders while the ScrollView is animating or has an active touch causes bugs with the PanResponder hijacking touches it is not supposed to hijack.
Pull Request resolved: https://github.com/facebook/react-native/pull/19110

Differential Revision: D14071342

Pulled By: hramos

fbshipit-source-id: ac285d9967dd6e2a347943b2455d4f986062ef62
2019-02-25 12:14:19 -08:00
ericlewis fd3db03427 Update openUrl (#23640)
Summary:
Fix deprecation with openUrl, handles feedback in #17011.

[iOS] [Fixed] - openUrl deprecation
Pull Request resolved: https://github.com/facebook/react-native/pull/23640

Differential Revision: D14211015

Pulled By: hramos

fbshipit-source-id: 9c8fa9f61aaa14542af9456dc39f6bfabd6a1405
2019-02-25 11:42:18 -08:00
ericlewis cd7cc7d640 Fix deadstore in RCTSpringAnimation (#23643)
Summary:
Fixes an unused storage of variable.

[iOS] [Fixed] - Fix deadstore in RCTSpringAnimation
Pull Request resolved: https://github.com/facebook/react-native/pull/23643

Differential Revision: D14211089

Pulled By: hramos

fbshipit-source-id: 640d46be25f03d766698f6e85490c7d1a6a019fc
2019-02-25 11:36:56 -08:00
ericlewis b758d63bc9 Fix image scaling (#23641)
Summary:
An updated version of: #22009, this compares the correct image size.

[iOS] [Fixed] - Compare network image sizes correctly
Pull Request resolved: https://github.com/facebook/react-native/pull/23641

Differential Revision: D14210991

Pulled By: hramos

fbshipit-source-id: 079053ef4a8f0e62da6eead9afc8de9285b35966
2019-02-25 11:31:55 -08:00
Takeru Chuganji b664dfdae3 iOS: Resolve a build warning for 32bit devices (#19416)
Summary:
<!--
  Required: Write your motivation here.
  If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
-->

This PR resolves a warning `Implicit conversion loses floating-point precision: 'double' to 'CGFloat' (aka 'float')` when building not only this library **but also apps** for 32bit devices since it's declared in public header file.
Pull Request resolved: https://github.com/facebook/react-native/pull/19416

Differential Revision: D14206633

Pulled By: cpojer

fbshipit-source-id: a65a4774235fa7fb24fac2f9bf7e51ba2a027377
2019-02-25 00:07:51 -08:00
zhongwuzw 7a7eb11965 Fix textAttributes not applied when typing text (#23585)
Summary:
Currently, if we has `defaultValue`, textAttributes like `letterSpacing` can works, but if textinput has not default text, when we typing the text, some attributes not applied.

[iOS] [Fixed] - Fix textAttributes not applied when typing text
Pull Request resolved: https://github.com/facebook/react-native/pull/23585

Differential Revision: D14206568

Pulled By: cpojer

fbshipit-source-id: 7db276d811684bf6e01f8d30287cca80095db87c
2019-02-24 23:37:41 -08:00
zhongwuzw 5bc9c9b014 Add Image query cache result type (#23608)
Summary:
In iOS, seems we have no ways to check wether the cached item is from disk or memory, only `storagePolicy == NSURLCacheStorageAllowedInMemoryOnly ` we can think it's from memory. So we need to add a new result like `disk/memory`?

[iOS] [Added] - Add Image query cache result type
Pull Request resolved: https://github.com/facebook/react-native/pull/23608

Differential Revision: D14205902

Pulled By: cpojer

fbshipit-source-id: 29c253878b5c6776cd4776508e24c57e6bfa7dfa
2019-02-24 21:59:50 -08:00
Peter Argany e38be82dfa Revert of [D13948951]Apply the fix for CJK languages on single-line test fields.
Summary:
This PR (https://github.com/facebook/react-native/pull/22546) broke single line text inputs. After inputting some text and tapping away, the text input reverts back to default text.

Revert solved the issue.

Reviewed By: cpojer

Differential Revision: D14185897

fbshipit-source-id: cc7f0f2ebfb0494062afbc628c4fe27ad27fb1c6
2019-02-22 11:00:07 -08:00
Eric Lewis 8ce3c1b43e Toggle secureTextEntry cursor spacing (#23524)
Summary:
This is a fix for #5859, based on the feedback in #18587. Instead of using `didSetProps` it uses a setter. I will also note that setting to `nil` no longer works (crashes) so setting it to a blank string then back to the original works fine.

[iOS] [Fixed] - Toggling secureTextEntry correctly places cursor.
Pull Request resolved: https://github.com/facebook/react-native/pull/23524

Differential Revision: D14143028

Pulled By: cpojer

fbshipit-source-id: 5f3203d56b1329eb7359465f8ab50eb4f4fa5507
2019-02-21 23:51:16 -08:00
ericlewis 9d817751b3 Fix RNTester warnings (#23584)
Summary:
Part of #22609. This brings the warning count down to 0 for the RNTester target, also adds a fancy new icon!

[General] [Fixed] - All RNTester warnings fixed
Pull Request resolved: https://github.com/facebook/react-native/pull/23584

Differential Revision: D14181197

Pulled By: cpojer

fbshipit-source-id: 4377a55cee6a2d87a7926f1c34663b8a070aef88
2019-02-21 23:17:37 -08:00
zhongwuzw d834197746 Fix build error warning of Text module (#23586)
Summary:
Throw error warning when build Text module, we can add tvOS available check to remove error.

[iOS] [Fixed] - Fix build error warning of Text module
Pull Request resolved: https://github.com/facebook/react-native/pull/23586

Differential Revision: D14181198

Pulled By: cpojer

fbshipit-source-id: 6a62c831ba119ddcbc6effa0b24f22bd4588b982
2019-02-21 23:12:39 -08:00
Vojtech Novak 976f4be457 support checkbox tinting (#18300)
Summary:
RN offers checkbox component on android: https://facebook.github.io/react-native/docs/checkbox.html

The Checkbox colors for checked and unchecked states cannot be controlled from JS at the moment; this PR adds support for that.

The essence of changing colors for the states is this:

```
ColorStateList cls = new ColorStateList(
        new int[][] {
                new int[] { -android.R.attr.state_checked }, // unchecked
                new int[] {  android.R.attr.state_checked }  // checked
        },
        new int[] {
                uncheckedColor,
                checkedColor
        }
);
checkBox.setSupportButtonTintList(cls);
```

Because of this, I did it so that both colors have to provided together in an object. This is similar to [switch](https://facebook.github.io/react-native/docs/switch#trackcolor)
Pull Request resolved: https://github.com/facebook/react-native/pull/18300

Differential Revision: D14180218

Pulled By: cpojer

fbshipit-source-id: 88a9d1faf061c0651e3e28950f697535b90fbfd4
2019-02-21 20:16:14 -08:00
Kevin Gozali 8b7a0c2a9b Created spec for SegmentFetcher native module
Summary: [General] [Added] - Simply adding spec for better enforcement of types.

Reviewed By: cpojer

Differential Revision: D14177690

fbshipit-source-id: ab4c112d1bd65fef7e37b4c1d6c44055f5576936
2019-02-21 20:10:30 -08:00
Ville Immonen 2321b3fd7f Split React.podspec into separate podspecs for each Xcode project (#23559)
Summary:
This PR implements the first part of [RFC0004: CocoaPods Support Improvements](353d44f649/proposals/0004-cocoapods-support-improvements.md), splitting the `React.podspec` into separate podspecs to more closely match the structure of Xcode projects.

The new structure aims to have one to one mapping between Xcode projects and podspecs. The only places where we differ from this mapping are:
* `React/React-DevSupport.podspec`: `DevSupport` is a part of `React.xcodeproj`, which corresponds to the `React-Core` pod. However, we can't include it in the `React-Core` pod because `DevSupport` depends on `React-RCTWebSocket`, which depends on `React-Core`. Pods may not have circular dependencies.
* The new pods under `ReactCommon/` don't have a corresponding `xcodeproj` because there are no `xcodproj` files in `ReactCommon/`. Those C++ modules are included in `React.xcodeproj`.

*Next steps (not in scope of this PR):*
- Start submitting the Podspecs to CocoaPods on a deploy (or turn the React Native repo into a spec repo): this is important in order to make the experience nicer for library consumers, so that it's not necessary to specify the local path of each Podspec in `Podfile`, you can just add `pod 'React', <version>`.
- Add `Podfile` to the default project template (I have a PR ready for this, but because of bugs related to subspecs, it's blocked on this PR)

[iOS] [Changed] - Split React.podspec into separate podspecs for each Xcode project
Pull Request resolved: https://github.com/facebook/react-native/pull/23559

Differential Revision: D14179326

Pulled By: cpojer

fbshipit-source-id: 397a9c30b6b5d24f86c790057c71f0d403f56c3d
2019-02-21 18:35:44 -08:00
Joshua Gross 286abc5d08 Enable profile builds by adding ObjC annotations
Summary: Currently xcode fails profile builds since these variables are unused when asserts are disabled.

Reviewed By: PeteTheHeat

Differential Revision: D14160565

fbshipit-source-id: 997352dd148d23c28fa92d4171071c1abbb742f5
2019-02-21 12:40:38 -08:00
Grégoire Rit c416b40542 Add setNextFocus support (#22082)
Summary:
Add properties to be able to set the nextFocus. It can be very useful with Android TV.

New android View properties :

* nextFocusDown binded to [setNextFocusDownId](https://developer.android.com/reference/android/view/View.html#setNextFocusDownId(int))
* nextFocusForward binded to [setNextFocusForwardId](https://developer.android.com/reference/android/view/View.html#setNextFocusForwardId(int))
* nextFocusLeft binded to [setNextFocusLeftId](https://developer.android.com/reference/android/view/View.html#setNextFocusLeftId(int))
* nextFocusRight binded to [setNextFocusRightId](https://developer.android.com/reference/android/view/View.html#setNextFocusRightId(int))
* nextFocusUp binded to [setNextFocusUpId](https://developer.android.com/reference/android/view/View.html#setNextFocusUpId(int))

Can be used to fix :

* Fixes #20593
* Fixes #20100

Same PR as #22080 but accorded to changes on master
Pull Request resolved: https://github.com/facebook/react-native/pull/22082

Differential Revision: D14162740

Pulled By: cpojer

fbshipit-source-id: 9a13a185d4e8307ce67014fb076c62d135c487c3
2019-02-20 23:37:35 -08:00
alanfoster c06473ab46 Update network inspector to have smarter scroll stickiness (#21952)
Summary:
When making use of the network inspector on a react-native app, it can be quite annoying that as new requests come in the network inspector instantly sticks to the bottom.

This PR makes this logic smarter by allowing the user to be scrolled away from the bottom by two rows to override this automatic scrolling to the bottom logic.
Pull Request resolved: https://github.com/facebook/react-native/pull/21952

Differential Revision: D14162762

Pulled By: cpojer

fbshipit-source-id: ad49858509dd74a817ebabab54fdacc99773bf22
2019-02-20 21:51:29 -08:00
Evan Bacon 104b1f9367 Add HMRLoadingView module for web target (#23389)
Summary:
* Added a default value for HMRLoadingView this will prevent errors from being thrown when `HMRClient` attempts to include it in a `web` context.

* [Web] [Added] - HMRLoadingView
Pull Request resolved: https://github.com/facebook/react-native/pull/23389

Differential Revision: D14045475

Pulled By: cpojer

fbshipit-source-id: df5c3cf3536af3b37eaf82342b6346bc25054319
2019-02-20 18:22:44 -08:00
Levi Buzolic a89fe4165c Map TextInput textContentType strings to Objective-C constants (#22611)
Summary:
This is an updated version of #22579 which uses compile conditionals to prevent `use of undeclared identifier` errors when compiling on older versions of Xcode.

--------

Currently the only `textContentType` values that work are: `username`, `password`, `location`, `name` and `nickname`. This is due to the strings provided by React Native not matching up with the underlying string constants used in iOS (with the exception of the aforementioned types). Issue #22578 has more detail examples/explanation.
Pull Request resolved: https://github.com/facebook/react-native/pull/22611

Differential Revision: D13460949

Pulled By: cpojer

fbshipit-source-id: e6d1108422b850ebc3aea05693ed05118b77b5de
2019-02-19 23:52:40 -08:00
Eric Lewis 35b6f866f1 helpful error on canOpenURL for missing scheme (#23535)
Summary:
iOS 9 introduced a whitelist for schemes that apps are allowed to open / check against, the current behavior of React Native is to simple return `NO` when a scheme is missing from that whitelist. It would be more helpful to throw an error with a suggested fix for the problem:
```
Unable to open URL: asos://checkout, add asos to LSApplicationQueriesSchemes in Info.plist.
```

[iOS] [Changed] - canOpenURL throws when custom scheme isn't in LSApplicationQueriesSchemes.
Pull Request resolved: https://github.com/facebook/react-native/pull/23535

Differential Revision: D14143005

Pulled By: cpojer

fbshipit-source-id: 4ead5f073690e627b4a4bbe3fa5a6cb5af46b589
2019-02-19 22:16:01 -08:00
zhongwuzw f8b52151eb Fixed textInput appearance not update when text attributes changed (#23533)
Summary:
If we change the text attributes dynamically, for example, change the textColor, it not works in iOS, Android works fine.

[iOS] [fixed] - Fixed textInput appearance not update when text attributes changed
Pull Request resolved: https://github.com/facebook/react-native/pull/23533

Differential Revision: D14146700

Pulled By: cpojer

fbshipit-source-id: 4a7c84d6e7f818acb712242bea6484b177a775c6
2019-02-19 22:02:20 -08:00
jsfu f08c94bd36 fix the TextInput can't control input length when value's length > maxLength (#23545)
Summary:
I found the TextInput can't control input length when default value's length > maxLength.
for example:
1.Set the value in special cases
```
<TextInput value={'12345678'} maxLength={6}/>
```
2.Quickly press the keyboard with multiple fingers

```
// RCTBaseTextInputView.m
……
if (_maxLength) {
    NSUInteger allowedLength = _maxLength.integerValue - backedTextInputView.attributedText.string.length + range.length;
    if (text.length > allowedLength) {
……
```
when value's length > maxLength,the allowedLength not a negative number.it was transformed into a big number,because it is type NSUInteger.so the `text.length > allowedLength` always false.

[iOS][Fixed] - fix the TextInput can't control input length when value's length > maxLength
Pull Request resolved: https://github.com/facebook/react-native/pull/23545

Differential Revision: D14146581

Pulled By: cpojer

fbshipit-source-id: f53b1312ae55fad9fc10430ab94784c1a9ad4723
2019-02-19 21:41:07 -08:00
zhongwuzw f8276805ca Add ImageIO nullable check in Image module (#23544)
Summary:
Add ImageIO nullable check in Image module to prevent crash.

[iOS] [Fixed] - Add ImageIO nullable check in Image module
Pull Request resolved: https://github.com/facebook/react-native/pull/23544

Differential Revision: D14146483

Pulled By: cpojer

fbshipit-source-id: 813caebea1e24d5e282b21cc50240ec1886339d5
2019-02-19 21:22:37 -08:00
Laurin Quast 3e4d353d2c feat(permissions-android): export Rationale type and add missing properties according to docs (#23510)
Summary:
I checked the documentation over at https://facebook.github.io/react-native/docs/permissionsandroid and the documented properties `buttonPositive`, `buttonNegative` and `buttonNeutral` are not available in the flow-type definitions.

___

Also the Rationale type is not exported which makes it hard to reuse it in a library or in your own application code.

However I do not know if it is actually intended to import "internal" flow-types from `react-native` since I could not find any other type or interface being exported. So I am not 100% sure if I should have done this.

[General] [Added] - Export Rationale flow-type and add missing properties `buttonPositive`, `buttonNegative` and `buttonNeutral` to the documentation.
Pull Request resolved: https://github.com/facebook/react-native/pull/23510

Differential Revision: D14123848

Pulled By: cpojer

fbshipit-source-id: 4040590932db645da6422d680246fed1d46dbe79
2019-02-18 07:04:58 -08:00
James Munro 794da6a4e4 Remove SnapshotViewIOS from public interface (#23497)
Summary:
Part of Lean Core #23313

Removes `SnapshotViewIOS` from the public RN interface.

I think there's a wider discussion to be had here about whether `RCTTest` should be part of the public distribution or at least whether this should be split into a separate utils package. It's mainly used by the RNTester app. It seems to be little known about but there are [some references to it online](https://blog.callstack.io/testing-your-react-native-apps-abfe41903dfd).

[iOS] [Removed] - `SnapshotViewIOS` is no longer publicly exported from RN
Pull Request resolved: https://github.com/facebook/react-native/pull/23497

Differential Revision: D14123280

Pulled By: cpojer

fbshipit-source-id: badaf6cb5d2195268f0f8b429fc11d6525747708
2019-02-18 04:04:23 -08:00
zhongwuzw f95876ba8c Remove android initialAppState fallback check (#23487)
Summary:
1. We expose the `initialAppState` for Android in #19935, so we can remove the fallback check for Android.
2. Rename `RCTCurrentAppBackgroundState` to `RCTCurrentAppState`, it's a private file function, so it's safe to rename, `RCTCurrentAppState` is more suitable because we actually get app state, not app background state.

[Android] [Enhancement] - Remove android `initialAppState` fallback check.
Pull Request resolved: https://github.com/facebook/react-native/pull/23487

Differential Revision: D14121293

Pulled By: cpojer

fbshipit-source-id: fec196cef2969fe6f6f1571f4ebcafcec26266a1
2019-02-17 15:32:13 -08:00
Vishwesh Jainkuniya 9126add6b9 Add prop to configure `importantForAutofill`. (#22763)
Summary:
In API 26, autofill framework was introduced in Android.
Read more about Autofill at https://developer.android.com/guide/topics/text/autofill.

Now, if in case for some text input if developer wants to disable
autofill then he can take help from this `importantForAutoFill` prop
and pass `no` to it.

Also important of auto fill can be configured with this prop, like:
* `auto`: Let the Android System use its heuristics to determine if the view is important for autofill.
* `no`: This view isn't important for autofill.
* `noExcludeDescendants`: This view and its children aren't important for autofill.
* `yes`: This view is important for autofill.
* `yesExcludeDescendants`: This view is important for autofill, but its children aren't important for autofill.

Default value if `auto`.

Read more at: https://developer.android.com/guide/topics/text/autofill-optimize

Changelog:
----------
[Android] [Added] - Add prop to configure `importantForAutofill` in `TextInput`.
Pull Request resolved: https://github.com/facebook/react-native/pull/22763

Differential Revision: D14121242

Pulled By: cpojer

fbshipit-source-id: aa4360480dd19f6dde66f0409d26a41a6a318c94
2019-02-17 14:33:37 -08:00
Daniel Sainati 8da1f1149f deploy 0.93
Summary:
upgrades flow version

allow-large-files
bypass-lint

Reviewed By: nmote

Differential Revision: D14095305

fbshipit-source-id: 000b3b2e085f673bc443fc8bc1b3aae1b42df0e9
2019-02-15 12:04:32 -08:00
Cassio Zen f15145639d Add autoComplete prop (#21575)
Summary:
TL;DR: Setting `autoComplete` will allow the system to suggest autofill options for the `<TextInput>` component.

Android Oreo introduced the AutoFill Framework, for secure communication between an app and autofill services (e.g. Password managers). When using `<TextInput>` on Android Oreo+, the system already tries to autofill (based on heuristics), but there is no way to set configuring options or disable.

The quick solution would be to just add the same Android attributes (`autofillHints` & `importantForAutofill`) in React Native TextInput, but that doesn't bond well with the cross-platform nature of the library.

Introduces an `autoComplete` prop based on HTML's `autocomplete` attribute, mapping to Android `autofillHints` & `importantForAutofill` and serving as a proper placeholder for autofill/autocomplete in other platforms:

Also gives you the ability to disable autofill by setting autocomplete="off".
Pull Request resolved: https://github.com/facebook/react-native/pull/21575

Differential Revision: D14102949

Pulled By: hramos

fbshipit-source-id: 7601aeaca0332a1f3ce8da8020dba037b700853a
2019-02-15 09:13:05 -08:00
Till Schmidt 53b87dcfff add new config resetBeforeIteration for Animated.loop (#20561)
Summary:
Fixes #20560
Pull Request resolved: https://github.com/facebook/react-native/pull/20561

Differential Revision: D14103437

Pulled By: cpojer

fbshipit-source-id: 35f2b3426304248e1a28f6a88812f07414618ea2
2019-02-15 08:50:31 -08:00
Sivaram Prasad Pulla c9ee902485 Adding support to cancel a headless task (#20416)
Summary:
On UWP, when the app is executing a Background task, the OS can request it to cancel the task (for various reasons). If the app does not cancel its background task quickly, the OS might terminate the app.
This change adds support to cancel the headless task which can be used by native code to forward the cancellation request from the OS to the JS code.
Pull Request resolved: https://github.com/facebook/react-native/pull/20416

Differential Revision: D10052080

Pulled By: cpojer

fbshipit-source-id: 2c0322ebb45f7835739f68bdf82a7100d968c516
2019-02-15 08:28:12 -08:00
Aditya Koukuntla 3ca33320bd Enable background updates when NSLocationWhenInUseUsageDescription is set (#20911)
Summary:
Location updates are not working in background when user allows **When in use authorization**, but works when user allows **Always allow**.

In Geolocation/RCTLocationObserver.m, setAllowsBackgroundLocationUpdates are set only for **Always allow** case, but native iOS allows us to setAllowsBackgroundLocationUpdates even for **When in use authorization**.

Solution:
setAllowsBackgroundLocationUpdates is now set for both cases.

[iOS] [Fixed] RCTLocationObserver - Enable background location updates when NSLocationWhenInUseUsageDescription is set
Pull Request resolved: https://github.com/facebook/react-native/pull/20911

Differential Revision: D13891852

Pulled By: cpojer

fbshipit-source-id: 5aae8dc12a147e7bed688807f34466b0f5a69344
2019-02-15 08:13:05 -08:00
zhongwuzw bd67254af1 fix typo in comments (#23478)
Summary:
Nit, just fix typo.

[iOS] [Fixed] - Fix typo in comments
Pull Request resolved: https://github.com/facebook/react-native/pull/23478

Differential Revision: D14101659

Pulled By: cpojer

fbshipit-source-id: b3d2bf25971c31a5fa3c411fbdfe761075dc4cfa
2019-02-15 07:18:30 -08:00
Amir Sharif 50fc666aad Add support for regex in YellowBox warnings
Summary: We want to use a Regex for potentially more complicated string warnings. This will allow ignoring dynamic rules that include ID fields for example.

Differential Revision: D14079118

fbshipit-source-id: aff01c6b6eedc77cd91638988700c093dcda0488
2019-02-14 16:39:34 -08:00
Dawid 0fe26db679 Add deprecation warning for ImageEditor (#23452)
Summary:
Add a deprecation warning for the [ImageEditor](https://facebook.github.io/react-native/docs/imageeditor) module as part of #23313.

[General] [Deprecated] - Deprecated [ImageEditor](https://facebook.github.io/react-native/docs/imageeditor) as it has now been moved to [react-native-community/image-editor](https://github.com/react-native-community/react-native-image-editor)
Pull Request resolved: https://github.com/facebook/react-native/pull/23452

Differential Revision: D14082792

Pulled By: cpojer

fbshipit-source-id: 2315b4518ce20a0ec4e97f421960e4ab923ba21d
2019-02-14 06:18:29 -08:00
Christoph Nakazawa caf85d403a Remove VibrationIOS
Summary: This module has been deprecated for two years. There is `Vibration`, backed by the same native module, with cross platform support.

Reviewed By: rickhanlonii

Differential Revision: D14080979

fbshipit-source-id: 7bf60cfdca9517c6858b3c7f8a2b16eab0ce8e80
2019-02-14 05:41:53 -08:00
Christoph Nakazawa a5ae7f57f1 Remove deprecation messages.
Summary: These modules have been deprecated for at least one release or more. By landing this diff now, they will be fully removed from 0.60 (to be released in ~April).

Reviewed By: rickhanlonii

Differential Revision: D14080869

fbshipit-source-id: cf39cc1782eec1dd09750d20b55c76f580320f4d
2019-02-14 05:41:53 -08:00
Josh Carver 4c400a10c2 Make ImagePickerIOS.openCameraDialog work with video (fixes #17989) (#19170)
Summary:
Fixes #17989

Previously, `ImagePickerIOS.openCameraDialog` would not render a `Video` option when the camera screen opened. If you passed `ImagePickerIOS.openCameraDialog({ videoMode: true }, ...)` the app would crash with an error complaining about the proper mediaType(s) not being set (see issue: #17989  for full details).

This is a 2 line change that sets the mediaTypes properly, so now users can capture videos in addition to photos.
Pull Request resolved: https://github.com/facebook/react-native/pull/19170

Differential Revision: D14068078

Pulled By: hramos

fbshipit-source-id: d04a3d267ca83ea58e88c880a85ac34ddd4744c8
2019-02-13 13:27:18 -08:00
Christoph Nakazawa c6d8f6048a Properly gate platform specific code in Alert
Summary:
In the past, Alert and AlertIOS were separate modules and both were shipped on Android even though only Alert can be used there. We unified the two modules but it meant that the code for both was still shipped on both platforms.

This diff changes it so that platform specific code is gated in a `Platform.OS` block, which means that the unnecessary code per platform is being stripped out. I'm not looking to win a beauty contest with the code in this module - we have barely touched it in years and I don't think we will touch it anytime soon, so I just merged the sub-classes (which only had static methods anyway) directly into the main class. I'm aware I could make two separate files with platform extensions but that ends up being more code here and it seems straightforward enough to me.

Reviewed By: TheSavior

Differential Revision: D14057404

fbshipit-source-id: 1ae1d227a39d76de9779b3db62960cca46e9b75c
2019-02-13 04:24:12 -08:00
Rafael Lincoln 36e026ee89 Add a deprecation warning when importing PushNotificationIOS (#23396)
Summary:
Added a deprecation warning for the `PushNotificationIOS`, module as part of #23313.

[General] [Deprecated] - PushNotificationIOS [was moved to community repo](https://github.com/react-native-community/react-native-push-notification-ios)
Pull Request resolved: https://github.com/facebook/react-native/pull/23396

Differential Revision: D14055656

Pulled By: cpojer

fbshipit-source-id: fc371340aa4d8ac82fee2a3dc6f6c796ae98dde4
2019-02-12 13:47:25 -08:00
Emily Janzer 7652e31d8c Pass through track color values for true/false to native component
Summary:
There's a bug in the OSS Switch component where the track color value is reset to the default value when the switch is toggled. It looks like the Java class resets the track color value in `setOn` (which fires in a press event): https://fburl.com/vmugfzja but these values aren't actually initialized from JS - in Switch.js we only pass through the current track color: https://fburl.com/vytekd0o.

The React component already has an API for defining both true/false track colors. However, we should also make sure not to reset these values for people using the old API of `tintColor`/`onTintColor`, so I'm changing it to only reset the value when both of those props are null.

Reviewed By: mdvacca

Differential Revision: D14035007

fbshipit-source-id: 12d968076bd47d54deedbfc15b12ff3cd77e2fd0
2019-02-12 10:47:58 -08:00
Peter Argany 2d86d38e75 Make AnimatedMock instantly complete spring and timing animations
Summary:
Some MP E2E tests started failing when I introduced AnimatedMock (D13811035) with this error:

> message: Timeout exception: Message: element located by locator {"id":"mp_your_items_tab_button"} is not visible

The test relied on the button to animate in, which AnimatedMock disabled. The fix is to complete animations instantly in AnimatedMock. This diff implements that for spring and timing.

Reviewed By: cpojer

Differential Revision: D14036172

fbshipit-source-id: 18a422ce8ef6de05ff9224c94214524511a76949
2019-02-12 10:40:23 -08:00
Wellinton Monge e2bd7db732 Merge AlertIOS with Alert (#23318)
Summary:
Itwas merged AlertIOS into Alert and removed type parameter from Alert.alert line 60 at Alert.js

[AlertIOS] [Change and Replace] - Merge AlertIOS into Alert.
Pull Request resolved: https://github.com/facebook/react-native/pull/23318

Reviewed By: mjesun

Differential Revision: D14031421

Pulled By: cpojer

fbshipit-source-id: 98db173adeb65aa90d309f8a583993bc0cddb6e1
2019-02-12 07:38:42 -08:00
Mike Nedosekin 4ac65f5413 Add deprecation warning for MaskedViewIOS (#23398)
Summary:
Add a deprecation warning for the [MaskedViewIOS](https://facebook.github.io/react-native/docs/maskedviewios) module as part of #23313.
[General] [Deprecated] - Deprecated [MaskedViewIOS](https://facebook.github.io/react-native/docs/maskedviewios) as it has now been moved to [react-native-community/masked-view](https://github.com/react-native-community/react-native-masked-view)
Pull Request resolved: https://github.com/facebook/react-native/pull/23398

Differential Revision: D14045290

Pulled By: cpojer

fbshipit-source-id: e97230f6861cf35ee0b49376d0a5c9c47d4e99f8
2019-02-12 07:14:02 -08:00
ferrannp 77300ca91c Add deprecation warning for ViewPagerAndroid (#23395)
Summary:
Add a deprecation warning for the [ViewPagerAndroid](https://facebook.github.io/react-native/docs/viewpagerandroid) module as part of #23313.

[General] [Deprecated] - Deprecated [ViewPagerAndroid](https://facebook.github.io/react-native/docs/viewpagerandroid) as it has now been moved to [react-native-community/viewpager](https://github.com/react-native-community/react-native-viewpager)
Pull Request resolved: https://github.com/facebook/react-native/pull/23395

Differential Revision: D14043025

Pulled By: cpojer

fbshipit-source-id: 2f7988fe69dbeff0f3add9babcb15d7eb974863e
2019-02-12 05:26:11 -08:00
Evan Bacon daa79b0f97 Add Platform module for web target (#23387)
Summary:
Added a Platform file for module for instances where internal modules need Platform.
ex: 78be6efda9/Libraries/Utilities/Dimensions.js (L14)

* Added `Libraries/Utilities/Platform.web.js`
[CATEGORY] [TYPE] - Message
Pull Request resolved: https://github.com/facebook/react-native/pull/23387

Differential Revision: D14041834

Pulled By: cpojer

fbshipit-source-id: 9be7ad647d6a644956efa622b936fcecee7c1a1f
2019-02-12 03:32:29 -08:00
Spencer Ahrens 864a30185d Add more init perf markers
Summary:
Adding some more systrace markers to track load application and the initial bits of MarketplaceHomeApp.

There are a couple big segments worth pointing out with timing from a local `__DEV__: false` run:

* JSBundleRequireTime_end -> BundlePreInitializeCore_start: 360ms
* MobileConfigModuleInit: 210ms
* renderApplication_React_render_start -> MarketplaceHomeAppConstructorSuper_start: 180ms
* MarketplaceHomeAppGetQueryParamsForCachedTopPicks: 100ms

I'm not sure what we can do about any of these except for MarketplaceHomeAppGetQueryParamsForCachedTopPicks where we could break the query params out into a separate file so we don't have to load this 11-thousand-line behemoth just so we can get this snippet:

diffusion/FBS/browse/master/xplat/js/RKJSModules/Apps/Wilde/Marketplace/apps/__generated__/MarketplaceHomeAppQuery.graphql.js$11831-11837

But maybe we have to load it anyway and the query just needs to be optimized (or maybe Relay can optimize the format here).

Reviewed By: yungsters

Differential Revision: D13969695

fbshipit-source-id: 4f39efa6cb591b814687bfe51b02ad92048f1c21
2019-02-11 16:50:40 -08:00
Héctor Ramos 2af13b4477 React sync for revisions aa94237...f24a0da
Summary:
This sync includes the following changes:
- **[f24a0da6e](https://github.com/facebook/react/commit/f24a0da6e )**: Fix useImperativeHandle to have no deps by default (#14801) //<Dan Abramov>//
- **[1fecba923](https://github.com/facebook/react/commit/1fecba923 )**: Fix crash unmounting an empty Portal (#14820) //<Dan Abramov>//
- **[c11015ff4](https://github.com/facebook/react/commit/c11015ff4 )**: fix spelling mistakes (#14805) //<zhuoli99>//
- **[3e295edd5](https://github.com/facebook/react/commit/3e295edd5 )**: Typo fix in comment (#14787) //<Deniz Susman>//
- **[1d48b4a68](https://github.com/facebook/react/commit/1d48b4a68 )**: Fix hydration with createRoot warning (#14808) //<Sebastian Markbåge>//

Release Notes:
[GENERAL] [Changed] - React sync for revisions aa94237...f24a0da

Reviewed By: cpojer

Differential Revision: D14030552

fbshipit-source-id: f8df9d8e532b2afef59dbbc10715bd52fd22b355
2019-02-11 15:26:44 -08:00
zhongwuzw 9ff43abe65 Prevent crash when scrollEnabled used in singleline textinput (#23361)
Summary:
Fixes #22949 , #21339. Currently, multiline textInput uses `UITextView` but singleline textInput uses `UITextField`, so singleline textinput may crash when use `scrollEnabled` property.

[iOS] [Fixed] - Prevent crash when scrollEnabled used in singleline textinput
Pull Request resolved: https://github.com/facebook/react-native/pull/23361

Differential Revision: D14030586

Pulled By: cpojer

fbshipit-source-id: a8ae1b4e168469e65745c4d5e9329df8b6faa2aa
2019-02-11 14:52:59 -08:00
Matt Oakes d9c0dfe353 Add a deprecation warning when importing NetInfo (#23383)
Summary:
Add a deprecation warning for the `NetInfo` module as part of #23313.

[General] [Deprecated] - Deprecated NetInfo as it has now been moved to react-native-community/netinfo
Pull Request resolved: https://github.com/facebook/react-native/pull/23383

Differential Revision: D14024702

Pulled By: cpojer

fbshipit-source-id: 353a9fb86feba2ca7f948c618c642e40fcdbfada
2019-02-11 13:45:47 -08:00
michalchudziak bf888a7582 Add deprecation warning while importing Slider component (#23385)
Summary:
Introducing the deprecation warning for those who are importing `Slider` component (https://github.com/facebook/react-native/issues/23313)

[General] [Deprecated] - Deprecated Slider as it has now been moved to `react-native-community/slider`
Pull Request resolved: https://github.com/facebook/react-native/pull/23385

Differential Revision: D14029819

Pulled By: cpojer

fbshipit-source-id: 7ad257124756c6bee57c3fbb1a056c09e8cc29a1
2019-02-11 13:40:52 -08:00
Krzysztof Borowy ffe37487b2 Deprecation warning for AsyncStorage (#23384)
Summary:
Added a deprecation warning for the `Async Storage`,  module as part of #23313.

[General] [Deprecated] - Async Storage [was moved to community repo](https://github.com/react-native-community/react-native-async-storage)
Pull Request resolved: https://github.com/facebook/react-native/pull/23384

Differential Revision: D14025255

Pulled By: cpojer

fbshipit-source-id: 5cabd76c650126ed77dfb8b714e05980c4d0b6da
2019-02-11 13:35:01 -08:00
gengjiawen 392e89676f add prettier check in ci (#23382)
Summary:
enforce code format
Pull Request resolved: https://github.com/facebook/react-native/pull/23382

Differential Revision: D14024609

Pulled By: cpojer

fbshipit-source-id: 21176cf8f009987e5a281bbead414374632eabee
2019-02-11 09:06:43 -08:00
Evan Bacon 62599fa8ff Add deprecation notice to ImageStore (#23330)
Summary:
- Related: #23313
- ImageStore is **iOS only**. AFAIK there is no reason this functionality isn't available on Android.
- base64 is very inefficient with the React Native bridge
- Ideally the `FileSystem` solutions will integrate Turbo Modules to circumvent bridge issues by passing direct references to files.

* [General][added] - A deprecation notice with info about third-party solutions for getting a base64-encoded string.
* [General][fixed] - Missing warnings for unimplemented platform methods.
Pull Request resolved: https://github.com/facebook/react-native/pull/23330

Differential Revision: D14022159

Pulled By: cpojer

fbshipit-source-id: 2a026ebf47cb315e9a0cfe6e3697a1799c5cbe2c
2019-02-11 01:24:03 -08:00
Christoph Nakazawa ccefc700d0 React sync for revisions 6bf5e85...aa94237 (#23320)
Summary:
allow-large-files

This sync includes the following changes:
- **[45fc46bfa](https://github.com/facebook/react/commit/45fc46bfa )**: 16.8.1 packages //<Brian Vaughn>//
- **[f2e2637c8](https://github.com/facebook/react/commit/f2e2637c8 )**: Backwards compat fix for ReactCurrentDispatcher on older react versions (#14770) //<Brian Vaughn>//
- **[1107b9673](https://github.com/facebook/react/commit/1107b9673 )**: [TestUtils.act] warn when using TestUtils.act in node (#14768) //<Sunil Pai>//
- **[0975ea327](https://github.com/facebook/react/commit/0975ea327 )**: eslint-plugin-react-hooks v1.0.0 //<Brian Vaughn>//
- **[bc9818f24](https://github.com/facebook/react/commit/bc9818f24 )**: Scheduler.unstable_next (#14756) //<Andrew Clark>//
- **[ce6ecd3fb](https://github.com/facebook/react/commit/ce6ecd3fb )**: Add 16.8.0 changelog and update some READMEs (#14692) //<Dan Abramov>//
- **[008a2ab9c](https://github.com/facebook/react/commit/008a2ab9c )**: 16.8.0 //<Brian Vaughn>//
- **[d1326f466](https://github.com/facebook/react/commit/d1326f466 )**: [TestUtils.act] fix return result checking  (#14758) //<Sunil Pai>//
- **[267ed9814](https://github.com/facebook/react/commit/267ed9814 )**: expose `TestUtils.act()` for batching actions in tests (#14744) //<Sunil Pai>//
- **[fb3f7bfde](https://github.com/facebook/react/commit/fb3f7bfde )**: Avoid importing Scheduler directly (#14757) //<Andrew Clark>//
- **[e602b5291](https://github.com/facebook/react/commit/e602b5291 )**: Use SameValue instead of === to check for dispatchAction equivalence (#14752) //<Jessica Franco>//
- **[e489c3f9c](https://github.com/facebook/react/commit/e489c3f9c )**: Update the version with Hooks proposal in README (#14751) //<SToneX>//
- **[c21c41ecf](https://github.com/facebook/react/commit/c21c41ecf )**: Tweak invalid Hook warning and error (#14747) //<Dan Abramov>//
- **[fec00a869](https://github.com/facebook/react/commit/fec00a869 )**: Typo in comment (#14739) //<Deniz Susman>//
- **[66eb29374](https://github.com/facebook/react/commit/66eb29374 )**: Restrict effect return type to a function or nothing (#14119) //<Andrew Clark>//
- **[51c07912a](https://github.com/facebook/react/commit/51c07912a )**: Warn when second argument is passed to useCallback (#14729) //<Dan Abramov>//
- **[70d407583](https://github.com/facebook/react/commit/70d407583 )**: Move Hook mismatch warning to first mismatch site (#14720) //<Andrew Clark>//
- **[ba6477aa3](https://github.com/facebook/react/commit/ba6477aa3 )**: Improve Reducer Hook's lazy init API (#14723) //<Andrew Clark>//
- **[cb1ff430e](https://github.com/facebook/react/commit/cb1ff430e )**: Phased dispatcher (#14701) //<Andrew Clark>//
- **[9d483dcfd](https://github.com/facebook/react/commit/9d483dcfd )**: Spelling abitrarily -> arbitrarily (#14710) //<Peter Donald>//
- **[e19c9e106](https://github.com/facebook/react/commit/e19c9e106 )**: Fix issue with multiple code branches in hooks linter (#14661) //<Yurick>//
- **[f11a9c1cb](https://github.com/facebook/react/commit/f11a9c1cb )**: State update bug in concurrent mode (#14698) //<Brian Vaughn>//
- **[e679a4b6e](https://github.com/facebook/react/commit/e679a4b6e )**: Fix typo in code comment (#14696) //<Greg Hurrell>//
- **[8bcc88f2e](https://github.com/facebook/react/commit/8bcc88f2e )**: Make all readContext() and Hook-in-a-Hook checks DEV-only (#14677) //<Dan Abramov>//
- **[6cb26774e](https://github.com/facebook/react/commit/6cb26774e )**: Enable hooks! (#14679) //<Brian Vaughn>//
- **[73962c366](https://github.com/facebook/react/commit/73962c366 )**: Revert "Revert "Double-render function components with Hooks in DEV in StrictMode" (#14652)" (#14654) //<Dan Abramov>//
- **[994439228](https://github.com/facebook/react/commit/994439228 )**: Put DEV-only code into DEV blocks (#14673) //<Dan Abramov>//
- **[f0befae65](https://github.com/facebook/react/commit/f0befae65 )**: Tweak context invariant message (#14671) //<Dan Abramov>//
- **[a129259ad](https://github.com/facebook/react/commit/a129259ad )**: Disallow reading context during useMemo etc (#14653) //<Dan Abramov>//
- **[c068d31cc](https://github.com/facebook/react/commit/c068d31cc )**: Add unit tests for concurrent mode event dispatching (#14415) //<Sebastian Markbåge>//
- **[38247cba3](https://github.com/facebook/react/commit/38247cba3 )**: --save is no longer needed (#14302) //<SamCortopassi>//
- **[3f0bcaf0d](https://github.com/facebook/react/commit/3f0bcaf0d )**: Importing React for the first example. (#14346) //<Ramón Chancay Ortega>//
- **[ecd919a2f](https://github.com/facebook/react/commit/ecd919a2f )**: RFC: warn when returning different hooks on subsequent renders (#14585) //<Sunil Pai>//
- **[3fbebb2a0](https://github.com/facebook/react/commit/3fbebb2a0 )**: Revert "Double-render function components with Hooks in DEV in StrictMode" (#14652) //<Dan Abramov>//
- **[5fce6488c](https://github.com/facebook/react/commit/5fce6488c )**: Revert "Disallow reading context during useMemo etc" (#14651) //<Dan Abramov>//
- **[fe2ecd276](https://github.com/facebook/react/commit/fe2ecd276 )**: Add test coverage for readContext() on the server (#14649) //<Dan Abramov>//
- **[8f45a7fdc](https://github.com/facebook/react/commit/8f45a7fdc )**: Warn about incorrect use of useImperativeHandle() (#14647) //<Dan Abramov>//
- **[1fcbd2243](https://github.com/facebook/react/commit/1fcbd2243 )**: Disallow reading context during useMemo etc (#14648) //<Dan Abramov>//
- **[2a084f51a](https://github.com/facebook/react/commit/2a084f51a )**: Warn about refs on lazy function components (#14645) //<Dan Abramov>//
- **[b5a3df6e8](https://github.com/facebook/react/commit/b5a3df6e8 )**: Fix typo (#14560) //<Linchengyi>//
- **[9c146e675](https://github.com/facebook/react/commit/9c146e675 )**: fix typo (#14316) //<liunian>//
- **[baa6d40fc](https://github.com/facebook/react/commit/baa6d40fc )**: Mention forwardRef() in <Fn ref={...} /> errors and warnings (#14644) //<Dan Abramov>//
- **[a1414e894](https://github.com/facebook/react/commit/a1414e894 )**: Double-render function components with Hooks in DEV in StrictMode (#14643) //<Dan Abramov>//
- **[10a7a5b5c](https://github.com/facebook/react/commit/10a7a5b5c )**: Fix synchronous thenable rejection (#14633) //<Dan Abramov>//
- **[a2fa6eb98](https://github.com/facebook/react/commit/a2fa6eb98 )**: Move lazy._result assignment (#14632) //<Dan Abramov>//
- **[9120f6c2d](https://github.com/facebook/react/commit/9120f6c2d )**: Support sync thenables for lazy() (#14626) //<Dan Abramov>//
- **[b66e6e41e](https://github.com/facebook/react/commit/b66e6e41e )**: Add directory details to the package.json of all packages (#14628) //<Grey Baker>//
- **[177fb7635](https://github.com/facebook/react/commit/177fb7635 )**: Warn when second callback is passed to setState/dispatch in Hooks (#14625) //<Dan Abramov>//
- **[d17d0b99c](https://github.com/facebook/react/commit/d17d0b99c )**: Use public context.report interface in eslint rules (#14623) //<Sebastian Silbermann>//
- **[4f332885a](https://github.com/facebook/react/commit/4f332885a )**: Fix shallow renderer set instance state after gDSFP before calling sCU (#14613) //<Yi-Shan, Chen>//
- **[e1cd83e49](https://github.com/facebook/react/commit/e1cd83e49 )**: Throw an error when using hooks inside useMemo/useState/useReducer, or .memo's comparator (#14608) //<Sunil Pai>//
- **[be457ca68](https://github.com/facebook/react/commit/be457ca68 )**: Small tweaks to SSR to match #14594 (#14618) //<Dan Abramov>//
- **[17d70df91](https://github.com/facebook/react/commit/17d70df91 )**: Warn when mixing createRoot() and old APIs (#14615) //<Dan Abramov>//
- **[4feab7fc9](https://github.com/facebook/react/commit/4feab7fc9 )**: Add hooks support to ReactShallowRenderer (#14567) //<Dominic Gannaway>//
- **[1454a8be0](https://github.com/facebook/react/commit/1454a8be0 )**: Don't bother comparing constructor when deps are not provided (#14594) //<Andrew Clark>//
- **[71b64d521](https://github.com/facebook/react/commit/71b64d521 )**: Warn if number of hooks increases (#14591) //<Andrew Clark>//
- **[790c8ef04](https://github.com/facebook/react/commit/790c8ef04 )**: Allow useReducer to bail out of rendering by returning previous state (#14569) //<Andrew Clark>//
- **[7ab8a8e97](https://github.com/facebook/react/commit/7ab8a8e97 )**: Added Flow type to keep hooks dispatchers in-sync (#14599) //<Brian Vaughn>//
- **[4392e3821](https://github.com/facebook/react/commit/4392e3821 )**: useDebugValue should throw if used in a class component (#14601) //<Brian Vaughn>//
- **[153a0b598](https://github.com/facebook/react/commit/153a0b598 )**: Add noop useDebugValue hook to partial/server renderer (#14597) //<Brian Vaughn>//
- **[7ad9806d1](https://github.com/facebook/react/commit/7ad9806d1 )**: Tweak to avoid property read (#14593) //<Brandon Dail>//
- **[0fc154751](https://github.com/facebook/react/commit/0fc154751 )**: Avoid new Set([iterable]) for thenables (#14592) //<Brandon Dail>//
- **[edb1f5956](https://github.com/facebook/react/commit/edb1f5956 )**: Support configurable labels for custom hooks (#14559) //<Brian Vaughn>//
- **[3e15b1c69](https://github.com/facebook/react/commit/3e15b1c69 )**: make a fork for ReactCurrentDispatcher (#14588) //<Sunil Pai>//
- **[0005d1e3f](https://github.com/facebook/react/commit/0005d1e3f )**: Fix typo (#14576) //<Carl Mungazi>//
- **[f290138d3](https://github.com/facebook/react/commit/f290138d3 )**: react-debug-tools accepts currentDispatcher ref as param (#14556) //<Brian Vaughn>//
- **[b4ad8e947](https://github.com/facebook/react/commit/b4ad8e947 )**: rename useImperativeMethods -> useImperativeHandle (#14565) //<Sunil Pai>//
- **[ab03e3d65](https://github.com/facebook/react/commit/ab03e3d65 )**: Inject ReactCurrentDispatcher ref to DevTools (#14550) //<Brian Vaughn>//
- **[19ef0ec11](https://github.com/facebook/react/commit/19ef0ec11 )**: Separate current owner and dispatcher (#14548) //<Brian Vaughn>//
- **[a9b035b0c](https://github.com/facebook/react/commit/a9b035b0c )**: Separate Object.is polyfill (#14334) //<Maksim Markelov>//
- **[547e059f0](https://github.com/facebook/react/commit/547e059f0 )**: Simplify wording of key warning (#14503) //<Sophie Alpert>//
- **[3494ee57e](https://github.com/facebook/react/commit/3494ee57e )**: Update ReactUpdateQueue.js (#14521) //<Carl Mungazi>//
- **[659c13963](https://github.com/facebook/react/commit/659c13963 )**: Update ReactFiberScheduler.js (#14477) //<Carl Mungazi>//
- **[c695b2384](https://github.com/facebook/react/commit/c695b2384 )**: React v16.7.0 //<Andrew Clark>//
- **[1c5aa2f23](https://github.com/facebook/react/commit/1c5aa2f23 )**: Move SchedulerFeatureFlags fork to src directory to fix lint //<Andrew Clark>//
- **[653bc582f](https://github.com/facebook/react/commit/653bc582f )**: Create separate SchedulerFeatureFlags instead of using ReactFeatureFlags (#14455) //<Andrew Clark>//
- **[8bfef0da5](https://github.com/facebook/react/commit/8bfef0da5 )**: Make scheduler debugging feature flag static //<Andrew Clark>//
- **[4a1072194](https://github.com/facebook/react/commit/4a1072194 )**: Memoize promise listeners to prevent exponential growth (#14429) //<Andrew Clark>//
- **[535804f5c](https://github.com/facebook/react/commit/535804f5c )**: Removed Fabric-specific feature flag files and updated Rollup to use the (non-Fabric) React Native flag files. (#14437) //<Brian Vaughn>//
- **[2743fb7b2](https://github.com/facebook/react/commit/2743fb7b2 )**: Enable hooks by default for FB React Native renderer (#14435) //<Brian Vaughn>//
- **[7325ebe4d](https://github.com/facebook/react/commit/7325ebe4d )**: Inject overrideProps() fn to DevTools (#14427) //<Brian Vaughn>//
- **[a22880e5e](https://github.com/facebook/react/commit/a22880e5e )**: Add support for Suspense & lazy() to the react-is package (#14423) //<Pleun Vanderbauwhede>//
- **[947bddd5c](https://github.com/facebook/react/commit/947bddd5c )**: Remove redundant argument of getPlugins function (#14419) //<Heaven>//
- **[8df4d59be](https://github.com/facebook/react/commit/8df4d59be )**: Implement pauseExecution, continueExecution, dumpQueue for Scheduler (#14053) //<Kevin Chavez>//
- **[5bb4ad737](https://github.com/facebook/react/commit/5bb4ad737 )**: Added ErrorBoundary tests for useEffect and useLayoutEffect (#14401) //<Brian Vaughn>//
- **[98eb5ae53](https://github.com/facebook/react/commit/98eb5ae53 )**: TestRenderer toJSON should not expose the Array wrapper Suspense uses for hidden trees (#14392) //<Brian Vaughn>//
- **[39489e767](https://github.com/facebook/react/commit/39489e767 )**: Enable hooks in fabric (#14301) //<Spencer Ahrens>//
- **[1dc108e58](https://github.com/facebook/react/commit/1dc108e58 )**: Tweaked wording for v8 "performance cliff" issue //<Brian Vaughn>//

Release Notes:
[GENERAL] [Changed] - React sync for revisions 6bf5e85...aa94237 (React 16.8.1)

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

Reviewed By: rickhanlonii

Differential Revision: D13976467

fbshipit-source-id: 4ce198e86a54658e1c35aa36bffe4a7dc2956a2e
2019-02-08 07:08:10 -08:00
Christoph Nakazawa 5ed749e1b2 Move codegen into packages/react-native-codegen
Summary: This is the first step in organizing React Native slightly differently. This doesn't set up a "monorepo" structure for the GitHub repo yet, it merely moves a few files around and I slightly updated the package.json file for the codegen project.

Reviewed By: rickhanlonii, TheSavior

Differential Revision: D13974180

fbshipit-source-id: f53375f3b6618ef12658064cb1fc690ef1f95299
2019-02-07 03:09:05 -08:00
dchersey f307ac7c5e Fixes capitalized I's when emojiis are present after the text being edited. (#21951)
Summary:
Fixes #21243.
Fixes #20908.

Credit goes to superandrew213 who provided the patch based on 0.56; this commit merges and resolved the conflict introduced in 0.57.
Pull Request resolved: https://github.com/facebook/react-native/pull/21951

Differential Revision: D13980799

Pulled By: cpojer

fbshipit-source-id: 6b9f1a1ae54ad9dba043005d683d6a221472c729
2019-02-07 02:15:58 -08:00
Peter Argany 8a5614b283 Add jest test to ensure consistency between AnimatedMock and AnimatedImplementation
Summary: Flow doesn't guarantee that AnimatedMock and AnimatedImplementation won't diverge. Christoph suggested a quick jest test in D13811035

Reviewed By: cpojer

Differential Revision: D13953915

fbshipit-source-id: ba5aeafded429113cc60a6250b5b29d2f8c8ab28
2019-02-06 11:02:33 -08:00
zhongwuzw fb8ba3fe95 Enhance image freshness check before stored into cache (#23226)
Summary:
This is a re-submit of D13895627 which got landed but didn't include a fix to Instagram's code. The sheriffs were unsure how it got landed without running the build.

Currently, before we store the image to cache, we only respect `Cache-Control`, actually, we also may need to check `Expires`、`Last-Modified`, refer to [MDN docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching#Freshness), and  [okhttp](568a91c44a/okhttp/src/main/java/okhttp3/internal/cache/CacheStrategy.java (L268)) respect the `MDN`, so in iOS, we can also respect this.

[iOS] [Fixed] - Respect `MDN` cache strategy before cache the image.

Reviewed By: shergin

Differential Revision: D13896822

Pulled By: cpojer

fbshipit-source-id: 8c1714f4a17ad40496146806cff3e188a60be93c
2019-02-06 02:07:17 -08:00
Peter Argany 7f646a5b68 Remove AnimatedImplementation spread from AnimatedMock
Summary:
Follow up to address Spencer's feedback on D13811035

With the spread of AnimatedImplementation, it's impossible to tell whether AnimatedMock gets out of date.

This change coupled with D13953915 forces anyone adding to AnimatedImplementation to consider the mock.

Reviewed By: sahrens

Differential Revision: D13965249

fbshipit-source-id: e324364a75abd42d89d6222151453021618bcd5d
2019-02-05 15:41:57 -08:00
Spencer Ahrens 10c8352141 Fix flow typing of Text
Summary:
Make Text prop types exact to catch tons of errors, including typos like in https://fb.workplace.com/groups/rn.support/permalink/2306953619353240/.

I tried to fix things when it was totally obvious what the intent was, but otherwise tried to keep the existing behavior the same, even if it meant that usage of some props was getting ignored, like `hitSlop`.

Reviewed By: TheSavior

Differential Revision: D13892999

fbshipit-source-id: 5003508a648287e4eca8055fb59da5f03bd066cc
2019-02-05 15:26:53 -08:00
empyrical 9a7fff9eb1 Introduce generic `warnOnce` function for warning messages (#22109)
Summary:
This pull request adds a function called `warnOnce` that prints a warning message to the console once per session.

It uses a unique key per callsite to help ensure that the message is not printed multiple times.

[General] [Added] - Added new `warnOnce` function for printing a message to the developer console once per session
[General] [Changed] - Changed the warnings in `react-native-implementation` to use `warnOnce`
Pull Request resolved: https://github.com/facebook/react-native/pull/22109

Differential Revision: D13955887

Pulled By: cpojer

fbshipit-source-id: aa51ac427a80cc0554a6bcc915715821d0bd5439
2019-02-05 02:24:59 -08:00
Peter Argany 45686c86e2 Mock Animated for testing
Summary:
Animated views can cause flakiness in snapshot tests. This mock replaces all provided Animated transforms with a blank animation.

This could potentially break some tests which animate in elements and then verify their existence. I can deal with that fallout in follow up diffs. One option is making all animations take 0 seconds when testing.

Reviewed By: cpojer

Differential Revision: D13811035

fbshipit-source-id: cc6b13c7d6bad29b125d35ef759a269bb0372e67
2019-02-04 18:33:52 -08:00
Ramanpreet Nara f37093319b Start using getConstants
Summary:
TurboModules depend on a getConstants method. Existing ObjectiveC modules do not have this method. Therefore, I moved the contents of `constantsToExport` to `getConstants` and then had `constantsToExports` call `getConstants`.

facebook
Since all NativeModules will eventually need to be migrated to the TurboModule system, I didn't restrict this to just the NativeModules in Marketplace.

```
const fs = require('fs');

if (process.argv.length < 3) {
    throw new Error('Expected a file containing a list of native modules as the third param');
}

function read(filename) {
    return fs.readFileSync(filename, 'utf8');
}

const nativeModuleFilenames = read(process.argv[2]).split('\n').filter(Boolean);

nativeModuleFilenames.forEach((fileName) => {
    if (fileName.endsWith('.h')) {
        return;
    }

    const absPath = `${process.env.HOME}/${fileName}`;
    const fileSource = read(absPath);

    if (/(\n|^)-\s*\((.+)\)getConstants/.test(fileSource)) {
        return;
    }

    const constantsToExportRegex = /(\n|^)-\s*\((.+)\)constantsToExport/;
    const result = constantsToExportRegex.exec(fileSource);

    if (result == null) {
        throw new Error(`Didn't find a constantsToExport function inside NativeModule ${fileName}`);
    }

    const returnType = result[2];

    const newFileSource = fileSource.replace(
        constantsToExportRegex,
        '$1- ($2)constantsToExport\n' +
        '{\n' +
        `  return ${returnType.includes('ModuleConstants') ? '($2)' : ''}[self getConstants];\n` +
        '}\n' +
        '\n' +
        '- ($2)getConstants'
    );

    fs.writeFileSync(absPath, newFileSource);
});
```

```
> xbgs -l ')constantsToExport'
```

Reviewed By: fkgozali

Differential Revision: D13951197

fbshipit-source-id: 394a319d42aff466c56a3d748e17c335307a8f47
2019-02-04 17:46:56 -08:00
Igor Mandrigin 05ebf77175 Apply the fix for CJK languages on single-line text fields. (#22546)
Summary:
Follow-up to https://github.com/facebook/react-native/pull/19809

This fix generalizes the `setAttributedString:` fix to single-line text fields.

Fixes #19339

_Pull requests that expand test coverage are more likely to get reviewed. Add a test case whenever possible!_
Pull Request resolved: https://github.com/facebook/react-native/pull/22546

Differential Revision: D13948951

Pulled By: shergin

fbshipit-source-id: 67992c02b32f33f6d61fac4554e4f46b973262c1
2019-02-04 15:09:46 -08:00
Ramanpreet Nara e1451caddd Only call __turboModuleProxy when it exists
Summary: `__turboModuleProxy` doesn't exist if you're not in the TurboModules QE. If such is the case, then we should just return null when `TurboModuleRegistry.get` is called.

Reviewed By: fkgozali

Differential Revision: D13937143

fbshipit-source-id: d3f11c52b7cbecaefba675d714f0d67236071389
2019-02-04 11:08:10 -08:00
Danilo Bürger e4fd9babe0 Fix regression of VirtualizedList jumpy header (#22025)
Summary:
Fixes #20956, #21361, #21198, #21468
Keeps the intended outcome of #18105
Pull Request resolved: https://github.com/facebook/react-native/pull/22025

Differential Revision: D13941915

Pulled By: cpojer

fbshipit-source-id: 59a0a834ea2d0dd4678e80a82ddaf95cecf87d38
2019-02-04 08:20:15 -08:00
nossbigg 7ee13cc84c Refine Keyboard API Event typings (#23272)
Summary:
- Improve type inference of the `event.easing` keyboard event property with the `KeyboardEventEasing` type.
- Exporting `KeyboardEventName` and `KeyboardEventEasing` for others to use.
- Removing unnecessary optional property flag (ie.`?`) for all properties in `KeyboardEvent`. (I personally haven't seen any of the properties not being returned for all keyboard events).

[iOS] [Changed] - Refine Keyboard API Event typings
Pull Request resolved: https://github.com/facebook/react-native/pull/23272

Differential Revision: D13941758

Pulled By: cpojer

fbshipit-source-id: 4891898c29cf6963069dbe6b4d439694761fd9e7
2019-02-04 07:45:42 -08:00
Sam Linnett 4989123f8c Fix for Image displayName, currently displaying as <Component> in tests (#23287)
Summary:
As per https://github.com/facebook/react-native/issues/21937, Image `displayName` is not set. This means it comes through as `<Component>` in tests.

[General][fixed] - fix `displayName` for `Image`
Pull Request resolved: https://github.com/facebook/react-native/pull/23287

Differential Revision: D13941744

Pulled By: cpojer

fbshipit-source-id: eab161eee415ec4f7207efcd5c6e2a4bbe67dfe1
2019-02-04 07:39:24 -08:00
Kevin Gozali 1bbb69355c TM: trimming down module dependencies when getting NativeModules
Summary: For now, do `require('NativeModules')` instead of `import {NativeModules} from 'react-native'`.

Reviewed By: mdvacca

Differential Revision: D13934066

fbshipit-source-id: 5188b11428a4dca8cecd1934e593d89a6e3fde2e
2019-02-01 17:43:09 -08:00
nossbigg 05f35c296d Expose isLocalUserInfoKey to keyboard event notifications (#23245)
Summary:
Given two apps loaded side-by-side and when a `Keyboard` event is triggered, there is no way to ascertain which app triggered the keyboard event. This ambiguity can arise in slide over/split view scenarios.

This pull request exposes the `isLocalUserInfoKey` property of the native `UIKeyboard` iOS events to the `Keyboard` event listener; this property will return `true` for the app that triggered the keyboard event.

(Also, I threw in a couple of Keyboard.js tests just for fun 😅)

[iOS][Added] - Expose isLocalUserInfoKey to keyboard event notifications

1. Load two apps side-by-side, with the app on the left side subscribing to the keyboard events (and logging out the events as they happen)
1. Trigger a keyboard to appear with the left app. The logged keyboard event will contain the `isEventFromThisApp` property which will be true.
1. Dismiss the keyboard
1. Trigger a keyboard to appear with the right app. The left app will still log the keyboard event, but the event's `isEventFromThisApp` property will be false (because the left app didn't trigger the keyboard event)
Pull Request resolved: https://github.com/facebook/react-native/pull/23245

Differential Revision: D13928612

Pulled By: hramos

fbshipit-source-id: 6d74d2565e2af62328485fd9da86f15f9e2ccfab
2019-02-01 14:32:19 -08:00
Paco Estevez Garcia 5ee738659b Update xplat/js to 0.92.0
Summary: This diff updates `xplat/js` to Flow 0.92.0

Reviewed By: panagosg7

Differential Revision: D13917049

fbshipit-source-id: 69613182badecd4c23aef25b79f7380d5604a13b
2019-02-01 09:35:42 -08:00
Kevin Gozali 1e6f5344d6 avoid double lookup of a nativemodule when resolving turbomodule
Summary: A simple optimization to not access `NativeModules` property twice.

Reviewed By: RSNara

Differential Revision: D13908128

fbshipit-source-id: d41cd5f855fb0176170d6bdc3ac93df5593eeca5
2019-01-31 16:58:58 -08:00
Richard Zito c435ff382e Revert D13895627: [react-native][PR] [iOS] Enhance image freshness check before stored into cache
Differential Revision:
D13895627

Original commit changeset: aa377511c31b

fbshipit-source-id: 7785644d48d750fb75b2d7652a4b68da27c5fc3f
2019-01-31 04:52:51 -08:00
zhongwuzw e98d5a289a Enhance image freshness check before stored into cache (#23226)
Summary:
Currently, before we store the image to cache, we only respect `Cache-Control`, actually, we also may need to check `Expires`、`Last-Modified`, refer to [MDN docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching#Freshness), and  [okhttp](568a91c44a/okhttp/src/main/java/okhttp3/internal/cache/CacheStrategy.java (L268)) respect the `MDN`, so in iOS, we can also respect this.

[iOS] [Fixed] - Respect `MDN` cache strategy before cache the image.

After `PR`, if image's response do not contains `Cache-Control`, it would also checks `Expires`、`Last-Modified` refers to  [MDN docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching#Freshness).
Pull Request resolved: https://github.com/facebook/react-native/pull/23226

Differential Revision: D13895627

Pulled By: cpojer

fbshipit-source-id: aa377511c31badd752d7887ed6cbcdf6be4b80b3
2019-01-31 03:57:49 -08:00
scisci e405e84fc3 Fix Native Rotation Android (#18872)
Summary:
Fixes #14161
Android crashes in some cases if an animated transform config contains a string value, like a rotation.
This PR fixes that by ensuring all values sent to the native side are doubles. It adds `__transformDataType` to AnimatedTransform.js.

Added integration test `ReactAndroid/src/androidText/js/AnimatedTransformTestModule.js` This test fails with the following error `INSTRUMENTATION_RESULT: longMsg=java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Double`, if the changes to AnimatedTransform.js are reverted.

[Android] [Fixed] - Fixes Android crash on animated style with string rotation
Pull Request resolved: https://github.com/facebook/react-native/pull/18872

Differential Revision: D13894676

Pulled By: cpojer

fbshipit-source-id: 297e8132563460802e53f3ac551c3ba9ed943736
2019-01-31 01:36:21 -08:00
Ram N 02697291ff Remove TabbarIOS from OSS
Reviewed By: fkgozali

Differential Revision: D13858496

fbshipit-source-id: ba9dd9912f4abcbeb3326f412ec91be9bee9cfd3
2019-01-30 23:41:40 -08:00
Oli Barnett bbcb97a29a Location Services: don't reset desiredAccuracy on every update/error (#23209)
Summary:
See https://github.com/facebook/react-native/issues/7680.

On iOS the RCTLocationObserver delegate is overriding `desiredAccuracy` every time CLLocationManager calls `didUpdateLocations` or `didFailWithError`.  `desiredAccuracy` is reset to
`RCT_DEFAULT_LOCATION_ACCURACY` (100 meters) This effectively makes it impossible for a react-native app to use any location accuracy other than the default.

This commit simply removes the code which resets the desired accuracy, as there seems to be no rationale for doing so. The reset code was added as part of [a large general
change](705a8e0144) so the original intention is unclear from the history. If somebody can explain it to me, I'm happy to rework this PR accordingly.

Changelog:
----------
[iOS] [Fixed] - Location Services accuracy constantly reset to default of 100 meters.
Pull Request resolved: https://github.com/facebook/react-native/pull/23209

Differential Revision: D13879497

Pulled By: cpojer

fbshipit-source-id: f3c6c9c5ef698b23b99c407fd764ac990d69bf8c
2019-01-30 10:23:58 -08:00
Kevin Gozali 4c69ccd0fb Revert D13860038: [react-native][PR] Add ability to control scroll animation duration for Android
Differential Revision:
D13860038

Original commit changeset: f06751d063a3

fbshipit-source-id: 5d89137aed0d549004e790068c1e4998ebccdaf1
2019-01-29 18:00:54 -08:00
Shaun Stanworth 745484c892 Remove height styling when keyboard closed (#16965)
Summary:
Closes #13754

Fixing previously reported bug #13754

Video here https://imgur.com/a/3IgqP

[GENERAL] [BUGFIX] [KeyboardAvoidingView] - Correct height behaviour when keyboard closed
Pull Request resolved: https://github.com/facebook/react-native/pull/16965

Differential Revision: D13860208

Pulled By: cpojer

fbshipit-source-id: 9ae7f81fd24999518a6ae85016d4f75dac3c4274
2019-01-29 07:31:47 -08:00
Michał Osadnik 7e8b810499 Add ability to control scroll animation duration for Android (#22884)
Summary:
Motivation:
----------
This is one of the more sought after feature requests for RN:
react-native.canny.io/feature-requests/p/add-speed-attribute-to-scrollto

This PR adds the support to add a "duration" whenever using "scrollTo" or "scrollToEnd" with
a scrollView. Currently this only exists for Android as the iOS implementation will be somewhat more involved.

This PR is also backwards compatible and does not yet deprecate the "animated" boolean. It may not make sense to ever deprecate "animated", as it could be the flag that is used when devs want the system default duration (which is 250ms for Android). I'm not sure what it is for iOS. It would simplify things to remove "animated", though.
Pull Request resolved: https://github.com/facebook/react-native/pull/22884

Differential Revision: D13860038

Pulled By: cpojer

fbshipit-source-id: f06751d063a33d7046241c95348b6abbb327d36f
2019-01-29 07:18:09 -08:00