mirror of
https://github.com/status-im/react-native.git
synced 2025-01-29 02:35:41 +00:00
Use requireNativeComponent in View.js.
Summary: public In a previous diff I've removed a need for using View attributes in requireNativeComponent. Thanks to that we can now use requireNativeComponent in View module. In a follow up diff I'll be getting rid of ReactNativeViewAttributes. Reviewed By: sahrens Differential Revision: D2676088 fb-gh-sync-id: d5d6e50f4629bd7982b90f3496e1fd22078e96a8
This commit is contained in:
parent
0d17d6a8c0
commit
7cd7591f04
@ -20,7 +20,7 @@ var ReactNativeViewAttributes = require('ReactNativeViewAttributes');
|
|||||||
var StyleSheetPropType = require('StyleSheetPropType');
|
var StyleSheetPropType = require('StyleSheetPropType');
|
||||||
var ViewStylePropTypes = require('ViewStylePropTypes');
|
var ViewStylePropTypes = require('ViewStylePropTypes');
|
||||||
|
|
||||||
var createReactNativeComponentClass = require('createReactNativeComponentClass');
|
var requireNativeComponent = require('requireNativeComponent');
|
||||||
|
|
||||||
var stylePropType = StyleSheetPropType(ViewStylePropTypes);
|
var stylePropType = StyleSheetPropType(ViewStylePropTypes);
|
||||||
|
|
||||||
@ -316,11 +316,12 @@ var View = React.createClass({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
var RCTView = createReactNativeComponentClass({
|
var RCTView = requireNativeComponent('RCTView', View, {
|
||||||
validAttributes: ReactNativeViewAttributes.RCTView,
|
nativeOnly: {
|
||||||
uiViewClassName: 'RCTView',
|
nativeBackgroundAndroid: true,
|
||||||
|
}
|
||||||
});
|
});
|
||||||
RCTView.propTypes = View.propTypes;
|
|
||||||
if (__DEV__) {
|
if (__DEV__) {
|
||||||
var viewConfig = RCTUIManager.viewConfigs && RCTUIManager.viewConfigs.RCTView || {};
|
var viewConfig = RCTUIManager.viewConfigs && RCTUIManager.viewConfigs.RCTView || {};
|
||||||
for (var prop in viewConfig.nativeProps) {
|
for (var prop in viewConfig.nativeProps) {
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var ReactNativeStyleAttributes = require('ReactNativeStyleAttributes');
|
var ReactNativeStyleAttributes = require('ReactNativeStyleAttributes');
|
||||||
var View = require('View');
|
|
||||||
|
|
||||||
export type ComponentInterface = ReactClass<any, any, any> | {
|
export type ComponentInterface = ReactClass<any, any, any> | {
|
||||||
name?: string;
|
name?: string;
|
||||||
@ -40,7 +39,6 @@ function verifyPropTypes(
|
|||||||
var nativeProps = viewConfig.NativeProps;
|
var nativeProps = viewConfig.NativeProps;
|
||||||
for (var prop in nativeProps) {
|
for (var prop in nativeProps) {
|
||||||
if (!componentInterface.propTypes[prop] &&
|
if (!componentInterface.propTypes[prop] &&
|
||||||
!View.propTypes[prop] &&
|
|
||||||
!ReactNativeStyleAttributes[prop] &&
|
!ReactNativeStyleAttributes[prop] &&
|
||||||
(!nativePropsToIgnore || !nativePropsToIgnore[prop])) {
|
(!nativePropsToIgnore || !nativePropsToIgnore[prop])) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
@ -122,6 +122,12 @@ public class ReactViewManager extends ViewGroupManager<ReactViewGroup> {
|
|||||||
color == null ? CSSConstants.UNDEFINED : (float) color);
|
color == null ? CSSConstants.UNDEFINED : (float) color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ReactProp(name = ViewProps.COLLAPSABLE)
|
||||||
|
public void setCollapsable(ReactViewGroup view, boolean collapsable) {
|
||||||
|
// no-op: it's here only so that "collapsable" property is exported to JS. The value is actually
|
||||||
|
// handled in NativeViewHierarchyOptimizer
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return REACT_CLASS;
|
return REACT_CLASS;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user