mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
313611572b
* Move files and tests to more meaningful places * Fix the build Now that we import reconciler via react-reconciler, I needed to make a few tweaks. * Update sizes * Move @preventMunge directive to FB header * Revert unintentional change * Fix Flow coverage I forgot to @flow-ify those files. This uncovered some issues. * Prettier, I love you but you're bringing me down Prettier, I love you but you're bringing me down Like a rat in a cage Pulling minimum wage Prettier, I love you but you're bringing me down Prettier, you're safer and you're wasting my time Our records all show you were filthy but fine But they shuttered your stores When you opened the doors To the cops who were bored once they'd run out of crime Prettier, you're perfect, oh, please don't change a thing Your mild billionaire mayor's now convinced he's a king So the boring collect I mean all disrespect In the neighborhood bars I'd once dreamt I would drink Prettier, I love you but you're freaking me out There's a ton of the twist but we're fresh out of shout Like a death in the hall That you hear through your wall Prettier, I love you but you're freaking me out Prettier, I love you but you're bringing me down Prettier, I love you but you're bringing me down Like a death of the heart Jesus, where do I start? But you're still the one pool where I'd happily drown And oh! Take me off your mailing list For kids who think it still exists Yes, for those who think it still exists Maybe I'm wrong and maybe you're right Maybe I'm wrong and maybe you're right Maybe you're right, maybe I'm wrong And just maybe you're right And oh! Maybe mother told you true And there'll always be somebody there for you And you'll never be alone But maybe she's wrong and maybe I'm right And just maybe she's wrong Maybe she's wrong and maybe I'm right And if so, here's this song!
105 lines
2.9 KiB
JavaScript
105 lines
2.9 KiB
JavaScript
/**
|
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @providesModule ReactNativeFiberHostComponent
|
|
* @flow
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
var ReactNativeAttributePayload = require('ReactNativeAttributePayload');
|
|
var TextInputState = require('TextInputState');
|
|
var UIManager = require('UIManager');
|
|
|
|
var {mountSafeCallback, warnForStyleProps} = require('NativeMethodsMixinUtils');
|
|
|
|
import type {
|
|
MeasureInWindowOnSuccessCallback,
|
|
MeasureLayoutOnSuccessCallback,
|
|
MeasureOnSuccessCallback,
|
|
NativeMethodsMixinType,
|
|
ReactNativeBaseComponentViewConfig,
|
|
} from 'ReactNativeTypes';
|
|
import type {Instance} from 'ReactNativeFiberRenderer';
|
|
|
|
/**
|
|
* This component defines the same methods as NativeMethodsMixin but without the
|
|
* findNodeHandle wrapper. This wrapper is unnecessary for HostComponent views
|
|
* and would also result in a circular require.js dependency (since
|
|
* ReactNativeFiber depends on this component and NativeMethodsMixin depends on
|
|
* ReactNativeFiber).
|
|
*/
|
|
class ReactNativeFiberHostComponent {
|
|
_children: Array<Instance | number>;
|
|
_nativeTag: number;
|
|
viewConfig: ReactNativeBaseComponentViewConfig;
|
|
|
|
constructor(tag: number, viewConfig: ReactNativeBaseComponentViewConfig) {
|
|
this._nativeTag = tag;
|
|
this._children = [];
|
|
this.viewConfig = viewConfig;
|
|
}
|
|
|
|
blur() {
|
|
TextInputState.blurTextInput(this._nativeTag);
|
|
}
|
|
|
|
focus() {
|
|
TextInputState.focusTextInput(this._nativeTag);
|
|
}
|
|
|
|
measure(callback: MeasureOnSuccessCallback) {
|
|
UIManager.measure(this._nativeTag, mountSafeCallback(this, callback));
|
|
}
|
|
|
|
measureInWindow(callback: MeasureInWindowOnSuccessCallback) {
|
|
UIManager.measureInWindow(
|
|
this._nativeTag,
|
|
mountSafeCallback(this, callback),
|
|
);
|
|
}
|
|
|
|
measureLayout(
|
|
relativeToNativeNode: number,
|
|
onSuccess: MeasureLayoutOnSuccessCallback,
|
|
onFail: () => void /* currently unused */,
|
|
) {
|
|
UIManager.measureLayout(
|
|
this._nativeTag,
|
|
relativeToNativeNode,
|
|
mountSafeCallback(this, onFail),
|
|
mountSafeCallback(this, onSuccess),
|
|
);
|
|
}
|
|
|
|
setNativeProps(nativeProps: Object) {
|
|
if (__DEV__) {
|
|
warnForStyleProps(nativeProps, this.viewConfig.validAttributes);
|
|
}
|
|
|
|
var updatePayload = ReactNativeAttributePayload.create(
|
|
nativeProps,
|
|
this.viewConfig.validAttributes,
|
|
);
|
|
|
|
// Avoid the overhead of bridge calls if there's no update.
|
|
// This is an expensive no-op for Android, and causes an unnecessary
|
|
// view invalidation for certain components (eg RCTTextInput) on iOS.
|
|
if (updatePayload != null) {
|
|
UIManager.updateView(
|
|
this._nativeTag,
|
|
this.viewConfig.uiViewClassName,
|
|
updatePayload,
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
// eslint-disable-next-line no-unused-expressions
|
|
(ReactNativeFiberHostComponent.prototype: NativeMethodsMixinType);
|
|
|
|
module.exports = ReactNativeFiberHostComponent;
|