Summary:
Added Gzip function to RCTUtils. This uses dlopen to load the zlib library at runtime so there's no need to link it into your project.
The main reason for this feature is to support gzipping of HTTP request bodies. Now, if you add 'Content-Encoding:gzip' to your request headers when using XMLHttpRequest, your request body will be automatically gzipped on the native side before sending.
(Note: Gzip decoding of *response* bodies is handled automatically by iOS, and was already available).
Summary:
Infinite scrolling in horizontal ListViews. Rather than just using height and Y offset to determine when to load more rows, it checks `props.horizontal` and switches between width/height and offset X/Y accordingly.
This changed required some renaming. However, the only change external to `ListView.js` is exporting `contentSize` instead of `contentHeight` from the `getMetrics()` function. (This is not part of the API, but is used "for perf investigations or analytics" and isn't reference in the repo).
I believe this change works as expected (and the xcode tests pass) though it's possible that there may more complexity in this issue that I have overlooked.
Closes https://github.com/facebook/react-native/pull/1786
Github Author: Mr Speaker <mrspeaker@gmail.com>
Summary:
Clicking on a TextField with editable set to false still would trigger a keyboard event.
In this case that the TextField was a multiline, it would scroll you down to the bottom.
Closes https://github.com/facebook/react-native/pull/1855
Github Author: Christopher <hello@blick-labs.com>
Summary:
Remove `RCTGetExecutorID` and `RCTSetExecutorID`, it wasn't used anymore since
the bridge was refactored into `RCTBridge` and `RCTBatchedBridge`.
Summary:
onItemRef is old and no longer needed now that the parent renders the scenes. This removes it from Navigator and all of our clients.
This is a breaking change to users of Navigator, but it is easy to transition to a ref in renderScene instead
Summary:
RCTImageDownloader was ignoring server response codes. When receiving a response other than 200 it would treat this as success, meaning the image would never load, nor report failure.
This diff fixes that by treating responses with non-200 status as an error so that error handler is called.
Summary:
These are the changes needed for full interop with the (as yet unreleased) new
version of React Devtools.
- the on-device inspector is minimized when devtools is open
- devtools highlight -> device and device touch -> devtools select works
- editing react native styles :)
Summary:
Add local notifications to the push library.
```
var PushNotificationIOS = React.PushNotificationIOS;
PushNotificationIOS.requestPermissions();
var notification = {
"fireDate": Date.now() + 10000,
"alertBody":"Whats up pumpkin"
};
PushNotificationIOS.scheduleLocalNotification(notification);
//lock screen or move away from app
```
Apple has another api for pushing immediately instead of scheduling, like when your background delegate has been called with some new data (bluetooth, location, etc)
```
var PushNotificationIOS = React.PushNotificationIOS;
PushNotificationIOS.requestPermissions();
var notification = {
"alertBody":"Whats up pumpkin"
};
PushNotificationIOS.presentLocalNotification(notification);
//lock screen or move away from app
```
Closed https://github.com/facebook/react-native/pull/843 looks related:
See https://developer.apple.com/library/ios/documentation/iPhone/Reference/UILocalNotification_Class/ for much more available in
Closes https://github.com/facebook/react-native/pull/1616
Github Author: Jacob Rosenthal <jakerosenthal@gmail.com>
Summary:
To be on par with NavigatorIOS, I added the translucent property to TabBarIOS.
Usage:
```
<TabBarIOS
translucent={false} // default is true
/>
```
Closes https://github.com/facebook/react-native/pull/1937
Github Author: Jean Regisser <jean.regisser@gmail.com>
Summary:
Merged RCTStaticImage with our internal RKStaticImage and ported over logic where assets are loaded at the optimal size and reloaded if the view size changes.
Summary:
Dynamic Text Sizes for Text component.
Text gains new prop - allowFontScaling (true by default).
There is also AccessibilityManager module that allows you to tune multipliers per each content size category, but predefined multipliers are there.
This could potentially break some apps so please test carefully.
Summary:
When composing scroll views, `this.refs[SCROLLVIEW_REF]` may refer to another higher-order scroll component instead of a ScrollView. This can cause issues if you expect to need it to be a ScrollView backed by an RCTScrollView.
The solution is to call `getScrollResponder()` - as long as all higher-order scroll components implement this method, it will make its way down to the true ScrollView, which is what ListView wants here.
Closes https://github.com/facebook/react-native/pull/1927
Github Author: James Ide <ide@jameside.com>
Summary:
Remote images now support the `tintColor` prop.
Also picked nicer demo colors for the UIExplorer example.
Fixes#1867
Closes https://github.com/facebook/react-native/pull/1932
Github Author: James Ide <ide@jameside.com>
Summary:
Change `RCTImageDownloader` so it stores the `RCTDownloadTaskWrapper` for reuse. Modify `RCTDownloadTaskWrapper` to use associated objects to store the completion/progress blocks.
Summary:
This PR adds 4 native events to NetworkImage.
![demo](http://zippy.gfycat.com/MelodicLawfulCaecilian.gif)
Using these events I could wrap `Image` component into something like:
```javascript
class NetworkImage extends React.Component {
getInitialState() {
return {
downloading: false,
progress: 0
}
}
render() {
var loader = this.state.downloading ?
<View style={this.props.loaderStyles}>
<ActivityIndicatorIOS animating={true} size={'large'} />
<Text style={{color: '#bbb'}}>{this.state.progress}%</Text>
</View>
:
null;
return <Image source={this.props.source}
onLoadStart={() => this.setState({downloading: true}) }
onLoaded={() => this.setState({downloading: false}) }
onLoadProgress={(e)=> this.setState({progress: Math.round(100 * e.nativeEvent.written / e.nativeEvent.total)});
onLoadError={(e)=> {
alert('the image cannot be downloaded because: ', JSON.stringify(e));
this.setState({downloading: false});
}}>
{loader}
</Image>
}
}
```
Useful on slow connections and server errors.
There are dozen lines of Objective C, which I don't have experience with. There are neither specific tests nor documentation yet. And I do realize that you're already working right now on better `<Image/>` (pipeline, new asset management, etc.). So this is basically a proof concept of events for images, and if this idea is not completely wrong I could improve it or help somehow.
Closes https://github.com/facebook/react-native/pull/1318
Github Author: Dmitriy Loktev <unknownliveid@hotmail.com>
Summary:
Get the system font instead of Helvetica programmatically and add a virtual fontName called "System" that defaults to whatever the current system font is.
#1611
Closes https://github.com/facebook/react-native/pull/1635
Github Author: LYK <dalinaum@gmail.com>
Summary:
Introducing the data structure NavigationRouteStack that focused on managing
navigation routes stack.
The goal is to make <Navigatior /> thinner by moving stack management logic into
its own class and make sure it's well-tested.
Teh next step will be cleaning up <Navigatior /> and add `NavigationRouteStack` to
`NavigationContext`.
Summary:
A minor improvement suggestion: `Navigator.getCurrentRoutes()` probably shouldn't return its `routeStack` backing array as-is, because the caller may mutate it, causing the internal state of the navigator to go out of sync. Instead a shallow copy of the routes should be returned.
I stumbled on this problem in my app by attempting to read the navigator state as follows:
```
let routes = Navigator.getCurrentRoutes();
let current = routes.pop();
let previous = routes.pop();
```
Which led to an exception at next navigation event.
CLA signed.
Closes https://github.com/facebook/react-native/pull/1888
Github Author: Jani Evakallio <jani.evakallio@gmail.com>
Summary:
As discussed with @nicklockwood in the issue https://github.com/facebook/react-native/issues/1780, the error should be changed to a warning to not break fetch() to send a POST to a remote API without wanting to parse the reply. E.g. google sends back an empty 1x1px gif when POSTing something to google analytics.
Closes https://github.com/facebook/react-native/pull/1860
Github Author: "philipp.krone" <kronep@googlemail.com>
Summary:
The `ScrollView` component tells the native side the subview indices of the views to make sticky. The problem is that, once layout-only views are collapsed, the indices are no longer reflective of the original views to make stick to the top.
Summary:
This enables code like:
```js
<ListView renderScrollView={() => <CustomScrollView />} />
```
where CustomScrollView might be inverted or support pull-to-refresh, etc.
Closes https://github.com/facebook/react-native/pull/785
Github Author: James Ide <ide@jameside.com>
Summary:
Android WebView now supports the prop "injectedJavaScript", too.
It's time to rename "injectedJavascriptIOS" to "injectedJavaScript" for API
consistency between IOS and Android.
Summary:
Trivial change to fix the lowercase response headers set for XHR responses.
What would happen is the first iterated header wouldn't be part of `_lowerCaseResponseHeaders`.
Also it would mutate the original `responseHeaders` object, mixing lowercase headers with the original values.
Closes https://github.com/facebook/react-native/pull/1876
Github Author: Jean Regisser <jean.regisser@gmail.com>
Summary:
This is most of the infra necessary for the gratuitous animation demo app.
I originally had things more split up, but it was just confusing because everything is so interlinked and dependent, so lower diffs would have code that wasn't even going to survive (and thus not useful to review), so I merged it all here.
- `Animated.event` now supports mapping to multiple arguments (needed for `onPanResponderMove` events which provide the `gestureState` as the second arg.
- Vectors: new `Animated.ValueXY` class which composes two `Animated.Value`s for convenience/brevity
- Listeners: values and events can be listened to in order to trigger state updates based on their values. Intended to work as async updates from native that might lag behind truth.
- Offsets: a common pattern with pan and other gestures is to track where you left off. This is easily encoded in the Value directly with `setOffset(offset)`, typically used on grant, and can be flattened back into the base value and reset with `flattenOffset()`, typically called on release.
- Tracking: supports `Animated.Value/ValueXY` for `toValue` with all animations, enabling linking multiple values together with some curve or physics. `Animated.timing` can be used with `duration: 0` to rigidly link the values with no lag, or `Animated.spring` can be used to link them like chat heads.
- `Animated.Image` as a default export.
- Various cleanup, bug, flow and lint fixes.
Summary:
This introduces a new `RCTResponseErrorBlock` block type that allows a bridge module writer to call it with an `NSError` instance rather than a dictionary.
Summary: At the moment the `ListView.js` `_childFrames` variable is only updated on scroll. As a consequence, `onChangeVisibleRows` won't get triggered for the initial render, nor any future render not trigered by scroll events. To fix this we need to make sure native and JS have the child frames in sync.
Summary:
Remove layout-only views. Works by checking properties against a list of known properties that only affect layout. The `RCTShadowView` hierarchy still has a 1:1 correlation with the JS nodes.
This works by adjusting the tags and indices in `manageChildren`. For example, if JS told us to insert tag 1 at index 0 and tag 1 is layout-only with children whose tags are 2 and 3, we adjust it so we insert tags 2 and 3 at indices 0 and 1. This keeps changes out of `RCTView` and `RCTScrollView`. In order to simplify this logic, view moves are now processed as view removals followed by additions. A move from index 0 to 1 is recorded as a removal of view at indices 0 and 1 and an insertion of tags 1 and 2 at indices 0 and 1. Of course, the remaining indices have to be offset to take account for this.
The `collapsible` attribute is a bit of a hack to force `RCTScrollView` to always have one child. This was easier than rethinking out the logic there, but we could change this later.
Summary:
@tadeuzagallo - We discussed this ~a week ago when I was putting together the 0.7.0-rc release, only got around to creating the PR for it now so it's properly sync'd.
Closes https://github.com/facebook/react-native/pull/1865
Github Author: Brent Vatne <brentvatne@gmail.com>
Summary:
No longer check for the `ASIdentifierManager` class. Since we only target iOS 7.0 and up, this is unnecessary. Instead, we should check for whether the `advertisingIdentifier` is non-nil. If it is, we send it; otherwise we send an error.
Summary:
If you try to create a cached response from a nil response the app will crash. Looking at the code that uses NSURLSession and NSURLCache, this fix looks correct to me.
Fixes#1850
Closes https://github.com/facebook/react-native/pull/1852
Github Author: James Ide <ide@jameside.com>
Summary:
Having bugs in Groups because POPAnimation experiences a race condition. This hack avoids that for now while we transition away from POPAnimation altogether.
Summary:
@public
The API and implementation of `shouldInjectAJAXHandler` is very opinionated, and it does not solve many of the use cases that we'd like to address.
Since `shouldInjectAJAXHandler` is basically juts injecting JS to the web page, we should let developer inject whatever JS that address different issues that they want to fix.
Test Plan:
Test this snippet at <Playground />
```
<WebView
url="http://www.facebook.com"
injectedJavascriptIOS="document.body.style.border='solid 10px red'"
/>
```
Summary:
Fixes a crash due to the selector regex not knowing about the nullability annotations. Adds support for both the core annotations `__nullable` and `__nonnull` plus their shorthand counterparts `nullable` and `nonnull`.
Objective-C allows the shorthand versions only at the front of a parameter type declaration like `(nullable NSString *)` but the regex will pick up `(NSString * nullable)` too. This shouldn't cause any adverse effects and I left the code this way to keep the regex readable.
Fixes#1795
Closes https://github.com/facebook/react-native/pull/1796
Github Author: James Ide <ide@jameside.com>
Test Plan:
Wrote a bridge method that uses a nullability annotation and verified that it didn't cause the app to crash:
```
RCT_EXPORT_METHOD(method:(nullable NSNumber *)reactTag)
{
}
```
Also added a nullable annotation to RCTTest.
Summary:
@public
Less verbose - now can just do `LayoutAnimation.easeInEaseOut()` instead of
`LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut)`
Test Plan: D2171336, play with AdsManager pickers.
Summary:
When `UIManager.measure` is called from `componentDidMount` it causes the error "Attempted to measure layout but offset or dimensions were NaN". Deferring the layout by one frame solves this problem. Layout measurement is already asynchronous anyway, so I believe adding the `requestAnimationFrame` call doesn't affect the program's correctness.
Fixes#1749
Closes https://github.com/facebook/react-native/pull/1750
Github Author: James Ide <ide@jameside.com>
Test Plan:
Load UIExplorer and no longer get a redbox that says "Attempted to measure layout but offset or dimensions were NaN".
Summary:
Hi,
I've updated the NavigatorIOS component to allow setting the translucent property.
usage is:
```
<NavigatorIOS
translucent={false}
/>
```
This is my first contrib to react-native, so apologies if I've missed something.
Cheers,
Owen
Closes https://github.com/facebook/react-native/pull/1273
Github Author: Owen Kelly <owen@novede.com>
Test Plan: Imported from GitHub, without a `Test Plan:` line.
Summary:
This makes sure to call willFocus before new scenes get mounted. This fixes cases where the keyboard is dismissed on willfocus events which incorrectly happens *after* the autofocus in a new scene. The keyboard was opening and getting immediately closed
@public
Test Plan: Test keyboard autofocus in new nav scenes on iOS
Summary:
Updating range is too complicated. We can keep cached versions of the previously rendered scenes in a map.
@public
Test Plan: Verify that the active scene is the only thing that get re-rendered, and that rendering doesn't happen during transitions or gestures. Test navigation thouroughly in AdsManager
Summary:
@public
After refactoring the MessageQueue a guard was missing on around `batchedUpdates`
call.
Test Plan: Introduce an error on `getInitialState` of `AdsManagerTabsModalView.ios.js`
Summary:
This adds the Keyboard animation type for when you want to animate UI based on the keyboard appearing/disappearing.
Closes https://github.com/facebook/react-native/pull/1366
Github Author: Stanislav Vishnevskiy <vishnevskiy@gmail.com>
Test Plan: Imported from GitHub, without a `Test Plan:` line.
Summary:
Started from here - https://github.com/facebook/react-native/issues/1120. Most functionality for annotations were missing so I started implementing and somehow got caught up until the entire thing was done.
![screen shot 2015-05-12 at 10 07 43 pm](https://cloud.githubusercontent.com/assets/688326/7588677/8479a7a4-f8f9-11e4-99a4-1dc3c7691810.png)
2 new events:
- callout presses (left / right)
- annotation presses
6 new properties for annotations:
- hasLeftCallout
- hasRightCallout
- onLeftCalloutPress
- onRightCalloutPress
- animateDrop
- id
1 new property for MapView
- onAnnotationPress
---
Now the important thing is, that I implemented all of this the way "I would do it". I am not sure this is the 'reacty' way so please let me know my mistakes 😄
The problem is that there is no real way to identify annotations which makes it difficult to distinguish which one got clicked. The idea is to pass a `id` and whether it has callouts the entire way with the annotation. I had to
Closes https://github.com/facebook/react-native/pull/1247
Github Author: David Mohl <me@dave.cx>
Test Plan: Imported from GitHub, without a `Test Plan:` line.
Summary:
Remove layout-only views. Works by checking properties against a list of known properties that only affect layout. The `RCTShadowView` hierarchy still has a 1:1 correlation with the JS nodes.
This works by adjusting the tags and indices in `manageChildren`. For example, if JS told us to insert tag 1 at index 0 and tag 1 is layout-only with children whose tags are 2 and 3, we adjust it so we insert tags 2 and 3 at indices 0 and 1. This keeps changes out of `RCTView` and `RCTScrollView`. In order to simplify this logic, view moves are now processed as view removals followed by additions. A move from index 0 to 1 is recorded as a removal of view at indices 0 and 1 and an insertion of tags 1 and 2 at indices 0 and 1. Of course, the remaining indices have to be offset to take account for this.
The `collapsible` attribute is a bit of a hack to force `RCTScrollView` to always have one child. This was easier than rethinking out the logic there, but we could change this later.
@public
Test Plan: There are tests in `RCTUIManagerTests.m` that test the tag- and index-manipulation logic works. There are various scenarios including add-only, remove-only, and move. In addition, two scenario tests verify that the optimization works by checking the number of views and shadow views after various situations happen.
Summary:
Now `RCTAnimationExperimentalManager` is not working on 32bit devices.
```
NSValue *fromValue = [view.layer.presentationLayer valueForKeyPath:keypath];
CGFloat fromFields[count];
[fromValue getValue:fromFields];
```
If the fromValue is kind of double value which needs two bytes in 32bit device and the count is 1, the fromFileds array will go wrong.
Closes https://github.com/facebook/react-native/pull/1725
Github Author: =?UTF-8?q?=E9=9A=90=E9=A3=8E?= <yinfeng.fcx@alibaba-inc.com>
Test Plan: Imported from GitHub, without a `Test Plan:` line.
Summary:
### TL/DR:
```
a="function() {return [22]}"
a.substring(a.indexOf("{")+1,a.indexOf("}")-1) // "return [22"
a.substring(a.indexOf("{")+1,a.indexOf("}")) // "return [22]"
```
### In long: why it is broken now and why it worked before:
I've installed latest iOS 9 and started to see really strange issues when code is minified:
```
Invariant Violation: Application app has not been registered."
2015-06-18 16:29:05.898 [error][tid:com.facebook.React.JavaScript] "Error: Unexpected identifier 'transformMatrix'. Expected ']' to end a subscript expression
```
After some investigation it turns out that new Safari returned a bit different string representation for a MatrixOps.unroll. On old safari:
`function(e,t,n,r,o,i,a,s,u,c,l,p,d,h,f,m,g){t=e[0],n=e[1],r=e[2],o=e[3],i=e[4],a=e[5],s=e[6],u=e[7],c=e[8],l=e[9],p=e[10],d=e[11],h=e[12],f=e[13],m=e[14],g=e[15];}`
while using latest iOS:
`function (e,t,n,r,o,i,a,s,u,c,l,p,d,h,f,m,g){t=e[0],n=e[1],r=e[2],o=e[3],i=e[4],a=e[5],s=e[6],u=e[7],c=e[8],l=e[9]
Closes https://github.com/facebook/react-native/pull/1672
Github Author: Artem Yarulin <artem.yarulin@fessguid.com>
Test Plan: Imported from GitHub, without a `Test Plan:` line.
Summary:
resizeMode is a native prop, but it is also in the propTypes, so this causes an incorrect warning:
```
Prop resizeMode = `contain` should not be set directly on Image.
```
@public
Test Plan: No warnings on image example in UIExplorer
Summary:
@public
If something changes in the list view that should trigger more loads, it
wouldn't. Example case is tap to load more - only the first new row would load,
but it wouldn't trigger a re-measure and subsequent layout of additional new
rows.
Test Plan: View More in Events works.
Summary:
@public
The current getter for `navigationContext` always return a static
context, and it should return an instance-based one, instead.
Test Plan:
Use console.log() in inspect that two different navigators do
have their own `navigationContext` created.