Commit Graph

9470 Commits

Author SHA1 Message Date
janus_wel bc432ae324 fix typo RTC to RCT
Summary:
Explain the **motivation** for making this change. What existing problem does the pull request solve?

Descriptions about class names are incorrect.
Closes https://github.com/facebook/react-native/pull/11898

Differential Revision: D4418957

fbshipit-source-id: fc7d0b61149ed9f850a436a35ad98f179b5e3e19
2017-01-13 18:58:23 -08:00
Valentin Shergin 930010ec91 RCTTouchHandler doesn't delay any touches anymore
Reviewed By: mmmulani

Differential Revision: D4418211

fbshipit-source-id: 07fdd81d975c6b65477e599e2dcb604b64556e9e
2017-01-13 17:43:35 -08:00
ericnakagawa 8045a7084a Temporarily disabling e2e tests. Tests will reconvene after solution for CI-14683
Summary:
https://circleci.com/gh/facebook/react-native/14683

We are disabling end to end tests over weekend to allow additional time to some new additions introduced in #3f49e743bea730907066677c7cbfbb1260677d11 #b15c042a21359a727f2c5d79721994473be83620.
Closes https://github.com/facebook/react-native/pull/11894

Differential Revision: D4418208

fbshipit-source-id: 890d987110d959e06612899263bf6ea798c49845
2017-01-13 17:28:28 -08:00
Martin Konicek 521e9c6ee5 Add a missing include in a BUCK file
Summary: The include was missing in 87c6bcb65d (D4405355)

Reviewed By: ericnakagawa

Differential Revision: D4417874

fbshipit-source-id: 164a44e08c9da0931b49c90d01eb4396225e27d1
2017-01-13 16:43:33 -08:00
Rob Hogan 9e1e52f312 Mark __unused completion block args
Summary:
Catching a couple more build warnings introduced by b50f55026a since https://github.com/facebook/react-native/pull/11797.

Edit: and one more introduced by c68a708621

Tested the build with UIExplorer.
Closes https://github.com/facebook/react-native/pull/11865

Differential Revision: D4415630

fbshipit-source-id: 1384d56770eea8665ede8bd9abe06cf34cd14b33
2017-01-13 12:43:31 -08:00
Mehdi Mulani 49d7c00500 Disable yellow box warnings based on environment variable
Summary:
This adds a hook to let you disable yellow box warnings. It's useful for native engineers who don't want to mess with JS but also for CI/testing, where the app operates mostly as a blackbox.

Depends on D4395091

Reviewed By: achen1

Differential Revision: D4395552

fbshipit-source-id: 4c3a9676caa975c537d1a4711d60aab2f404db15
2017-01-13 12:28:31 -08:00
Mehdi Mulani 91b7499cf6 Expose environment and arguments to JS
Summary:
Right now from JS there's no way to see the environment variables or arguments that the application was started with.
The main use case for this is to help enable/disable features when being run in a testing environment (as environment variables are the easiest way to communicate).

javache is it okay to reference these constants from JS at startup time? I am planning to disable yellow boxes via an environment variable.

achen1 how easy is it expose these two things for Android as well?

Reviewed By: achen1

Differential Revision: D4395091

fbshipit-source-id: fc318e6a60b8829f7eb4491ea8f3258f68f59c8c
2017-01-13 12:28:31 -08:00
David Aurelio 09072b9d77 Fix loading minified bundle over HTTP
Summary: Sets `generateSourceMaps` to true when requesting a bundle in non-dev mode or minified.

Reviewed By: bestander, cpojer

Differential Revision: D4415492

fbshipit-source-id: 9b4dcbd577a535dab143bb7a067210fbd831bf1a
2017-01-13 10:43:27 -08:00
David Aurelio 9a4e4e8ee8 Fix packager breakages on node4
Summary:
This fixes issues that only surface when running with node4 / npm2.
Closes https://github.com/facebook/react-native/pull/11888

Differential Revision: D4415021

Pulled By: bestander

fbshipit-source-id: 8672cd892c9dae41cc7b5b7b3227eb24dd780d22
2017-01-13 09:28:41 -08:00
Ashok Menon 87c6bcb65d Adding Soft Error Logging to FallbackJSBundleLoader
Reviewed By: michalgr

Differential Revision: D4405355

fbshipit-source-id: 7730a1afd74ace7fdad91b22f9254e83d16d1050
2017-01-13 03:58:47 -08:00
Ashok Menon c3892fa871 Introducing `FallbackJSBundleLoader`
Reviewed By: michalgr

Differential Revision: D4386951

fbshipit-source-id: b1375deee9b3268d414e1b03fa79df50ac4d36cb
2017-01-13 03:58:47 -08:00
Ashok Menon 89d72c99be BREAKING - (Re)moving `JSBundleLoader.getSourceUrl()`
Summary:
== What ==

Changing the `JSBundleLoader` API, to remove `String getSourceUrl()`, instead `JSBundleLoader.loadScript` now returns the source URL it loaded.

This change has a knock-on effect: We can no longer populate `SourceCodeModule` when we construct it, because at that time, we do not know the source URL.

In order to solve this I have made the following changes:

 -  Added `CatalystInstance.getSourceURL()`, to return the source URL from the instance after the JS Bundle has been loaded, or `null` otherwise.
 -  Removed `ReactInstanceManager.getSourceUrl()`, because its only purpose was to populate `SourceCodeModule`.
 -  Also removed `ReactInstanceManager.getJSBundleFile()` because it was only being used in a test confirming that the `ReactInstanceManager` knew its bundle file as soon as it was constructed, which is no longer necessarily true.
 -  Initialise `SourceCodeModule` with the `ReactContext` instance it belongs to.
 -  Override `NativeModule.initialize()` in `SourceCodeModule` to fetch the source URL. When the `SourceCodeModule` is constructed, the context does not have a properly initialised `CatalystInstance`, but by the time we call initialise on it, the `ReactContext` has a `CatalystInstance` and that in turn has a source URL.

== Why ==

The reason for this change is that it allows us to add implementations of `JSBundleLoader`, that cannot determine their source URL until after having performed a load successfully. In particular I plan to introduce `FallbackJSBundleLoader` which will try to load from multiple sources in sequence stopping after the first successful load. As load failures could happen for a variety of reasons, we can't know what the true source URL is without performing the load.

Reviewed By: javache

Differential Revision: D4398956

fbshipit-source-id: 51ff4e289c8723e9d242f23267181c775a6abe6f
2017-01-13 03:58:47 -08:00
Pieter De Baets 8e4f33e669 Dismiss redbox upon pressing reload
Reviewed By: shergin

Differential Revision: D4405376

fbshipit-source-id: 63d624457c6afde3dbe71a66c57b410cf71cbbd3
2017-01-13 03:58:47 -08:00
Pieter De Baets a94418fdd3 Show redbox when no bundle is present
Reviewed By: shergin

Differential Revision: D4405409

fbshipit-source-id: 847fc559121dcde844f1ee3c6d02206e9e27803b
2017-01-13 03:43:35 -08:00
Andrew Imm 09a83f976e Allow project-specific config for RN CLI using providesModuleNodeModules
Reviewed By: davidaurelio

Differential Revision: D4409046

fbshipit-source-id: 5af0d08542935a784f4737653ccac49fd7517aff
2017-01-12 21:13:36 -08:00
Kevin Lee 09801aac30 fix direction of VerticalSwipeJump gestures
Summary:
When something comes in from the right, we swipe from left to
right to move back. That means, when something comes in from the bottom,
we should swipe from top to bottom to get rid of it. This diff makes that
behavior occur - right now it's somewhat nonsensical as both jumpBack
and jumpForward are mapped to the same gesture.

thanks to #11192 for making gestures work on VerticalUpSwipeJumps

Reviewed By: ericvicenti, shergin

Differential Revision: D4412129

fbshipit-source-id: 6a3b202b0a90ca459b4ef106ba5bf48d0b1aec9e
2017-01-12 17:43:42 -08:00
Ashok Menon 154e183344 Fixing RN Debugger
Reviewed By: cwdick, javache

Differential Revision: D4409257

fbshipit-source-id: 062c798d1a1c9ad90884599ed262412c1dd51359
2017-01-12 16:28:36 -08:00
Mike Grabowski 545072b02d Fully support new import system on iOS
Summary:
A bit late to the party, but upgraded, tests replaced, all green.

Also updated `pbxproj` so that we are testing against React 0.40 init result, not against something old.

To cherry-pick and land once ships.
Closes https://github.com/facebook/react-native/pull/11868

Differential Revision: D4411362

fbshipit-source-id: c485fd76114979d34a7e288bb70e1ecb9b3baf76
2017-01-12 14:58:28 -08:00
David Aurelio 0849f84df2 create better debuggable source maps
Summary:
Introduces a new mechanism to build source maps that allows us to use real mapping segments instead of just mapping line-by-line.

This mechanism is only used when building development bundles to improve the debugging experience in Chrome.

The new mechanism takes advantage of a new feature in babel-generator that exposes raw mapping objects. These raw mapping objects are converted to arrays with 2, 4, or 5 for the most compact representation possible.
We no longer generate a source map for the bundle that maps each line to itself in conjunction with configuring babel generator to retain lines.

Instead, we create a source map with a large mappings object produced from the mappings of each individual file in conjunction with a “carry over” – the number of preceding lines in the bundle.

The implementation makes a couple of assumptions that hold true for babel transform results, e.g. mappings being in the order of the generated code, and that a block of mappings always belongs to the same source file. In addition, the implementation avoids allocation of objects and strings at all costs. All calculations are purely numeric, and base64 vlq produces numeric ascii character codes. These are written to a preallocated buffer objects, which is turned to a string only at the end of the building process. This implementation is ~5x faster than using the source-map library.

In addition to providing development source maps that work better, we can now also produce individual high-quality source maps for production builds and combine them to an “index source map”. This approach is unfeasable for development source maps, because index source map consistently crash Chrome.

Better production source maps are useful to get precise information about source location and symbol names when symbolicating stack traces from crashes in production.

Reviewed By: jeanlauliac

Differential Revision: D4382290

fbshipit-source-id: 365a176fa142729d0a4cef43edeb81084361e54d
2017-01-12 14:28:41 -08:00
Mike Grabowski 4969f26252 Improve `unlink` on rnpm
Summary:
We don't need to look for `thisDependency` as we already have it. Small improvement as I am working on other fixes.
Closes https://github.com/facebook/react-native/pull/11867

Differential Revision: D4411177

fbshipit-source-id: 1413eb5457cb4d7916ead90f438ffe158f644cad
2017-01-12 13:58:34 -08:00
Janic Duplessis 6b1bc4ad74 Fix babel only regexp on windows
Summary:
cli / packager was broken on Windows after 28f1c67ced.

Babel `only` regexp option requires paths to use forward slashes only but `__dirname` will use backslashes on windows. This simply adds a replace to normalize to forward slashes.

cc jeanlauliac cpojer
Closes https://github.com/facebook/react-native/pull/11850

Reviewed By: cpojer

Differential Revision: D4409143

Pulled By: jeanlauliac

fbshipit-source-id: a705236630959f762e53100299ab073ec9a29ee1
2017-01-12 12:43:39 -08:00
Valentin Shergin c68a708621 New way to handle simultaneously active gesture recognizers in RCTTouchHandler
Reviewed By: majak

Differential Revision: D4385209

fbshipit-source-id: 22746dd93e378a4d9e5feca66bc84c357afb6f36
2017-01-12 12:13:28 -08:00
Dan Hassin dbe555ba78 Include props in new ListView and ScrollView mocks
Summary:
Hi,

The (as of yet unreleased) commit 5537055bf8 added some ListView and ScrollView mocks, but they leave out the original properties passed into them, which broke some of my tests (e.g. by excluding some properties like `testID`, for example, from the render tree) and I assume might break others' as well.

This PR makes it so the ListView mock directly returns the scroll component (instead of wrapping it in a View), and has ListViewMock and ScrollViewMock pass their given properties through.
Closes https://github.com/facebook/react-native/pull/11847

Differential Revision: D4408497

Pulled By: sahrens

fbshipit-source-id: 7ec01c35d6b8efeb97761cddffdb4075d09c7d70
2017-01-12 10:58:29 -08:00
Jean Lauliac d12d0b4c53 packager: do not try to fetch uncached files
Reviewed By: davidaurelio

Differential Revision: D4403623

fbshipit-source-id: 8319e6bac365fe5fcebefd4f338faf145f662ecb
2017-01-12 10:43:32 -08:00
David Aurelio e1c0e04833 add `no-const-assign` rule
Summary: Adds the `no-const-assign` rule to our `.eslintrc`, because sometime people assign to `const`.

Reviewed By: bestander, jeanlauliac

Differential Revision: D4409485

fbshipit-source-id: c74ad9649ec665e3f2ba2da7843f4e261303c9e7
2017-01-12 10:28:33 -08:00
sunnylqm d0116d52bd typo (data -> intent)
Summary: Closes https://github.com/facebook/react-native/pull/11856

Differential Revision: D4409174

Pulled By: foghina

fbshipit-source-id: 9b3f75d5f0515294e3b48dc3d9284b0cf684d152
2017-01-12 10:13:33 -08:00
Vince Yuan 4c08105e14 Let LayoutAnimation respect style opacity on Android. Fix issue #11769
Summary:
Fix issue #11769

When a view or text is created with style opacity (e.g. 0.2) and LayoutAnimation is enabled on Android, what we expected to happen is the view or text has opacity (e.g. 0.2).
What actually happens is the view or text's opacity is always 1.

In the following screenshot of the sample app, the odd numbered view/text's opacity should be 0.2. If we create them without LayoutAnimation, everything is good. But when we do with LayoutAnimation, the style opacity is not respected.
![Screenshot](https://github.com/vinceyuan/ReactNativeOpacityBugDemo/raw/master/ReactNativeOpacityBug.gif)

Reproduced on rnplay.org https://rnplay.org/apps/JbdOpQ
The sample project I created: https://github.com/vinceyuan/ReactNativeOpacityBugDemo
You can try my fix on branch fix-react-native-issue-11769 https://github.com/vinceyuan/ReactNativeOpacityBugDemo/tree/fix-react-native-issue-11769
Closes https://github.com/facebook/react-native/pull/11770

Differential Revision: D4403096

fbshipit-source-id: 99c6831ab17eae304e09f23dbad387041d933a30
2017-01-12 09:13:43 -08:00
rh389 4844225eed JavaScriptLoader BCBundle version check
Summary:
Currently a build warning is thrown by `if (header.BCVersion != runtimeBCVersion) ...` because `runtimeBCVersion` is signed, apparently because `-1` is used to mean that the runtime has no support for bytecode bundles.

This PR splits out the error case of the runtime not supporting BC bundles from the case of a version mismatch.

Tested as much as I could by building and running `UIExplorer` - I haven't attempted to use real bytecode bundles.
Closes https://github.com/facebook/react-native/pull/11806

Differential Revision: D4408608

fbshipit-source-id: a1d868bb2064588e6a20827692629a46b6ba1e74
2017-01-11 22:28:43 -08:00
Michael Lee 55f0294b7d clean up buck dep order
Reviewed By: adamjernst

Differential Revision: D4404770

fbshipit-source-id: d5801cc2b529f513e1531840310b884af951d702
2017-01-11 14:43:31 -08:00
Valentin Shergin f839b58c20 `UIManager.measure()` now respects any `zoom` affected view hierarchy
Reviewed By: mmmulani

Differential Revision: D4396422

fbshipit-source-id: 100c7050bdf9e66b8af27df335343f028a2d4148
2017-01-11 13:43:40 -08:00
James Ide 0d78bba7fe Stop copying unused JS files into the Pods folder
Summary:
Currently the podspec copies JS files along with the associated Obj-C files (ex: PushNotifications.m and PushNotifications.js are copied together). However the packager looks at `node_modules`, not `Pods`, for the JS source files so these copied JS source files (plus JS unit tests) were always ignored and are cruft.

This is documented as a breaking change but I suspect it won't affect most (if any) configurations. For this to have been useful, you would have had to have had been running the packager under `Pods/..some path to RN../cli.js` instead of with `npm start` or `node_modules/react-native/cli.js`.
Closes https://github.com/facebook/react-native/pull/11761

Differential Revision: D4404934

fbshipit-source-id: a9f372a74f7acb962581f929647e82eae185c5ba
2017-01-11 12:43:34 -08:00
Dan Caspi ad0493c6c2 Fixing a crash caused by D4393955
Reviewed By: javache

Differential Revision: D4403858

fbshipit-source-id: c930aa108d27c1bd1b36364530d2953bcd4664ad
2017-01-11 09:43:34 -08:00
Albert Brand d2de604721 Android: fix JSC crash in dev
Summary:
On Android with dev mode on, we're seeing a regular SIGSEGV when pushing a lot of animation declarations over the bridge. We tracked this down to being not specific to animations, but the crash is caused in `deepFreezeAndThrowOnMutationInDev`.

Specifically: the provided object to freeze is modified while looping, replacing the current key access to a getter/setter. After the modification, JSC crashes during retrieval of the next key - but only when there are a lot of events passing over the bridge.

We have a hunch that this is due to a bug in JSC object enumeration but did we not look into it further yet. Any help here is welcome. The JS code seems all right at first sight and shouldn't cause a segmentation crash.

The workaround in this PR is to retrieve the keys first from the object and then looping over that array. In our app and in a reduced app test case this fixes the crash.

If needed I can provide the reduced app test case. It's really tricky to make a test for this as it requires to be run
Closes https://github.com/facebook/react-native/pull/11804

Differential Revision: D4403483

Pulled By: davidaurelio

fbshipit-source-id: a31e5cff734e96bfec56e4a39dc1c6854798e245
2017-01-11 08:58:30 -08:00
Lukas Piatkowski e94beab4c7 Add js1 perf cpuprofile command
Reviewed By: cwdick

Differential Revision: D4397944

fbshipit-source-id: a4255e766044f6cf6c2ea8a8364542574cd9314b
2017-01-11 07:58:31 -08:00
Stephen Girdlestone a0dd54b4d7 Adding method for JSCreateSourceCodeFromFile.
Reviewed By: amnn

Differential Revision: D4365790

fbshipit-source-id: b62ee9c7d3fa3f89c22a10a6fde21cd9c30fceb2
2017-01-11 06:13:28 -08:00
Emil Sjolander b15c042a21 Add null checks for dynamics
Reviewed By: ahmedre

Differential Revision: D4400532

fbshipit-source-id: d6e503ca39fe1cf90baaf52348b6fa3130f76fb8
2017-01-11 03:58:37 -08:00
Emil Sjolander 3f49e743be Add percentage support to react native
Summary:
Adds support for percentage value in react native.

syntax: property: 100 | property | '100%'

supported properties:
padding
margin
width
height
minWidth
minHeight
maxWidth
maxHeight
flexBasis

```
class Playground extends React.Component {
  render() {
    return (
      <View style={{backgroundColor: 'white', padding: 10, paddingTop: 30, height: '100%'}}>
        <Text>
          If you want to quickly test out something,
          open the Playground.js file and start coding.
        </Text>
        <View style={{backgroundColor: 'red', height: 50, width: 50}}/>
        <View style={{backgroundColor: 'blue', height: '50%', width: '50%'}}/>
      </View>
    );
  }
}
```

Reviewed By: astreet

Differential Revision: D4376549

fbshipit-source-id: c41d68a7555396f95d063a7527ee081773ac56dc
2017-01-11 03:58:37 -08:00
Neil Sarkar 00d5674474 Remove deprecation warning for RCTExecuteOnMainThread
Summary:
As per janicduplessis recommendation, provide a new synchronous method to replace the necessary synchronous calls and use a warning in the comments (and method name).

**Motivation**

There are currently a number of XCode warnings that show up in a fresh 0.40 install of a react native project. While the project can still be run, this contributes negatively to the development experience -- valid warnings may be ignored and new ones may be added as per https://en.wikipedia.org/wiki/Broken_windows_theory

This addresses one of the warnings, by providing the functionality of a deprecated method in two specific cases where we can't avoid doing synchronous work on the main queue. See https://github.com/facebook/react-native/issues/11736 for more context.

**Test plan (required)**

I ran a project that relied on screen size and it didn't crash...happy to do more involved testing if someone can share better methodology.
Closes https://github.com/facebook/react-native/pull/11817

Differential Revision: D4402911

fbshipit-source-id: 9fd8b3f50d34984b765fe22b1f4512e103ba55a9
2017-01-10 23:13:33 -08:00
rh389 40f2b1bbb7 Prevent compiler inferring incorrect type
Summary:
Fixes the build warning:

```react-native/React/Modules/RCTRedBox.m:406:58: Conversion from value of type 'NSArray<RCTJSStackFrame *> *' to incompatible type 'NSArray<NSDictionary *> *```

This appears because the compiler is left to infer the type of `stack`, and it does so as `NSArray<RCTJSStackFrame *>` based on [RCTRedBox.m#L390](https://github.com/facebook/react-native/blob/master/React/Modules/RCTRedBox.m#L390). In reality `stack` may be either of two types and the function body deals with normalisation.

Mark the stack as explicitly `NSArray<id>` to prevent inference so we're free to make the decision to cast to more specific types.
Closes https://github.com/facebook/react-native/pull/11807

Differential Revision: D4402916

fbshipit-source-id: 356343f244af7638b9b9e91c2c5b7e68de0cbd33
2017-01-10 22:58:33 -08:00
Emil Sjolander b27c541744 Pool dynamic
Reviewed By: ahmedre

Differential Revision: D4398446

fbshipit-source-id: ff528b7b52a2b1521627c0fca17b7ee2b18102de
2017-01-10 18:13:38 -08:00
Emil Sjolander 1d9ba508c4 Make edittext padding fix to nodes as well
Reviewed By: ahmedre

Differential Revision: D4397500

fbshipit-source-id: abf116847cbf98cccba07f1e08d8aab47a35123b
2017-01-10 18:13:38 -08:00
Emil Sjolander 669c84f11e Transfer TextUpdate padding info onto text input view
Reviewed By: achen1

Differential Revision: D4397498

fbshipit-source-id: df53d64d9992609a1dfb1ba606ac7f820794161a
2017-01-10 18:13:38 -08:00
Dan Caspi b50f55026a Adding support in the new RN bridge on iOS
Differential Revision: D4393955

fbshipit-source-id: e5f3fb6773908678773a5dd4fdea568bcc200336
2017-01-10 11:28:44 -08:00
Emil Sjolander 7c2f8a9e14 Allow aspect ratio to expand beyond bounds of parent
Reviewed By: passy

Differential Revision: D4397547

fbshipit-source-id: d2b1ca7b096f2f17b3efbd8f47a50678bfe7bb5f
2017-01-10 08:28:26 -08:00
Ashok Menon da428d6c3d Exposing Recoverable Errors
Differential Revision: D4383792

fbshipit-source-id: e6d0f57fcaacf242e95bfcf589a4fa840c317fe5
2017-01-10 07:13:40 -08:00
Ashok Menon 24f3add010 Use JSExecutor's file-based Loading API in NativeToJsBridge and Instance
Reviewed By: javache

Differential Revision: D4320773

fbshipit-source-id: fa46728ba0d45818737b32952efbfae7bc8ef9f1
2017-01-10 07:13:40 -08:00
Ashok Menon 8819bef56b Getting rid of File descriptor based loading APIs
Reviewed By: javache

Differential Revision: D4333725

fbshipit-source-id: ba8591c7380e8eb90660a912f6fc86fc3d2d4774
2017-01-10 07:13:40 -08:00
Emil Sjolander b5f382c0e8 Implement java bindings for custom baseline function
Differential Revision: D4392516

fbshipit-source-id: 39cf6066f8e5982268becd87e54c9ab51fbf7a90
2017-01-10 07:13:40 -08:00
Charles Dick 64f394a99b RN trigger heap capture from js1
Differential Revision: D4397603

fbshipit-source-id: 566cfad9ce47bcc8cddb9219ed9f6a427ce19f84
2017-01-10 07:13:40 -08:00
Emil Sjolander 9724eaeb42 Fix checks for already set padding
Reviewed By: ahmedre

Differential Revision: D4393371

fbshipit-source-id: 96672d0ee38b16b6f225c8a6fe0442c9b9eb9ec8
2017-01-10 02:28:28 -08:00