diff --git a/Libraries/Components/Keyboard/Keyboard.js b/Libraries/Components/Keyboard/Keyboard.js index 9b3c7973062e..d85801c9d871 100644 --- a/Libraries/Components/Keyboard/Keyboard.js +++ b/Libraries/Components/Keyboard/Keyboard.js @@ -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; @@ -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 @@ -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; diff --git a/Libraries/Components/ScrollView/ScrollView.js b/Libraries/Components/ScrollView/ScrollView.js index 74026c7e6496..1f6c55aff668 100644 --- a/Libraries/Components/ScrollView/ScrollView.js +++ b/Libraries/Components/ScrollView/ScrollView.js @@ -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. * diff --git a/Libraries/Core/Devtools/setupDevtools.js b/Libraries/Core/Devtools/setupDevtools.js index 869eb7ccda40..b1c32960abf5 100644 --- a/Libraries/Core/Devtools/setupDevtools.js +++ b/Libraries/Core/Devtools/setupDevtools.js @@ -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) { @@ -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, diff --git a/Libraries/Lists/SectionList.js b/Libraries/Lists/SectionList.js index 775685131d6e..f547066f129b 100644 --- a/Libraries/Lists/SectionList.js +++ b/Libraries/Lists/SectionList.js @@ -71,7 +71,7 @@ type OptionalProps> = { /** * 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, diff --git a/React/Base/Surface/RCTSurfaceRootShadowView.m b/React/Base/Surface/RCTSurfaceRootShadowView.m index f076c9daeea1..9ffe7364cb32 100644 --- a/React/Base/Surface/RCTSurfaceRootShadowView.m +++ b/React/Base/Surface/RCTSurfaceRootShadowView.m @@ -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); } diff --git a/React/Modules/RCTUIManager.m b/React/Modules/RCTUIManager.m index ef1c571f3aea..27fa1556fe7a 100644 --- a/React/Modules/RCTUIManager.m +++ b/React/Modules/RCTUIManager.m @@ -974,7 +974,6 @@ - (void)_manageChildren:(NSNumber *)containerTag } UIView *view = [componentData createViewWithTag:reactTag]; if (view) { - [componentData setProps:props forView:view]; uiManager->_viewRegistry[reactTag] = view; } }); diff --git a/ReactAndroid/DEFS b/ReactAndroid/DEFS index 0b5843026b38..a594df919940 100644 --- a/ReactAndroid/DEFS +++ b/ReactAndroid/DEFS @@ -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) diff --git a/ReactCommon/yoga/BUCK b/ReactCommon/yoga/BUCK index bd4dddd12aa5..65bfdf418530 100644 --- a/ReactCommon/yoga/BUCK +++ b/ReactCommon/yoga/BUCK @@ -1,5 +1,3 @@ -include_defs("//ReactAndroid/DEFS") - fb_xplat_cxx_library( name = "yoga", srcs = glob(["yoga/*.cpp"]),