Commit Graph

14262 Commits

Author SHA1 Message Date
David Aurelio 0926373c9f Eliminate remaining `YGStyle&` locals
Summary:
@public

Replaces local references to `YGStyle` objects, and assignment to `YGValue` members with direct assignment from temporaries.

This should increase readability, and eliminate duplicated checks for *undefined* values.

Reviewed By: astreet

Differential Revision: D9083531

fbshipit-source-id: 11386be465352f5cb167b8195b7da432d0055d6f
2018-08-15 06:17:15 -07:00
David Aurelio acd8820154 Eliminate unnecessary copies of node style objects
Summary:
@public

`YGNode.getStyle()` returns a reference to the enclosed `YGStyle` member. Assigning to a local copies unnecessarily.

Having eliminated the copy, we can also safely remove calls to `YGNode.setStyle()`, eliminating another copy.

Reviewed By: astreet

Differential Revision: D9083336

fbshipit-source-id: df8b603b5cc0b974cf5dd434c71956be4548e583
2018-08-15 06:17:15 -07:00
Kevin Gozali f945212447 iOS downgrade error to warning when invoking native module with invalid bridge
Summary: A bunch of flows including JS reload and e2e tests seem to hit the race condition, causing redbox. For now, make it a warning to unblock.

Differential Revision: D9327418

fbshipit-source-id: a72b378d88f7566268fd9415fbd34225c8b931e7
2018-08-14 18:19:01 -07:00
Eli White 76948ad1bd Typing View style as ViewStyleProp
Summary: Locking down view style so that invalid styles can't be passed into View.

Reviewed By: yungsters

Differential Revision: D9309097

fbshipit-source-id: 69e7e3c5626609cfd47c167027a55470c42228c8
2018-08-14 16:32:11 -07:00
Stephen Cook 22cf5dc566 Android textTransform style support (#20572)
Summary:
Issue https://github.com/facebook/react-native/issues/2088 (closed, but a bit pre-emptively imo, since Android support was skipped)

Related (merged) iOS PR https://github.com/facebook/react-native/pull/18387

Related documentation PR https://github.com/facebook/react-native-website/pull/500

The basic desire is to have a declarative mechanism to transform text content to uppercase or lowercase or titlecase ("capitalized").
Pull Request resolved: https://github.com/facebook/react-native/pull/20572

Differential Revision: D9311716

Pulled By: hramos

fbshipit-source-id: dfbb855117196958e7ae5e980700d31be07a448d
2018-08-13 21:31:57 -07:00
Héctor Ramos 1081560d86 Add missing trailing comma
Summary: Adds missing comma, following up on https://github.com/facebook/react-native/pull/20178. Thanks to LinusU for pointing out the error.

Reviewed By: TheSavior

Differential Revision: D9242887

fbshipit-source-id: 4b547396722d0e37dc5c8eb3439b9a441c3c0ac2
2018-08-13 12:01:57 -07:00
Tim Yung f805d35154 RN: Fix Touchable Debug View
Summary: Fixes the `Touchable` debug view. The `child.type` is no longer a subclass of `React.Component` and no longer has `displayName`. It should be fine to have a hard dependency on `Text` and `View`, because... what app does not use them?

Reviewed By: TheSavior

Differential Revision: D9232036

fbshipit-source-id: 06f4091bf8e21cada3af50def2fdd41a6ad84f79
2018-08-13 12:01:57 -07:00
Tim Yung c1ecd8aefc RN: Polyfill `String#padEnd` and `String#padStart`
Summary: Adds polyfills for `String.prototype.padEnd` and `String.prototype.padStart`.

Reviewed By: mjesun

Differential Revision: D9233437

fbshipit-source-id: 3430450f28b4cec8f1c74af5f169e9bdef044ae8
2018-08-13 12:01:57 -07:00
Mehdi Mulani 66089bf150 Correctly find rootView when RCTTouchHandler is in a RCTSurface
Summary:
@public
I'm surprised this hasn't caused an issue earlier.
RCTTouchHandler is hooked up to RCTSurfaceView which itself contains a rootView. Thus when this calculation happens, a root view is never found.
We can't assign to the root view since it created and destroyed frequently, so it makes the most sense to look for the RCTSurfaceView here and treat it as a root view.

Reviewed By: fkgozali

Differential Revision: D9296840

fbshipit-source-id: ba5320583201f9d5c0176847cc6e6087b6a6459b
2018-08-13 11:32:17 -07:00
Jordan Brown 97fd096671 Add test to sync RN github flow configs
Summary:
Adds three more tests:

* compare RN github ios and android flowconfigs
* compare xplat/js ios flowconfig with RN github ios flowconfig
* compare xplat/js android flowconfig with RN github android flowconfig

Reviewed By: TheSavior

Differential Revision: D9191176

fbshipit-source-id: 34f3644ffc5a26d3bdfd94b6c05a138407aaedeb
2018-08-13 11:32:17 -07:00
Jordan Brown f125815efc Add flow suppressions to xplat android
Summary:
.android.js files may be checked (when the next version of flow is released) by using `flow start --flowconfig-name .flowconfig.android` and `flow status --flowconfig-name .flowconfig.android`

This diff adds suppressions to the errors that are in .android.js files, which flow does not check right now.

When site is `react_native_fb` or `react_native_android_fb`, error will be suppressed when checking with .flowconfig.android
When site is `react_native_fb` or `react_native_ios_fb`, error will be suppressed when checking with .flowconfig.

You can use `react_native_fb` when it should be suppressed for both.

The controller you requested could not be found.

Reviewed By: TheSavior

Differential Revision: D9122178

fbshipit-source-id: 0ec9d3cae3d887f58645e6585b2a3f6c3889b13e
2018-08-13 11:16:41 -07:00
Linus Unnebäck 35bd17f1d6 Switch babel preset to metro-react-native-babel-preset (#20653)
Summary:
Fixes #20567
Pull Request resolved: https://github.com/facebook/react-native/pull/20653

Differential Revision: D9296819

Pulled By: hramos

fbshipit-source-id: 88953afb9778e3c8cde5576b068888fd882c2220
2018-08-13 10:32:11 -07:00
Krzysztof Magiera c5cbd0f64a Fix native animated style and transform node to call __makeNative once all the children are converted to native nodes (#20658)
Summary:
This PR fixes an issue I have found while playing with native animated driver nodes.

I discovered the bug when using animated views that have both animated props and styles. See this snack to see an example: https://snack.expo.io/B17SFXy8Q

In that example we set `opacity` and `style` props which both contain animated props. This is not an usual way to do that, as normally you would place `opacity` inside the `styles` in which case the bug won't surface. But this is only done for demo purposes and in practice the problem will occur if you have a custom native view that exposes props that are not styles and can be animated.

In the above example you get this error:

> Invariant Violation: Attempt to get native tag from node not marked as "native"

When `opacity` is moved into `styles` container the problem no longer occurs.

The problem turned out to be related to the initialization code responsible for creating native animated nodes. In all subclasses of `AnimatedWithChildren` (like `AimatedAddition`) we only call `super.__makeNative` after we call `__makeNative` method on the child nodes. This order was reversed in `AnimatedStyle` and `AnimatedTransform`. As a result when `super.__makeNative` is called in `AnimatedStyle`, we try to call `__getNativeTag` on children nodes not yet marked as native which results in the error described above ("Attempt to get native tag...").

We should instead follow the order of calling `super.__makeNative` that is used in the remaining subclasses of `AnimatedWithChildren`. Such that all the children nodes are first converted to native prior to calling superclass method. This is what this PR is changing.
Pull Request resolved: https://github.com/facebook/react-native/pull/20658

Differential Revision: D9297191

Pulled By: hramos

fbshipit-source-id: f5e394fb259ff514c7c1433edcb5fc89203f55e2
2018-08-13 10:18:18 -07:00
Ramanpreet Nara a5ce1ad767 Ensure WebViews render about:blank correctly
Summary:
@public

This diff fixes two bugs:
1. When you load a `<WebView/>` with an HTML source string, HTML source doesn't render in the `<WebView/>`. Instead, we get this warning: https://pxl.cl/grz3. Here's what the above page should look like when correctly rendered: https://pxl.cl/grzt

2. Furthermore, you render a blank `<WebView/>` (i.e: with no source prop), it should display a blank page. Instead, we get this warning: https://pxl.cl/grz3

**Bugfix:**
One solution I found was to ensure that `about:blank` is always whitelisted. That way, we don't ever abort navigations to blank pages, which occur when we do:

```ObjectiveC
/** Line 134 in RCTWebView.m */
[_webView loadHTMLString:@"" baseURL:nil];
```

and

```ObjectiveC
/** Line 115 in RCTWebView.m */
if (html) {
  NSURL *baseURL = [RCTConvert NSURL:source[@"baseUrl"]];
  if (!baseURL) {
    baseURL = [NSURL URLWithString:@"about:blank"];
  }
  [_webView loadHTMLString:html baseURL:baseURL];
  return;
}
```

Reviewed By: yungsters, mmmulani

Differential Revision: D9259852

fbshipit-source-id: e1b9673fcd8c3d0df77308df8c4a632a2b596bfb
2018-08-13 10:18:17 -07:00
Rafael Oleza 0f08635991 Fix passing the --reset-cache CLI argument to Metro
Summary:
@public

While debugging a RN 0.57 blocking issue, we found that the `--reset-cache` cli arg is not being passed to Metro (more info: https://github.com/facebook/react-native/issues/20567#issuecomment-412513942).

This diff fixes this issue

Reviewed By: mjesun

Differential Revision: D9295634

fbshipit-source-id: a53ec7abff2b7e684a1fd88c3b53ff0b54a1c3c4
2018-08-13 07:31:35 -07:00
Janic Duplessis 5892d5c3cf Enable metro hmr server in local-cli (#20605)
Summary:
The `hmrEnabled` flag was not passed to the metro runServer config which caused HMR to be broken.
Pull Request resolved: https://github.com/facebook/react-native/pull/20605

Differential Revision: D9272070

Pulled By: hramos

fbshipit-source-id: 3765031d9e7806be11781fba92663ce7c4ff2ffb
2018-08-10 14:32:30 -07:00
Héctor Ramos e0465bf8b9 Disable failing tests (#20622)
Summary:
`test_detox_end_to_end` and `test_objc_end_to_end` are both failing on master. This is polluting internal diffs that do not introduce failures.

As we just now started tracking Circle CI on our internal builds, I want to make sure we only nag internal diffs when the failure can actually be attributed to the diff. The failures in the e2e tests precede the Circle CI integration and are adding unnecessary noise.

Going forward, we will immediately go back to a diff and push the author to fix the broken CI, so this PR is a temporary fix.
Pull Request resolved: https://github.com/facebook/react-native/pull/20622

Differential Revision: D9272360

Pulled By: hramos

fbshipit-source-id: 2f8d22e35d301aa7eb67ed08f6deed21bf971acd
2018-08-10 14:02:10 -07:00
Freddy Harris 16b3783b9d Fix bug rows doesn't close on scroll in a SwipeableFlatList (#18001)
Summary:
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

Fix bug `SwipeableRow`s doesn't close on Scroll in a `SwipeableFlatList`

Use a SwipeableFlatList with multiple rows, open one of them, then scroll.
Open row should close on scroll.

[GENERAL] [BUGFIX] [SwipeableFlatList] - Fix rows doesn't close on scroll

<!--
Help reviewers and the release process by writing your own release notes

**INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.**

  CATEGORY
[----------]        TYPE
[ CLI      ]   [-------------]      LOCATION
[ DOCS     ]   [ BREAKING    ]   [-------------]
[ GENERAL  ]   [ BUGFIX      ]   [-{Component}-]
[ INTERNAL ]   [ ENHANCEMENT ]   [ {File}      ]
[ IOS      ]   [ FEATURE     ]   [ {Directory} ]   |-----------|
[ ANDROID  ]   [ MINOR       ]   [ {Framework} ] - | {Message} |
[----------]   [-------------]   [-------------]   |-----------|

[CATEGORY] [TYPE] [LOCATION] - MESSAGE

 EXAMPLES:

 [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things
 [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput
 [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with
 [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word
 [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position
 [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see
-->
Pull Request resolved: https://github.com/facebook/react-native/pull/18001

Reviewed By: TheSavior

Differential Revision: D9192387

Pulled By: tomasreimers

fbshipit-source-id: f43e9614f9def5f3112327163c2b15fb45d84fb2
2018-08-10 14:02:10 -07:00
Ives van Hoorne 0a72df910f Bump metro to 0.43.5
Summary: Makes it possible to use Metro in node environments

Reviewed By: mjesun

Differential Revision: D9267780

fbshipit-source-id: 2a534a32681f3a19659989cd24e77d4465ed2caa
2018-08-10 10:02:20 -07:00
Alex Dvornikov 1cd9aa2dea Add REGISTER_JS_SEGMENT perf markers
Reviewed By: cwdick

Differential Revision: D9244289

fbshipit-source-id: 9004a0405f9622cbd0bbb837b99df32454f35bb8
2018-08-10 09:37:42 -07:00
Linus Unnebäck 87f5463c0e Upgrade Babel to 7.0.0-beta.56 (#216)
Summary:
**Summary**

This pull request bumps Babel to 7.0.0-beta.56 to incorporate the latest bugfixes from Babel.

**Test plan**

One way to test is to add a simple TypeScript file with a type as the default export:

```typescript
export const test = 1
export default interface A {}
```

and then import that file from any other file:

```js
import { test } from './typescript-test'
```

Before this would throw an error, but with the latest Babel this is now fixed.
Pull Request resolved: https://github.com/facebook/metro/pull/216

Reviewed By: mjesun

Differential Revision: D9216331

Pulled By: rafeca

fbshipit-source-id: a48e87c3c6b2902be410395b1b4afab63cb88fec
2018-08-10 03:16:35 -07:00
Héctor Ramos b21575f52a Check Flow and run basic packager tests using open source RN config
Summary:
Most of the changes associated with this commit will not be visible on GitHub, as they concern files in the internal Facebook monorepo. The bulk of this change is the addition of a new test that runs on the internal test infrastructure. The actual script used by the test has various references to the internal test infra, but a copy is produced below with some changes that should allow it to run on open source should anyone be interested in testing this outside of Facebook.

The test has the main goal of catching common sources of FB-to-GitHub breakages, such as the OSS Flow config falling out of date (we use a different flow config than what is synced out in .flowconfig, and hence internally we rename this file to .github.flowconfig). It also checks that the packager can run on a brand new project, among other things.

```

set -e

THIS_DIR=$(pwd)

REACT_NATIVE_TEMP_DIR=$(mktemp -d /tmp/react-native-XXXXXXXX)
REACT_NATIVE_APP_TEMP_DIR=$(mktemp -d /tmp/react-native-XXXXXXXX)

OFFLINE_MIRROR=$(yarn config get yarn-offline-mirror)

function describe {
  printf "\\n\\n>>>>> %s\\n\\n\\n" "$1"
}

function cleanup {
  set +e
  rm -rf "$REACT_NATIVE_TEMP_DIR"
  rm -rf "$REACT_NATIVE_APP_TEMP_DIR"
  rm "$OFFLINE_MIRROR/react-native-v1000.0.0.tgz"
  set -e
}

trap cleanup EXIT

describe "Creating temporary react-native-github clone"
cp -R "react-native" "$REACT_NATIVE_TEMP_DIR"
pushd "$REACT_NATIVE_TEMP_DIR/react-native" >/dev/null

echo yarn-offline-mirror="$OFFLINE_MIRROR" > .npmrc

describe "Installing react-native node_modules from offline cache"
yarn install --mutex network --offline --frozen-lockfile --ignore-engines --ignore-scripts 2>&1

describe "Running a Flow check"
mv .github.flowconfig .flowconfig
./node_modules/.bin/flow check

describe "Running a basic packager test"
touch .watchmanconfig
node local-cli/cli.js bundle --platform android --dev true --entry-file ReactAndroid/src/androidTest/js/TestBundle.js --bundle-output ReactAndroid/src/androidTest/assets/AndroidTestBundle.js

describe "Creating package for e2e test"
yarn pack
REACT_NATIVE_PACKAGE="$(pwd)/react-native-v1000.0.0.tgz"
REACT_VERSION=$(node -p -e "require('./package.json').peerDependencies['react']")
REACT_NATIVE_HASH=$(shasum "$REACT_NATIVE_PACKAGE" | awk '{print $1;}')
REACT_NATIVE_DEPS=$(node -p -e "const deps=require('./package.json').dependencies; '    ' + Object.keys(deps).map(dep => dep + ' \"' + deps[dep] +'\"').join('\n    ')")

popd >/dev/null

describe "Installing temporary RN app"

mkdir "$REACT_NATIVE_APP_TEMP_DIR/PackagerTest"
pushd "$REACT_NATIVE_APP_TEMP_DIR/PackagerTest" >/dev/null

cp "$REACT_NATIVE_PACKAGE" ./
cp "$REACT_NATIVE_PACKAGE" "$OFFLINE_MIRROR"
cp "$REACT_NATIVE_TEMP_DIR/react-native/.npmrc" ./
cp "$REACT_NATIVE_TEMP_DIR/react-native/yarn.lock" ./

cat <<LOCKFILE >> yarn.lock
react-native@1000.0.0:
  version "1000.0.0"
  resolved react-native-v1000.0.0.tgz#$REACT_NATIVE_HASH
  dependencies:
$REACT_NATIVE_DEPS
LOCKFILE

cat > package.json <<- EndOfFile
{
  "name": "packager-test",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start"
  },
  "dependencies": {
    "react": "$REACT_VERSION",
    "react-native": "1000.0.0"
  }
}
EndOfFile

yarn install --mutex network --offline --frozen-lockfile --ignore-engines --ignore-scripts 2>&1
sed -e s/"HelloWorld"/PackagerTest/g "react-native/local-cli/templates/HelloWorld/app.json" > app.json
cp "react-native/local-cli/templates/HelloWorld/_buckconfig" .buckconfig
cp "react-native/local-cli/templates/HelloWorld/_flowconfig" .flowconfig
cp "react-native/local-cli/templates/HelloWorld/_watchmanconfig" .watchmanconfig
cp "react-native/local-cli/templates/HelloWorld/App.js" App.js
cp "react-native/local-cli/templates/HelloWorld/index.js" index.js

describe "Running a Flow check on a new RN app"
flow check

describe "Verifying packager can produce JS bundle for a new RN app on both platforms"
node ./node_modules/react-native/local-cli/cli.js bundle --platform ios --dev true --entry-file index.js --bundle-output ios-bundle.js
test -e ios-bundle.js
rm ios-bundle.js
node ./node_modules/react-native/local-cli/cli.js bundle --platform android --dev true --entry-file index.js --bundle-output android-bundle.js
test -e android-bundle.js
rm android-bundle.js

popd >/dev/null
```

Reviewed By: arcanis

Differential Revision: D9129463

fbshipit-source-id: a91eeaa150ae6623ee67bd758bc8a98bb31e57b8
2018-08-09 16:17:40 -07:00
Dexter eb1ce2816c Fix memory usage display in Perf Monitor (#19664)
Summary:
According to: https://github.com/apple/darwin-xnu/blob/master/osfmk/kern/bsd_kern.c#L420
The result is the same as Xcode app memory uesd.

Before Fix:

<img width="250" alt="before" src="https://user-images.githubusercontent.com/22233256/41394508-ce810362-6fdc-11e8-8d40-73703ec93bc3.png">
<img width="266" alt="before1" src="https://user-images.githubusercontent.com/22233256/41394511-d00a9a0e-6fdc-11e8-9f18-2198e8de2410.png">

After Fix:
<img width="270" alt="after" src="https://user-images.githubusercontent.com/22233256/41394517-d5a56ff2-6fdc-11e8-8d19-41e046c4b511.png">
<img width="267" alt="after1" src="https://user-images.githubusercontent.com/22233256/41394520-d7a3c600-6fdc-11e8-98c4-e3024a4532ec.png">

<!--
  Does this PR require a documentation change?
  Create a PR at https://github.com/facebook/react-native-website and add a link to it here.
-->

[IOS] [BUGFIX] [Monitor] - fix memory perf monitor. Make sure the memory footprint is the same as Jetsam.

<!--
  **INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.**

    CATEGORY
  [----------]      TYPE
  [ CLI      ] [-------------]    LOCATION
  [ DOCS     ] [ BREAKING    ] [-------------]
  [ GENERAL  ] [ BUGFIX      ] [ {Component} ]
  [ INTERNAL ] [ ENHANCEMENT ] [ {Filename}  ]
  [ IOS      ] [ FEATURE     ] [ {Directory} ]   |-----------|
  [ ANDROID  ] [ MINOR       ] [ {Framework} ] - | {Message} |
  [----------] [-------------] [-------------]   |-----------|

 EXAMPLES:

 [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things
 [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput
 [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with
 [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word
 [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position
 [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see
-->
Pull Request resolved: https://github.com/facebook/react-native/pull/19664

Differential Revision: D9246307

Pulled By: hramos

fbshipit-source-id: f85efc54cdcb0c19677594d465752c666d5af18b
2018-08-09 12:46:47 -07:00
Kevin Gozali 29245e96cb iOS: prevent nativemodule access from JS if bridge is no longer valid
Summary: This helps prevent race condition where JS calls to NativeModules got queued and executed while the bridge is invalidating itself, causing assertion failures in test setup (for example). It won't prevent it 100% of the time, due to threading (and adding lock is expensive for each nativemodule call).

Reviewed By: yungsters

Differential Revision: D9231636

fbshipit-source-id: 298eaf52ffa4b84108184124e75b206b9ca7a41d
2018-08-09 12:17:07 -07:00
Linus Unnebäck e6b305b722 Properly escape JavaScript code on Android (#20366)
Summary:
These changes will fix executing javascript with any special characters, by making use of the `evaluateJavascript` function on Android 4.4+, and by properly escaping the URI on Android <4.4.

Fixes #19611Fixes #20365Fixes #9749Closes #19655Closes #12321

This PR supersedes #19655 by patching the same problem in all the places, and fixing it for Android <4.4 as well.
Pull Request resolved: https://github.com/facebook/react-native/pull/20366

Differential Revision: D9242968

Pulled By: hramos

fbshipit-source-id: f2e1abc786ba333dbd8aaa8922e716fd99ec26e0
2018-08-09 11:16:59 -07:00
Joshua Alvarado 8ee9002c76 Add flow strict typing to isEmpty
Summary: Add flow strict typing to the isEmpty lib

Reviewed By: wcheng86

Differential Revision: D9200520

fbshipit-source-id: ac5717216199166e7485abcdfcba03ab2bbe90d2
2018-08-09 10:47:58 -07:00
Wayne Cheng f536a0c268 Adding flow strict local to remaining possible files in xplat/JS
Summary:
ag -L --ignore __snapshots__ 'flow strict|noflow|generated|The controller you requested could not be found.' | ag '\.js$' | xargs ag -l 'flow' | sort > ~/temp
  cat ~/temp | xargs ag -L 'flow strict' | xargs sed -i '' 's/flow$/flow strict-local/'
  until flow check; do flow check --json | jq -r '.errors[].message[0].path' | sort | uniq | xargs hg revert; done

allow_many_files
The controller you requested could not be found.
The controller you requested could not be found.

Reviewed By: TheSavior

Differential Revision: D9004573

fbshipit-source-id: 936bd5741706b781be06bf08b6ad805a69407dfd
2018-08-09 08:54:44 -07:00
Justin Chapman d154e9ec9d Allow for undefined userConfig (#18660)
Summary:
Fixes #18249

This PR fixes an error that occurs when running `react-native link` in projects laid out as described on the React Native website section on integrating with existing apps (https://facebook.github.io/react-native/docs/integration-with-existing-apps.html) where an `ios/` subdirectory exists but an `android/` subdirectory does not exist

<img width="1050" alt="screenshot 2018-04-02 14 57 27" src="https://user-images.githubusercontent.com/2475286/38210733-3f4bd9ea-3686-11e8-9bd3-d299812a015c.png">

None

[CLI] [BUGFIX] [local-cli/core/android/index.js] - Allow for undefined userConfig
Pull Request resolved: https://github.com/facebook/react-native/pull/18660

Differential Revision: D9235171

Pulled By: hramos

fbshipit-source-id: 230dd54f8911046f7e01633f99c4f02070fa0172
2018-08-08 21:16:57 -07:00
Eli White 370e0db970 Move View native require call to new file
Summary: Moving out the requireNativeComponent call into a new file. We want this long term for all of our view managers to support codegen of the native side and so we can move the viewConfigs into JS.

Reviewed By: yungsters

Differential Revision: D9231619

fbshipit-source-id: 7c89587cc6a76e92b309c4941577291e56af8c7c
2018-08-08 18:46:53 -07:00
Johannes Baldursson 610412385b Exposed scrollEnabled on TextInput (#19330)
Summary:
On iOS, it is not possible to select a range of text using a `Text` component (see #13938). Because of how the `Text` component is implemented on iOS, this will not work without a complete re-write. On Android however, this is not an issue.

As the `TextInput` component has evolved, it can more or less be used as a drop-in replacement on iOS by setting `multiline={true}` and `editable={false}`. Except for one detail: the text input field has scrolling activated and it's not possible to turn off. (See #1391 and #15962).

This pull request addresses that issue, simply by exposing the `scrollEnabled` property:

```
<TextInput
    multiline
    editable={false}
    scrollEnabled={false}
  />
```

1. Create a multiline `TextInput` component, with the attributes presented above.
2. Run on iOS
3. The `TextInput` field should not be able to scroll

facebook/react-native-website#367

[IOS] [FEATURE] [TextInput] - Made it possible to turn off scrolling on a multiline TextInput component
Pull Request resolved: https://github.com/facebook/react-native/pull/19330

Differential Revision: D9235061

Pulled By: hramos

fbshipit-source-id: 99d278004fc236b47dde7e61d74c71e8a3b9d170
2018-08-08 18:46:53 -07:00
Steven Cable b21d4914de Check return code from malloc (#20173)
Summary:
Calls abort() in cases where malloc returns NULL.

Checking the return value from malloc is good practice and is
required to pass a [Veracode security scan](https://www.veracode.com/). This will let
developers who are required to submit their software to Veracode
use React Native.
Pull Request resolved: https://github.com/facebook/react-native/pull/20173

Differential Revision: D9235096

Pulled By: hramos

fbshipit-source-id: 9fdc97f9e84f8d4d91ae59242093907f7a81d286
2018-08-08 18:32:19 -07:00
rainywan 03663491c6 remove code relating to Nesting of <View> within <Text>, which result… (#20558)
Summary:
…s a crash in Text Example of RNTester.

Thank you for sending the PR! We appreciate you spending the time to work on these changes.
Help us understand your motivation by explaining why you decided to make this change.

If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
Pull Request resolved: https://github.com/facebook/react-native/pull/20558

Differential Revision: D9235009

Pulled By: hramos

fbshipit-source-id: 23ed28f7c8b84f509d35ac0fe7aa72c183a9ab11
2018-08-08 18:16:55 -07:00
Eli White 457a74cbc2 Move Switch native require call to new file
Summary: Moving out the requireNativeComponent call into a new file. We want this long term for all of our view managers to support codegen of the native side and so we can move the viewConfigs into JS.

Reviewed By: yungsters

Differential Revision: D9191214

fbshipit-source-id: d0bddbb50bb1cf6b5a727d72faf834b007ad9440
2018-08-08 15:03:01 -07:00
gengjiawen 51b12dd375 fix gradle wrapper issue (#19976)
Summary:
Just change gradle.properties version number to change gradle version is not the right way. Because sometimes the gradlew and gradlew.bat or even the jar need to be updated too.
I also add the wrapper task to `build.gradle`, so next time, we just need to change the version number and execute `gradlew wrapper`.
pass all current ci.
none
 [GENERAL] [BUGFIX] [Android] - fix gradle wrapper issue
Pull Request resolved: https://github.com/facebook/react-native/pull/19976

Differential Revision: D9229655

Pulled By: hramos

fbshipit-source-id: 63d1ddea6174f87778612a4e6711baac5787b0f8
2018-08-08 15:03:01 -07:00
Yury Zholobov 9b5b07f97f add Image border*Radius tests
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/20264

Differential Revision: D9228814

Pulled By: TheSavior

fbshipit-source-id: cad4c15e8070c7ab2023c20045b82f7ab3f994cf
2018-08-08 14:32:49 -07:00
Ram N 617e25d9b5 Explicitly make UIManagerModule use OnBatchComplete on Android
Summary:
Currently, we scan all native modules to see if they implement the OnBatchCompleteListerner. If they do, we add those modules to a list, and when C++ calls OnBactchComplete is called, we execute the callback on each of the modules.
The only native module implementing this callback today is the UIManagerModule. With Fabric, UIManager will also not be a native module anymore. This diff removes all the work done for creating the list and assumes that UIManagerModule is the only place that is interested in OnBatchComplete call - and calls it directly.

Reviewed By: achen1

Differential Revision: D9186651

fbshipit-source-id: 473586b37c2465ccd041985dcdd56132026f34f1
2018-08-08 14:18:07 -07:00
Dulmandakh 69912495f9 Bump imagepipeline-okhttp3 to 1.10.0 (#20580)
Summary:
This is a small missing piece from b6f2aad9c0 and will complete fresco version bump.
Pull Request resolved: https://github.com/facebook/react-native/pull/20580

Differential Revision: D9228658

Pulled By: hramos

fbshipit-source-id: 9cf1509a590cedfe4c3358006cfb62533058e946
2018-08-08 14:02:26 -07:00
Jordan Brown 0101a98af2 add RN github .flowconfig.android and platform specific fixme sites
Summary:
Adds a .github.flowconfig.android.

Also, adds the optional _ios and _android to the sites.

Reviewed By: TheSavior

Differential Revision: D9189935

fbshipit-source-id: 5274701b9425525337d5c4684ce4ffee841fef52
2018-08-08 12:31:37 -07:00
Jordan Brown b64b9dbece Replace '@flow strict(-local)' with '@flow' in .android.js files
Summary:
Flow doesn't check .android.js files yet anyway.

I'm going to be adding suppressions in a followup diff. It would be nice to not have >1k suppressions saying that we can't do certain things in `flow strict` when we don't even typecheck with regular `flow` just yet

I ran these commands to produce this diff:
`find . -name '*.android.js' -exec sed -i 's/flow strict-local/flow/g' {} +`
`find . -name '*.android.js' -exec sed -i 's/flow strict/flow/g' {} +`

Followed https://unix.stackexchange.com/questions/112023/how-can-i-replace-a-string-in-a-files to do it.

The controller you requested could not be found.

Reviewed By: TheSavior

Differential Revision: D9143783

fbshipit-source-id: e9af4fe695ebdba4db4083de1697cc248d48eb0d
2018-08-08 10:48:19 -07:00
Miguel Jimenez Esun 8f7372fe1b Fix "http" monkeypatch
Summary:
Some time ago I had to add a monkeypatch to the `http` library to enforce IPv6, due to the lack of support in Node for that. In version 2.2.0 of `node-fecth`, this has been fixed, and `family: 6` can be enforced via `agent`, which is what this diff does.

I also simplified `Promise` handling at the `test-console-call` level by removing an un-needed `.then()` nesting.

Reviewed By: rafeca

Differential Revision: D9200515

fbshipit-source-id: fe06acddd8e3539f590f88eef3468b02c4242afc
2018-08-08 03:46:22 -07:00
Ziqi Chen 893e4d19a9 Added 5 examples of new Accessibility API to RN Tester on Android
Summary:
I added three examples to the RN Tester in order to test the new accessibility props I've added to the accessibility API.

These examples test the following properties on views and touchables:
* AccessibilityRole
* AccessibilityStates
* AccessibilityHint

Reviewed By: PeteTheHeat

Differential Revision: D9167874

fbshipit-source-id: 4971b9ae43ad4f35c6be7e8548cc31393c3f0a33
2018-08-08 01:31:46 -07:00
Ziqi Chen 91b3a3055a changed documentation for accessibilityHint
Summary:
Changed documentation for accessibility Hint so that its no longer only available on iOS

Also added full description of documentation for accessibility Role as it was missing earlier

Reviewed By: PeteTheHeat

Differential Revision: D9072572

fbshipit-source-id: c8d20f30df588717d9ec37721c2aa3c86a0664c6
2018-08-08 01:31:46 -07:00
Ziqi Chen d3f0919816 added accessibilityHints implementation on Android
Summary:
Implemented a version of accessibility Hints on android by adding hint text to the end of contentDescription. There is already an existing prop on js and iOS implementation.

Changes involve:
* adding a prop on native android code for accessibilityHints
* setting the accessibilityDelegate after the props are all loaded.
* Instead of directly updating the accessibility delegate, the prop setters now update state by setting the values of the variables. Once all props are set, the accessibility delegate is set based on the props
   * BaseViewManager keeps track of whether or not accessibility props have been set
   * AccessibilityDelegateUtil keeps track of what the props have been set to. (Renamed AccessibilityRoleUtil to AccessibilityDelegateUtil)

Currently, this is the easiest way of emulating the way accessibility hints work on iOS, and I think having an android counter part is better than having nothing.

It's different from iOS in that it will announce the hint before the role, and also cannot be turned off.

Ex:

if I set the accessibility like this:
```
      <View
        style={styles.container}
        accessible={true}
        accessibilityLabel="accessibility label"
        accessibilityRole="button"
        accessibilityStates={['selected']}
        accessibilityHint="accessibility Hint">
        <Text> Tester </Text>
      </View>
```

Talk back will read:
`accessibility label, accessibility Hint, button, selected`

In the future for next steps, I plan on investigating the process of making a second announcement after the first

Reviewed By: achen1

Differential Revision: D9037226

fbshipit-source-id: 8d484e1114eb69aa5f5314b3755b351b8ea80b09
2018-08-08 01:02:24 -07:00
gengjiawen cf3cdeeb90 switch to yarn in appveyor (#20566)
Summary:
switch to yarn to keep consistent. Windows android  build pass: https://ci.appveyor.com/project/gengjiawen/react-native/build/job/xyof6052yg2uhnmw.
pass all current ci.
none
 [GENERAL] [INTERNAL] [CI] - switch to yarn.
Pull Request resolved: https://github.com/facebook/react-native/pull/20566

Differential Revision: D9213415

Pulled By: hramos

fbshipit-source-id: 35183c143f831e29aa0d0c0b90baacb6a7cd7837
2018-08-07 21:46:39 -07:00
Kevin Gozali 235d9017cf added small UI indicator for fabric-based surfaces
Summary: To make debugging/testing easier, optionally display fabric label on the top-right of the surface if it's rendered on fabric mode.

Reviewed By: mdvacca

Differential Revision: D9206473

fbshipit-source-id: ef6f0396ff749f2a0415688b1cf4fe1a4b83124d
2018-08-07 21:35:54 -07:00
Joshua Wang c298e0ae06 Update template to Xcode 9.4 and fix project settings warnings (#19626)
Summary:
Motivation: Fix Xcode Project Settings Warnings
![screenshot 2018-06-08 10 58 23](https://user-images.githubusercontent.com/5353594/41173274-1a4fbb3e-6b0b-11e8-973b-8290794a4f8b.png)

Should still build and pass all tests since project settings changes should be safe changes.

No documentation change is required

[IOS][MINOR][XcodeProjs] Upgraded Project settings to be compatible with Xcode 9.4
Pull Request resolved: https://github.com/facebook/react-native/pull/19626

Differential Revision: D9211230

Pulled By: hramos

fbshipit-source-id: ef8692871bffbdb5dd0214f65220fd171c203c6c
2018-08-07 19:46:23 -07:00
Mayank Patke ccf5dfbe3f v0.78 in fbsource
Summary: The controller you requested could not be found.

Reviewed By: pakoito

Differential Revision: D9174188

fbshipit-source-id: 4ec9ef5b6f802964a83b6bc0bd29db7f47b37c21
2018-08-07 16:03:09 -07:00
Janic Duplessis 476a831ea0 Un-deprecate TextInput.State.focusTextInput and TextInput.State.blurTextInput (#20326)
Summary:
In https://github.com/facebook/react-native/pull/18936 we decided to deprecate `focusTextInput` and `blurTextInput` but since then I found a valid use case for it that is pretty much impossible to implement otherwise.

React Navigation uses it to blur / re-focus the input during the swipe back gesture. Blur can be done with Keyboard.dismiss but without this api we cannot re-focus the text field that was focused if the swipe back gesture is cancelled. See https://github.com/react-navigation/react-navigation/blob/master/src/navigators/createKeyboardAwareNavigator.js#L21-L34

I think it is best to just bring back this api.
Pull Request resolved: https://github.com/facebook/react-native/pull/20326

Differential Revision: D9182810

Pulled By: hramos

fbshipit-source-id: 3740421ffafb8f814522d15788f3466324177c16
2018-08-06 15:01:50 -07:00
Héctor Ramos fb223e7675 Consolidate e2e steps and run Detox tests before e2e (#20550)
Summary:
Run Detox before the flaky e2e iOS tests in order to get better signal.
Pull Request resolved: https://github.com/facebook/react-native/pull/20550

Differential Revision: D9183655

Pulled By: hramos

fbshipit-source-id: e499daad86249961cd6d0b8fc22c846392622056
2018-08-06 13:02:58 -07:00
Tvrqvoise 6d65e8b4ed Add support for linking scoped packages (#18766) (#19828)
Summary:
Currently, when the cli tries to determine the package name, it accidentally trims out the entire package name.  This makes it appear to the rest of the program as if `react-native link The controller you requested could not be found./my-package` was just `react-native link`.  This adds a little regex to prevent that from happening, so that scopes can be passed as parts of packages.

Fixes #18766
Pull Request resolved: https://github.com/facebook/react-native/pull/19828

Differential Revision: D8704742

Pulled By: hramos

fbshipit-source-id: d8183f9b55e8656b8a0acae842e1361a1f428102
2018-08-06 12:32:25 -07:00