Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
b05e99a
[Flow] Fix or suppress react-native github errors for Flow v0.12.0
gabelevi Jun 10, 2015
f848241
[AdsManager] Improve animation configurations
Jun 11, 2015
61c1631
[Pods] Define a subspec for LinkingIOS
Jun 11, 2015
2ee8410
Removed nullability attributes until Infer supports them
nicklockwood Jun 11, 2015
492e29a
[ReactNative] backout orange box
sahrens Jun 11, 2015
dcf15f8
[ReactNative] Fix racing condition on RCTDataManager
tadeuzagallo Jun 11, 2015
ae9e408
[ReactNative] Revert packager ignoring node_modules
tadeuzagallo Jun 11, 2015
04b3b52
Add map type property (standard, satellite, hybrid) to MapView.
adamkrell Jun 11, 2015
2880f1a
Fixed arguments to StatusBarIOS.setStyle in the NavigatorIOSColorExample
prathamesh-sonpatki Jun 11, 2015
dca0192
[ReactNative] XHR FormData upload example
philikon Jun 10, 2015
f0bba0c
[RN|madman] init AppStateIOS.currentState with 'active'
zjj010104 Jun 11, 2015
1b9067a
[ReactNative] PushNotificationIOS listener Map
Jun 11, 2015
1590741
[ReactNative] refactor the inspector
Jun 11, 2015
c87158d
[Flow] Deploy v0.12.0
mroch Jun 11, 2015
66c7511
[Flow] Fix or suppress last minute errors for 0.12.0
gabelevi Jun 12, 2015
394cc66
[TicTacToe] Fix missing image styles for TicTacToe example
rustyconover Jun 12, 2015
86d4f4e
[WebSocket] Reason can be null which causes an exception with NSDicti…
vishnevskiy Jun 12, 2015
95050e4
Fix missing types in XHRExample
mroch Jun 12, 2015
3ff6abb
[react_native] JS files from D2139723: [react_native] Set WebView…
andreicoman11 Jun 12, 2015
696b31f
[ReactNative] Fix memory leak in RCTContextExecutor
tadeuzagallo Jun 12, 2015
2a7adfb
[ReactNative] Use RCTNullIfNill and (id)kCFNull
tadeuzagallo Jun 12, 2015
6b621a5
[Idea: ScrollView] Add `getScrollResponder` to ScrollView for composi…
ide Jun 12, 2015
1c5053b
[ReactNative] Export EdgeInsetsPropType and PointPropType
ide Jun 12, 2015
5efc1b4
Fixed text layout on screen rotation
nicklockwood Jun 12, 2015
098a116
Expose PointerEventsExample to Android
andreicoman11 Jun 12, 2015
32f895a
[ReactNative] NetInfo listener Map
Jun 12, 2015
781b17f
[ReactNative] include stack in native redboxes
sahrens Jun 12, 2015
efd386e
[ReactNative] Fix timers for debugger executors
tadeuzagallo Jun 13, 2015
0d00a0e
Updates from Mon 15 Jun
tadeuzagallo Jun 15, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Examples/UIExplorer/UIExplorerList.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ var COMMON_APIS = [
require('./GeolocationExample'),
require('./LayoutExample'),
require('./PanResponderExample'),
require('./PointerEventsExample'),
];

if (Platform.OS === 'ios') {
Expand Down Expand Up @@ -80,7 +81,6 @@ if (Platform.OS === 'ios') {
require('./CameraRollExample.ios'),
require('./LayoutEventsExample'),
require('./NetInfoExample'),
require('./PointerEventsExample'),
require('./PushNotificationIOSExample'),
require('./StatusBarIOSExample'),
require('./TimerExample'),
Expand Down
24 changes: 15 additions & 9 deletions Libraries/Network/NetInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*/
'use strict';

var Map = require('Map');
var NativeModules = require('NativeModules');
var Platform = require('Platform');
var RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');
Expand Down Expand Up @@ -140,30 +141,32 @@ type ConnectivityStateAndroid = $Enum<{
* ```
*/

var _subscriptions = {};
var _subscriptions = new Map();

var NetInfo = {
addEventListener: function (
eventName: ChangeEventName,
handler: Function
): void {
_subscriptions[String(handler)] = RCTDeviceEventEmitter.addListener(
var listener = RCTDeviceEventEmitter.addListener(
DEVICE_REACHABILITY_EVENT,
(appStateData) => {
handler(appStateData.network_reachability);
}
);
_subscriptions.set(handler, listener);
},

removeEventListener: function(
eventName: ChangeEventName,
handler: Function
): void {
if (!_subscriptions[String(handler)]) {
var listener = _subscriptions.get(handler);
if (!listener) {
return;
}
_subscriptions[String(handler)].remove();
_subscriptions[String(handler)] = null;
listener.remove();
_subscriptions.delete(handler);
},

fetch: function(): Promise {
Expand Down Expand Up @@ -197,30 +200,33 @@ if (Platform.OS === 'ios') {
};
}

var _isConnectedSubscriptions = {};
var _isConnectedSubscriptions = new Map();

NetInfo.isConnected = {
addEventListener: function (
eventName: ChangeEventName,
handler: Function
): void {
_isConnectedSubscriptions[String(handler)] = (connection) => {
var listener = (connection) => {
handler(_isConnected(connection));
};
_isConnectedSubscriptions.set(handler, listener);
NetInfo.addEventListener(
eventName,
_isConnectedSubscriptions[String(handler)]
listener
);
},

removeEventListener: function(
eventName: ChangeEventName,
handler: Function
): void {
var listener = _isConnectedSubscriptions.get(handler);
NetInfo.removeEventListener(
eventName,
_isConnectedSubscriptions[String(handler)]
listener
);
_isConnectedSubscriptions.delete(handler);
},

fetch: function(): Promise {
Expand Down
8 changes: 4 additions & 4 deletions Libraries/Text/RCTShadowText.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ - (void)applyLayoutNode:(css_node_t *)node

- (NSTextStorage *)buildTextStorageForWidth:(CGFloat)width
{
UIEdgeInsets padding = self.paddingAsInsets;
width -= (padding.left + padding.right);

if (_cachedTextStorage && width == _cachedTextStorageWidth) {
return _cachedTextStorage;
}
Expand All @@ -92,16 +95,13 @@ - (NSTextStorage *)buildTextStorageForWidth:(CGFloat)width
textContainer.lineFragmentPadding = 0.0;
textContainer.lineBreakMode = _numberOfLines > 0 ? NSLineBreakByTruncatingTail : NSLineBreakByClipping;
textContainer.maximumNumberOfLines = _numberOfLines;

UIEdgeInsets padding = self.paddingAsInsets;
width -= (padding.left + padding.right);
textContainer.size = (CGSize){isnan(width) ? CGFLOAT_MAX : width, CGFLOAT_MAX};

[layoutManager addTextContainer:textContainer];
[layoutManager ensureLayoutForTextContainer:textContainer];

_cachedTextStorage = textStorage;
_cachedTextStorageWidth = width;
_cachedTextStorage = textStorage;

return textStorage;
}
Expand Down
9 changes: 9 additions & 0 deletions Libraries/WebSocket/RCTWebSocketExecutor.m
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,15 @@ - (void)injectJSONText:(NSString *)script asGlobalObjectNamed:(NSString *)object
}

- (void)executeBlockOnJavaScriptQueue:(dispatch_block_t)block
{
if ([NSThread isMainThread]) {
block();
} else {
dispatch_async(dispatch_get_main_queue(), block);
}
}

- (void)executeAsyncBlockOnJavaScriptQueue:(dispatch_block_t)block
{
dispatch_async(dispatch_get_main_queue(), block);
}
Expand Down
17 changes: 16 additions & 1 deletion React/Base/RCTLog.m
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,22 @@ void _RCTLogFormat(

// Log to red box
if (level >= RCTLOG_REDBOX_LEVEL) {
[[RCTRedBox sharedInstance] showErrorMessage:message];
NSArray *stackSymbols = [NSThread callStackSymbols];
NSMutableArray *stack = [NSMutableArray arrayWithCapacity:(stackSymbols.count - 1)];
[stackSymbols enumerateObjectsUsingBlock:^(NSString *frameSymbols, NSUInteger idx, BOOL *stop) {
if (idx != 0) { // don't include the current frame
NSString *address = [[frameSymbols componentsSeparatedByString:@"0x"][1] componentsSeparatedByString:@" "][0];
NSRange addressRange = [frameSymbols rangeOfString:address];
NSString *methodName = [frameSymbols substringFromIndex:(addressRange.location + addressRange.length + 1)];
if (idx == 1) {
NSString *file = [[@(fileName) componentsSeparatedByString:@"/"] lastObject];
stack[0] = @{@"methodName": methodName, @"file": file, @"lineNumber": @(lineNumber)};
} else {
stack[idx - 1] = @{@"methodName": methodName};
}
}
}];
[[RCTRedBox sharedInstance] showErrorMessage:message withStack:stack];
}

// Log to JS executor
Expand Down
24 changes: 9 additions & 15 deletions React/Executors/RCTWebViewExecutor.m
Original file line number Diff line number Diff line change
Expand Up @@ -182,25 +182,19 @@ - (void)executeApplicationScript:(NSString *)script
[_webView loadHTMLString:runScript baseURL:url];
}

/**
* In order to avoid `UIWebView` thread locks, all JS executions should be
* performed outside of the event loop that notifies the `UIWebViewDelegate`
* that the page has loaded. This is only an issue with the remote debug mode of
* `UIWebView`. For a production `UIWebView` deployment, this delay is
* unnecessary and possibly harmful (or helpful?)
*
* The delay might not be needed as soon as the following change lands into
* iOS7. (Review the patch linked here and search for "crash"
* https://bugs.webkit.org/show_bug.cgi?id=125746).
*/
- (void)executeBlockOnJavaScriptQueue:(dispatch_block_t)block
{
dispatch_time_t when = dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_MSEC);

dispatch_after(when, dispatch_get_main_queue(), ^{
RCTAssertMainThread();
if ([NSThread isMainThread]) {
block();
});
} else {
dispatch_async(dispatch_get_main_queue(), block);
}
}

- (void)executeAsyncBlockOnJavaScriptQueue:(dispatch_block_t)block
{
dispatch_async(dispatch_get_main_queue(), block);
}

/**
Expand Down
5 changes: 5 additions & 0 deletions React/Modules/RCTTiming.m
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,11 @@ - (void)didUpdateFrame:(RCTFrameUpdate *)update
NSTimeInterval jsSchedulingOverhead = -jsSchedulingTime.timeIntervalSinceNow;
if (jsSchedulingOverhead < 0) {
RCTLogWarn(@"jsSchedulingOverhead (%ims) should be positive", (int)(jsSchedulingOverhead * 1000));

/**
* Probably debugging on device, set to 0 so we don't ignore the interval
*/
jsSchedulingOverhead = 0;
}

NSTimeInterval targetTime = jsDuration - jsSchedulingOverhead;
Expand Down
4 changes: 1 addition & 3 deletions React/Modules/RCTUIManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,7 @@ - (void)setFrame:(CGRect)frame forRootView:(UIView *)rootView
rootShadowView.frame = frame;
[rootShadowView updateLayout];

RCTViewManagerUIBlock uiBlock = [self uiBlockWithLayoutUpdateForRootView:rootShadowView];
[self addUIBlock:uiBlock];
[self flushUIBlocks];
[self batchDidComplete];
});
}

Expand Down