Summary:
This change only affects tests run with Jest. `require('/images/image1.png')` will be replaced with
```
Object {
"testUri": "relative/path/to/images/image1.png",
}
```
in the Jest snapshot instead of always being 1 returned by RelativeImageStub. This change makes it possible to test conditional asset loading in components.
The problem with this change is that it will probably break a lot of existing snapshots, but that should be easily fixed when a project updates to a new version of React Native by running `jest -u` to update all snapshots.
A component can have conditional asset loading based on its props, this logic would be nice to test with Jest snapshots. This problem has been discussed in https://github.com/facebook/jest/issues/2838.
* **Who does this affect**: Everyone using `Image` in Jest snapshots
* **How to migrate**: Running `jest -u` will update the snapshots, the snapshots should be reviewed that they are correct.
* **Why make this breaking change**: It enables testing of conditional asset loading.
* **Severity (number of people affected x effort)**: Low.
Closes https://github.com/facebook/react-native/pull/13319
Reviewed By: rafeca
Differential Revision: D5708180
Pulled By: mjesun
fbshipit-source-id: 16ac42004d597db08545a21d4fffe95c5ee7e21f
Summary:
There were still some references to "packager/" that are no longer used since the `packager` directory has been deleted after moving to Metro. Cleaned up the ones that were doing nothing and updated the references that are still meaningful.
Closes https://github.com/facebook/react-native/pull/14881
Reviewed By: cpojer
Differential Revision: D5380731
Pulled By: javache
fbshipit-source-id: 1355268f48db47343d0d38fae2598b64c8c01475
Summary:
This should be there for consistency.
Closes https://github.com/facebook/react-native/pull/11357
Differential Revision: D4294530
Pulled By: kentaromiura
fbshipit-source-id: 6219a7c69a65dde21d96bc032fc9a327386a85ca
Summary:
See https://github.com/facebook/jest/pull/2170. Per cpojer's request, bringing this PR to react-native as well.
**Summary**
When using jest with React Native and Relay and recommended default settings, jest throws :
```
Cannot find module 'react-dom' from 'relayUnstableBatchedUpdates.js'
at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:151:17)
at Object.<anonymous> (node_modules/react-relay/lib/relayUnstableBatchedUpdates.js:15:18)
at new RelayEnvironment (node_modules/react-relay/lib/RelayEnvironment.js:39:63)
```
Investigating this, I found out that https://github.com/facebook/jest/blob/master/packages/jest-react-native/jest-preset.json didn't have "native" in the list of platforms, hence jest can't pick up `relayUnstableBatchedUpdates.native.js` in react-relay.
**Test plan**
I copied and paste the content of https://github.com/facebook/jest/blob/master/packages/jest-react-native/jest-preset.json in my `package.json` `jest` section, as well a
Closes https://github.com/facebook/react-native/pull/11179
Differential Revision: D4243073
Pulled By: cpojer
fbshipit-source-id: bcfeb2235df4d466ba19d0a3fe94fc98835a20ea
Summary:
This removes support for `require('image!…')`, which has been deprecated for a long time.
It is still possible to use images that are already bundled by the native app using the `nativeImageSource` module.
Check http://facebook.github.io/react-native/docs/images.html for detailed documentation.
Reviewed By: matryoshcow
Differential Revision: D4231208
fbshipit-source-id: 05ec4c1ca0fabdc3fbb652f8ad1acdf240a67955
Summary:
Fixes breakage on https://circleci.com/gh/facebook/react-native/12763 after the upgrade of React
Explain the **motivation** for making this change. What existing problem does the pull request solve?
Jest preset has been upgraded so that requiring `React` capitalized can be possible
**Test plan (required)**
Couldn't reproduce it locally, we need to see if Circle passes.
Closes https://github.com/facebook/react-native/pull/10749
Differential Revision: D4132150
Pulled By: bestander
fbshipit-source-id: e41fb95b6677113fc6a3bf8bbce9247f59aa81dd