Professional Documents
Culture Documents
Reaacttt Native w9
Reaacttt Native w9
Reaacttt Native w9
React Native
Simon Ayzman
Mobile Apps Developer @ Bloomberg
Run-Down
1. Introductions 5. Advanced Usage
2. What is RN? 6. Bloomberg Toolset
3. Pros/Cons 7. Awesome Links!
4. Basic Principles 8. Credits
5. DEMO! 9. Fin!
Introductions
fetchData() {
this.setState({ isLoading: true });
fetch(URL)
.then(res => this.setState({ isLoading: false }));
}
render() {
const { isLoading } = this.state;
const loadingDependentText = isLoading ? ‘Hi’ : ‘Bye’;
return <Text>{loadingDependentText}</Text>
}
}
Component Props
class AwesomeComponent extends Component {
static propTypes = {
data: PropTypes.arrayOf(PropTypes.number).isRequired,
shouldShowData: PropTypes.bool,
};
static defaultProps = {
shouldShowData: true,
};
render() {
const { data, shouldShowData } = this.props;
if (!shouldShowData) { return null; }
const elements = transformDataIntoElements(data);
return <View>{elements}</View>
}
}
Component Lifecycle
class AwesomeComponent extends Component {
componentDidMount() { // Lifecycle
this.fetchStuffFromTheInterwebs()
}
componentWillReceiveProps(nextProps) { // Lifecycle
this.doOtherStuffWithProps(this.props, nextProps);
}
fetchStuffFromTheInterwebs() {
fetch(‘www.geegle.com?q=c001+stUffZ’)
.then((response) => doStuff(response))
.catch((error) => console.error(“ERROR”))
}
render() { … }
}
DEMO!
Installation Requirements
$ create-react-native-app MIT-IPHY
$ cd MIT-IPHY
$ yarn start
● Data management
○ redux-thunk, side effects for simple cases
○ redux-saga, side effects with robustness
● Navigation
○ react-navigation
Bloomberg Toolset (II)
● Styling
○ styled-components, so easy with props!
● Testing
○ storybook, easy to test component variations!
○ jest, ok with testing business logic
Awesome Links
● Official React Native Documentation
● Chain React 2017 Conference Videos
● awesome-react-native GitHub Repo
● Rewriting a Large Hybrid App with React Native
● Ignite React Native App Boilerplate Generator
● MIT-IPHY Expo & Codebase
Credits
(Thank you!)