Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
componentDidMount: function() {
this._lastNativeText = this.props.value;
const tag = ReactNative.findNodeHandle(this._inputRef);
if (tag != null) {
// tag is null only in unit tests
TextInputState.registerInput(tag);
}
if (this.props.autoFocus) {
this._rafId = requestAnimationFrame(this.focus);
}
},
getWebViewHandle: function() {
// eslint-disable-next-line react/no-string-refs
return ReactNative.findNodeHandle(this.refs[RCT_WEBVIEW_REF]);
},
_measureLayoutRelativeToContainingList(): void {
UIManager.measureLayout(
ReactNative.findNodeHandle(this),
ReactNative.findNodeHandle(
this.context.virtualizedList.getOutermostParentListRef(),
),
error => {
console.warn(
"VirtualizedList: Encountered an error while measuring a list's" +
' offset from its containing VirtualizedList.',
);
},
(x, y, width, height) => {
this._offsetFromParentVirtualizedList = this._selectOffset({x, y});
this._scrollMetrics.contentLength = this._selectLength({width, height});
const scrollMetrics = this._convertParentScrollMetrics(
this.context.virtualizedList.getScrollMetrics(),
);
__disconnectAnimatedView(): void {
invariant(this.__isNative, 'Expected node to be marked as "native"');
var nativeViewTag: ?number = ReactNative.findNodeHandle(this._animatedView);
invariant(nativeViewTag != null, 'Unable to locate attached view in the native tree');
NativeAnimatedAPI.disconnectAnimatedNodeFromView(this.__getNativeTag(), nativeViewTag);
}
__disconnectAnimatedView(): void {
invariant(this.__isNative, 'Expected node to be marked as "native"');
var nativeViewTag: ?number = findNodeHandle(this._animatedView);
invariant(nativeViewTag != null, 'Unable to locate attached view in the native tree');
NativeAnimatedAPI.disconnectAnimatedNodeFromView(this.__getNativeTag(), nativeViewTag);
}
__connectAnimatedView(): void {
invariant(this.__isNative, 'Expected node to be marked as "native"');
var nativeViewTag: ?number = ReactNative.findNodeHandle(this._animatedView);
invariant(nativeViewTag != null, 'Unable to locate attached view in the native tree');
NativeAnimatedAPI.connectAnimatedNodeToView(this.__getNativeTag(), nativeViewTag);
}
__connectAnimatedView(): void {
invariant(this.__isNative, 'Expected node to be marked as "native"');
var nativeViewTag: ?number = findNodeHandle(this._animatedView);
invariant(nativeViewTag != null, 'Unable to locate attached view in the native tree');
NativeAnimatedAPI.connectAnimatedNodeToView(this.__getNativeTag(), nativeViewTag);
}
autoRefresh() {
let self = this;
UIManager.dispatchViewManagerCommand(
ReactNative.findNodeHandle(self.refs[REF_PTR]),
1,
null
);
}
componentDidMount(){
//构造数据
for(ii=0; ii<100; ii++){
if(ii%2 === 0){
//使用0类型的view
dataSet.push({'viewType':0, 'img':'http://facebook.github.io/react/img/logo_og.png', 'data':'row'+ii});
}else{
//使用1类型的view, 其中data对应的TextView还支持html标签哦。
dataSet.push({'viewType':1, 'img':'http://facebook.github.io/react/img/logo_og.png', 'data':"<font color="#ff0000" size="16">row"+ii+"</font>"});
}
}
//设置数据给RecyclerView, 命令2表示设置数据
NativeModules.UIManager.dispatchViewManagerCommand( ReactNative.findNodeHandle(this.refs.recycle), 2, dataSet);
//同时滚动到第5行, 命令1表示滚动到某一行
NativeModules.UIManager.dispatchViewManagerCommand( ReactNative.findNodeHandle(this.refs.recycle), 1, [5]);
}
_play() {
UIManager.dispatchViewManagerCommand(
ReactNative.findNodeHandle(this),
UIManager.Sound.Commands.play,
[]
);
},