Last active
May 5, 2017 15:05
-
-
Save kenwheeler/b20ea372efcc52adf905 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
const RN = React; | |
export const PropTypes = React.PropTypes; | |
RN.StyleSheet = { | |
create: (style) => style | |
}; | |
const createComponent = (type) => { | |
return React.createClass({ | |
displayName: type, | |
propTypes: { | |
children: React.PropTypes.node | |
}, | |
render() { | |
return <div {...this.props}>{this.props.children}</div>; | |
} | |
}); | |
}; | |
RN.View = createComponent("View"); | |
RN.Text = createComponent("Text"); | |
RN.ActivityIndicatorIOS = createComponent("ActivityIndicatorIOS"); | |
RN.Image = createComponent("Image"); | |
RN.TouchableHighlight = createComponent("TouchableHighlight"); | |
RN.ScrollView = createComponent("ScrollView"); | |
export default RN; |
@joemckie you mean:
export {
View,
Text,
ActivityIndicatorIOS,
Image,
TouchableHighlight,
ScrollView,
StyleSheet
};
Right?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As
react-native
has named exports, the following would actually returnundefined
, andReact.createElement
type warnings:You could fix this by providing the same named exports in this mock: