Summary:
public
A previous refactor introduced a bug where setting the tintColor of an <Image> to null no longer cleared the tint. This fixes it again.
Reviewed By: javache
Differential Revision: D2744279
fb-gh-sync-id: 1b5e0d546bf456d7b93e2ceee73c568c185c305c
Summary:
public
NativeModule getters call the nativeRequireModuleConfig function to lazily load a module if it's not already available, but this crashes on Android since the nativeRequireModuleConfig hook hasn't been implemented yet. This diff checks that the hook exists before calling it.
Reviewed By: gsaraf
Differential Revision: D2744080
fb-gh-sync-id: cae9c8c45a4d3c80ceb8c10f3d4d59a8d9d3c7f8
Summary:
If border radius is not set or is zero, then elevation will not
work properly. This bug seems to have been introduced when the
style in facebook/react-native#4180 was modified slightly to
produce commit b65f1f2234.
Closes https://github.com/facebook/react-native/pull/4555
Reviewed By: svcscm
Differential Revision: D2741203
Pulled By: mkonicek
fb-gh-sync-id: f4ee9ccdfc64374d58824a6e988409ac2b7532a4
Summary:
public
- Open source the unit test for `ClipboardModule`, start using the `ReactTestHelper` in two unit tests
- Fixes a few references to "pasteboard" in strings
Reviewed By: bestander
Differential Revision: D2739614
fb-gh-sync-id: e076940a3ae5c22314e181a37fe2c3f77a18cf85
Summary:
Functions from the path module return paths with the native file system path separator. generateAssetModule is using path.join and path.dirname to generate httpServerLocation. That means that on Windows systems, the generated URL path has backslashes rather than forward slashes which breaks the app's ability to retrieve image assets using require('./image.png'). This change fixes this by checking path.sep and replacing backslashes with slashes on systems that require it.
Closes https://github.com/facebook/react-native/pull/4416
Reviewed By: svcscm
Differential Revision: D2740529
Pulled By: mkonicek
fb-gh-sync-id: edae0f6762c7dc1db7af078209e38a2feab1e0a1
Summary:
Needed to support tagged template literals (which are already enabled in babel). Not having this helper means we get a runtime crash.
Closes https://github.com/facebook/react-native/pull/4680
Reviewed By: svcscm
Differential Revision: D2740233
Pulled By: spicyj
fb-gh-sync-id: 12729f670b7942ad7a04bd50ae1eca35d2b1e410
Summary:
public
Use the actual timestamp provided through `CADisplayLink` instead of the time
the handler is called.
Reviewed By: jspahrsummers
Differential Revision: D2739121
fb-gh-sync-id: 1da28190bb25351dc3dd94efaff21d49279a570f
Summary:
public
More people wanted to understand the motivation behind the intentional retain
cycle in `RCTJavaScriptContext`, add a small comment with some context.
Reviewed By: jspahrsummers
Differential Revision: D2738930
fb-gh-sync-id: d8c950778eb6bf3eaca627aabb6c98335d25d1fc
Summary:
When you did a typo in declaring a prop type (like using `boolean` insteal of `bool`) you'd got a bit misleading error message:
{F27113768}
The truth is that the prop type is defined, but not correctly. So I've changed the message in this case to be more accurate:
{F27113627}
public
Reviewed By: sahrens
Differential Revision: D2729340
fb-gh-sync-id: dd12c10a4f3a1c9825293f86481a082908127a76
Summary:
The JavaScript ecosystem doesn't have the notion of a built-in native module loader. Even Node is decoupled from its module loader. The module loader system is just JS that runs on top of the global `process` object which has all the built-in goodies.
Additionally there is no such thing as a global require. That is something unique to our providesModule system. In other module systems such as node, every require is contextual. Even registered npm names are localized by version.
The only global namespace that is accessible to the host environment is the global object. Normally module systems attaches itself onto the hooks provided by the host environment on the global object.
Currently, we have two forms of dispatch that reaches directly into the module system. executeJSCall which reaches directly into require. Everything now calls through the BatchedBridge module (except one RCTLog edge case that I will fix). I propose that the executors calls directly onto `BatchedBridge` through an instance on the global so that everything is guaranteed to go through it. It becomes the main communication hub.
I also propose that we drop the dynamic requires inside of MessageQueue/BatchBridge and instead have the modules register themselves with the bridge.
executeJSCall was originally modeled after the XHP equivalent. The XHP equivalent was designed that way because the act of doing the call was the thing that defined a dependency on the module from the page. However, that is not how React Native works.
The JS side is driving the dependencies by virtue of requiring new modules and frameworks and the existence of dependencies is driven by the JS side, so this design doesn't make as much sense.
The main driver for this is to be able to introduce a new module system like Prepack's module system. However, it also unlocks the possibility to do dead module elimination even in our current module system. It is currently not possible because we don't know which module might be called from native.
Since the module system now becomes decoupled we could publish all our providesModule modules as npm/CommonJS modules using a rewrite script. That's what React Core does.
That way people could use any CommonJS bundler such as Webpack, Closure Compiler, Rollup or some new innovation to create a JS bundle.
This diff expands the executeJSCalls to the BatchedBridge's three individual pieces to make them first class instead of being dynamic. This removes one layer of abstraction. Hopefully we can also remove more of the things that register themselves with the BatchedBridge (various EventEmitters) and instead have everything go through the public protocol. ReactMethod/RCT_EXPORT_METHOD.
public
Reviewed By: vjeux
Differential Revision: D2717535
fb-gh-sync-id: 70114f05483124f5ac5c4570422bb91a60a727f6
Summary:
public
Introduce a new Polyfill module to load bundles. This polyfill contains the function to which System.import gets transformed into. It works similarly to require in the way it's registered. It keeps track of the bundles that have ever been requested using promises, either fulfilled or not. The use of promises makes the implementation quite easy as we don't need to differenciate whether the request has been started or not.
There're a couple of follow up steps that still need to get done:
- Included this polyfill on the ones we automatically include on the bundle.
- Modify the transform to include the modules the user is actually requesting and pipe that through loadBundles so that the promise, once resolved, has the ordered list of modules the user requested.
- Implement the actual native code that loads a bundle. This shouldn't be that taught as native will be able to assume it will never receive the same request twice.
Reviewed By: davidaurelio
Differential Revision: D2727241
fb-gh-sync-id: 317d80754783caf43f10c71a34a4558a4d298d45
Summary:
In order to be able to reliable identify unbundles when loading files, prepend a magic number (0xFB0BD1E5)
public
Reviewed By: martinbigio
Differential Revision: D2734359
fb-gh-sync-id: b469e26459234e7f6270fffa0b872a93d137381d
Summary:
Fixes#4602
Fixes a bug where the app crashes when you try to inspect a stateless
component.
Fixed by replacing all occurrences of the getPublicInstance method in
Libraries/Inspector/Inspector.js with the _instance property instead.
Defaults to an empty object if _instance is falsy.
Closes https://github.com/facebook/react-native/pull/4642
Reviewed By: svcscm
Differential Revision: D2734491
Pulled By: androidtrunkagent
fb-gh-sync-id: 4ea753b7e0ef3fd05af2d80abadc365c5c787f98
Summary:
- PickerIOS accepts now a new prop: style
- this prop modifies the native style of the RCTPicker allowing to modify the font size of the items (fontSize), color of the items (color, only 6 char HEX values for now) and alignment of the items (textAlign)
Closes https://github.com/facebook/react-native/pull/4490
Reviewed By: svcscm
Differential Revision: D2723190
Pulled By: nicklockwood
fb-gh-sync-id: ab9188192f1d0d087787dfed8c128073bfaa3235
Summary:
public
The +[RCTConvert UIImage:] function, while convenient, is inherently limited by being synchronous, which means that it cannot be used to load remote images, and may not be efficient for local images either. It's also unable to access the bridge, which means that it cannot take advantage of the modular image-loading pipeline.
This diff introduces a new RCTImageSource class which can be used to pass image source objects over the bridge and defer loading until later.
I've also added automatic application of the `resolveAssetSource()` function based on prop type, and fixed up the image logic in NavigatorIOS and TabBarIOS.
Reviewed By: javache
Differential Revision: D2631541
fb-gh-sync-id: 6604635e8bb5394425102487f1ee7cd729321877
Summary:
public
Most apps create tons of text components but they are actually quite heavy because of the the Touchable mixin which requires binding tons of functions for every instance created.
This diff makes the binding lazy, so that the main handlers are only bound if there is a valid touch action configured (e.g. onPress), and the Touchable mixin functions are only bound the first time the node is actually touched and becomes the responder.
ScanLab testing shows 5-10% win on render time and memory for various products.
Reviewed By: sebmarkbage
Differential Revision: D2716823
fb-gh-sync-id: 30adb2ed2231c5635c9336369616cf31c776b930