Compare commits

...
Author SHA1 Message Date
James Ide 917c0391ee [0.24.0-rc1] Bump version numbers 2016-04-05 11:32:13 -07:00
Nick Lockwood 6d25667654 Fix UIExplorer Image example on iOS
Reviewed By: javache

Differential Revision: D3138820

fb-gh-sync-id: 83bf3f6c60b80e9303b3c3a47dd5d05069623204
fbshipit-source-id: 83bf3f6c60b80e9303b3c3a47dd5d05069623204
2016-04-05 11:30:24 -07:00
Martin Kralik 33dde47ab5 make RCTEventDispatcher dispatch events in incoming order
Reviewed By: javache

Differential Revision: D3138215

fb-gh-sync-id: 430b57d7bb8e3f0f90877b627bfd6a842719ba5d
fbshipit-source-id: 430b57d7bb8e3f0f90877b627bfd6a842719ba5d
2016-04-05 11:30:24 -07:00
Martin Kralik c59475415c fixed coalescing key generation for RCTTouchEvent
Summary:Turns our using the same coalescing key until a person removes all fingers off screen is not ideal.
It doesn't work in a case where the first finger starts moving on screen and then a second finger joins it later (almost any pinch gesture),
since we would try to coalesce move events from the start when only one finger was touching screen with events where two fingers were moving on screen.
That doesn't work and results in a crash.

I've changed the logic for generating the coalescing key in order to prevent this.
We no longer have a single key for a single gesture, but we change the key each time amount of fingers increases ("touchStart") or decreases ("touchEnd").

Reviewed By: javache

Differential Revision: D3138275

fb-gh-sync-id: c32230ba401819fe3a70d1752b286d849520be89
fbshipit-source-id: c32230ba401819fe3a70d1752b286d849520be89
2016-04-05 11:30:24 -07:00
Janic Duplessis d457a18766 Fix HMR on Windows
Summary:Tested HMR on Windows and found 2 small issues related to paths that made it not work. Now it works nicely :)

**Test plan (required)**
Tested HMR in UIExplorer on Windows.
Closes https://github.com/facebook/react-native/pull/6678

Differential Revision: D3138379

fb-gh-sync-id: f27cd2fa21f95954685c8c6916d820f41bc187be
fbshipit-source-id: f27cd2fa21f95954685c8c6916d820f41bc187be
2016-04-05 11:30:24 -07:00
James Ide e8854b771e [0.24.0-rc] Bump version numbers 2016-04-04 12:39:23 -07:00
8 changed files with 52 additions and 33 deletions
+13 -10
View File
@@ -25,6 +25,7 @@
var React = require('react-native');
var {
Image,
Platform,
StyleSheet,
Text,
View,
@@ -425,16 +426,18 @@ exports.examples = [
source={image}
/>
</View>
<View style={styles.leftMargin}>
<Text style={[styles.resizeModeText]}>
Center
</Text>
<Image
style={styles.resizeMode}
resizeMode={Image.resizeMode.center}
source={image}
/>
</View>
{ Platform.OS === 'android' ?
<View style={styles.leftMargin}>
<Text style={[styles.resizeModeText]}>
Center
</Text>
<Image
style={styles.resizeMode}
resizeMode={Image.resizeMode.center}
source={image}
/>
</View>
: null }
</View>
</View>
);
+1 -1
View File
@@ -4,7 +4,7 @@ package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
Pod::Spec.new do |s|
s.name = "React"
s.version = package['version']
s.version = "0.24.0-rc1"
s.summary = package['description']
s.description = <<-DESC
React Native apps are built using the React JS
+17 -9
View File
@@ -39,9 +39,12 @@ static NSNumber *RCTGetEventID(id<RCTEvent> event)
@implementation RCTEventDispatcher
{
// We need this lock to protect access to _eventQueue and __eventsDispatchScheduled. It's filled in on main thread and consumed on js thread.
// We need this lock to protect access to _events, _eventQueue and _eventsDispatchScheduled. It's filled in on main thread and consumed on js thread.
NSLock *_eventQueueLock;
NSMutableDictionary *_eventQueue;
// We have this id -> event mapping so we coalesce effectively.
NSMutableDictionary<NSNumber *, id<RCTEvent>> *_events;
// This array contains ids of events in order they come in, so we can emit them to JS in the exact same order.
NSMutableArray<NSNumber *> *_eventQueue;
BOOL _eventsDispatchScheduled;
}
@@ -52,7 +55,8 @@ RCT_EXPORT_MODULE()
- (void)setBridge:(RCTBridge *)bridge
{
_bridge = bridge;
_eventQueue = [NSMutableDictionary new];
_events = [NSMutableDictionary new];
_eventQueue = [NSMutableArray new];
_eventQueueLock = [NSLock new];
_eventsDispatchScheduled = NO;
}
@@ -131,12 +135,14 @@ RCT_EXPORT_MODULE()
NSNumber *eventID = RCTGetEventID(event);
id<RCTEvent> previousEvent = _eventQueue[eventID];
id<RCTEvent> previousEvent = _events[eventID];
if (previousEvent) {
RCTAssert([event canCoalesce], @"Got event %@ which cannot be coalesced, but has the same eventID %@ as the previous event %@", event, eventID, previousEvent);
event = [previousEvent coalesceWithEvent:event];
} else {
[_eventQueue addObject:eventID];
}
_eventQueue[eventID] = event;
_events[eventID] = event;
BOOL scheduleEventsDispatch = NO;
if (!_eventsDispatchScheduled) {
@@ -170,13 +176,15 @@ RCT_EXPORT_MODULE()
- (void)flushEventsQueue
{
[_eventQueueLock lock];
NSDictionary *eventQueue = _eventQueue;
_eventQueue = [NSMutableDictionary new];
NSDictionary *events = _events;
_events = [NSMutableDictionary new];
NSMutableArray *eventQueue = _eventQueue;
_eventQueue = [NSMutableArray new];
_eventsDispatchScheduled = NO;
[_eventQueueLock unlock];
for (id<RCTEvent> event in eventQueue.allValues) {
[self dispatchEvent:event];
for (NSNumber *eventId in eventQueue) {
[self dispatchEvent:events[eventId]];
}
}
+2 -1
View File
@@ -234,7 +234,6 @@ static BOOL RCTAnyTouchesChanged(NSSet<UITouch *> *touches)
{
// If gesture just recognized, send all touches to JS as if they just began.
if (self.state == UIGestureRecognizerStateBegan) {
_coalescingKey++;
[self _updateAndDispatchTouches:_nativeTouches.set eventName:@"topTouchStart" originatingTime:0];
// We store this flag separately from `state` because after a gesture is
@@ -253,6 +252,7 @@ static BOOL RCTAnyTouchesChanged(NSSet<UITouch *> *touches)
{
[super touchesBegan:touches withEvent:event];
_coalescingKey++;
// "start" has to record new touches before extracting the event.
// "end"/"cancel" needs to remove the touch *after* extracting the event.
[self _recordNewTouches:touches];
@@ -278,6 +278,7 @@ static BOOL RCTAnyTouchesChanged(NSSet<UITouch *> *touches)
{
[super touchesEnded:touches withEvent:event];
_coalescingKey++;
if (_dispatchedInitialTouches) {
[self _updateAndDispatchTouches:touches eventName:@"touchEnd" originatingTime:event.timestamp];
+1 -1
View File
@@ -1,4 +1,4 @@
VERSION_NAME=0.0.1-master
VERSION_NAME=0.24.0-rc1
GROUP=com.facebook.react
POM_NAME=ReactNative
+6
View File
@@ -18,6 +18,12 @@ module.exports = function(options, filename) {
var transform = filename
? './' + path.relative(path.dirname(filename), transformPath) // packager can't handle absolute paths
: hmrTransform;
// Fix the module path to use '/' on Windows.
if (path.sep === '\\') {
transform = transform.replace(/\\/g, '/');
}
return {
plugins: resolvePlugins([
[
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "react-native",
"version": "1000.0.0",
"version": "0.24.0-rc1",
"description": "A framework for building native apps using React",
"license": "BSD-3-Clause",
"repository": {
@@ -190,4 +190,4 @@
"react": "^0.14.5",
"shelljs": "0.6.0"
}
}
}
+10 -9
View File
@@ -189,23 +189,24 @@ class Bundler {
);
}
_hmrURL(prefix, platform, extensionOverride, path) {
const matchingRoot = this._projectRoots.find(root => path.startsWith(root));
_hmrURL(prefix, platform, extensionOverride, filePath) {
const matchingRoot = this._projectRoots.find(root => filePath.startsWith(root));
if (!matchingRoot) {
throw new Error('No matching project root for ', path);
throw new Error('No matching project root for ', filePath);
}
const extensionStart = path.lastIndexOf('.');
let resource = path.substring(
// Replaces '\' with '/' for Windows paths.
if (path.sep === '\\') {
filePath = filePath.replace(/\\/g, '/');
}
const extensionStart = filePath.lastIndexOf('.');
let resource = filePath.substring(
matchingRoot.length,
extensionStart !== -1 ? extensionStart : undefined,
);
const extension = extensionStart !== -1
? path.substring(extensionStart + 1)
: null;
return (
prefix + resource +
'.' + extensionOverride + '?' +