Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
43 changes: 33 additions & 10 deletions Libraries/Components/Keyboard/Keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*/
'use strict';

const LayoutAnimation = require('LayoutAnimation');
const invariant = require('fbjs/lib/invariant');
const NativeEventEmitter = require('NativeEventEmitter');
const KeyboardObserver = require('NativeModules').KeyboardObserver;
Expand All @@ -25,16 +26,18 @@ type KeyboardEventName =
| 'keyboardWillChangeFrame'
| 'keyboardDidChangeFrame';

type KeyboardEventData = {
endCoordinates: {
width: number,
height: number,
screenX: number,
screenY: number,
},
};
export type KeyboardEvent = {|
+duration?: number,
+easing?: string,
+endCoordinates: {|
+width: number,
+height: number,
+screenX: number,
+screenY: number,
|},
|};

type KeyboardEventListener = (e: KeyboardEventData) => void;
type KeyboardEventListener = (e: KeyboardEvent) => void;

// The following object exists for documentation purposes
// Actual work happens in
Expand Down Expand Up @@ -134,11 +137,31 @@ let Keyboard = {
*/
dismiss() {
invariant(false, 'Dummy method used for documentation');
}
},

/**
* Useful for syncing TextInput (or other keyboard accessory view) size of
* position changes with keyboard movements.
*/
scheduleLayoutAnimation(event: KeyboardEvent) {
invariant(false, 'Dummy method used for documentation');
},
};

// Throw away the dummy object and reassign it to original module
Keyboard = KeyboardEventEmitter;
Keyboard.dismiss = dismissKeyboard;
Keyboard.scheduleLayoutAnimation = function(event: KeyboardEvent) {
const {duration, easing} = event;
if (duration) {
LayoutAnimation.configureNext({
duration: duration,
update: {
duration: duration,
type: (easing && LayoutAnimation.Types[easing]) || 'keyboard',
},
});
}
};

module.exports = Keyboard;
9 changes: 9 additions & 0 deletions Libraries/Components/ScrollView/ScrollView.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,15 @@ const ScrollView = createReactClass({
* events can be controlled using the `scrollEventThrottle` prop.
*/
onScroll: PropTypes.func,
/**
* Called when the user begins to drag the scroll view.
*/
onScrollBeginDrag: PropTypes.func,
/**
* Called when the user stops dragging the scroll view and it either stops
* or begins to glide.
*/
onScrollEndDrag: PropTypes.func,
/**
* Called when scrollable content view of the ScrollView changes.
*
Expand Down
11 changes: 6 additions & 5 deletions Libraries/Core/Devtools/setupDevtools.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ let register = function () {
if (__DEV__) {
const AppState = require('AppState');
const WebSocket = require('WebSocket');
const {PlatformConstants} = require('NativeModules');
/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an
* error found when Flow v0.54 was deployed. To see the error delete this
* comment and run Flow. */
const reactDevTools = require('react-devtools-core');
const getDevServer = require('getDevServer');

// Initialize dev tools only if the native module for WebSocket is available
if (WebSocket.isAvailable) {
Expand All @@ -42,10 +42,11 @@ if (__DEV__) {
// or the code will throw for bundles that don't have it.
const isAppActive = () => AppState.currentState !== 'background';

// Special case: Genymotion is running on a different host.
const host = PlatformConstants && PlatformConstants.ServerHost ?
PlatformConstants.ServerHost.split(':')[0] :
'localhost';
// Get hostname from development server (packager)
const devServer = getDevServer();
const host = devServer.bundleLoadedFromServer
? devServer.url.replace(/https?:\/\//, '').split(':')[0]
: 'localhost';

reactDevTools.connectToDevTools({
isAppActive,
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Lists/SectionList.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ type OptionalProps<SectionT: SectionBase<any>> = {
/**
* Default renderer for every item in every section. Can be over-ridden on a per-section basis.
*/
renderItem: (info: {
renderItem?: (info: {
item: Item,
index: number,
section: SectionT,
Expand Down
2 changes: 1 addition & 1 deletion React/Base/Surface/RCTSurfaceRootShadowView.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ - (void)calculateLayoutWithMinimumSize:(CGSize)minimumSize maximumSize:(CGSize)m
float availableHeight = isinf(maximimSize.height) ? YGUndefined : maximimSize.height;

self.minWidth = (YGValue){isinf(minimumSize.width) ? YGUndefined : minimumSize.width, YGUnitPoint};
self.minWidth = (YGValue){isinf(minimumSize.height) ? YGUndefined : minimumSize.height, YGUnitPoint};
self.minHeight = (YGValue){isinf(minimumSize.height) ? YGUndefined : minimumSize.height, YGUnitPoint};

YGNodeCalculateLayout(self.yogaNode, availableWidth, availableHeight, _baseDirection);
}
Expand Down
1 change: 0 additions & 1 deletion React/Modules/RCTUIManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,6 @@ - (void)_manageChildren:(NSNumber *)containerTag
}
UIView *view = [componentData createViewWithTag:reactTag];
if (view) {
[componentData setProps:props forView:view];
uiManager->_viewRegistry[reactTag] = view;
}
});
Expand Down
2 changes: 1 addition & 1 deletion ReactAndroid/DEFS
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,4 @@ def rn_robolectric_test(name, srcs, vm_args = None, *args, **kwargs):


def fb_xplat_cxx_library(allow_jni_merging=None, **kwargs):
cxx_library(*args, **kwargs)
cxx_library(**kwargs)
2 changes: 0 additions & 2 deletions ReactCommon/yoga/BUCK
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
include_defs("//ReactAndroid/DEFS")

fb_xplat_cxx_library(
name = "yoga",
srcs = glob(["yoga/*.cpp"]),
Expand Down