Upgrade to Pro — share decks privately, control downloads, hide ads and more …

モダンフロントエンド + React Native所感 / techcamp03

モダンフロントエンド + React Native所感 / techcamp03

第3回開発合宿(2017/05/22)

Yuichi Goto

May 22, 2017
Tweet

More Decks by Yuichi Goto

Other Decks in Programming

Transcript

  1. എܠ1: લճͷ߹॓@2016Ն • ReactͰॻ͍ͨMinesweeperΛվྑͨ͠ • CSS Modules, css next, PostCSSͷಋೖΛ


    ௨ͯ͡ϞμϯCSSٕज़ʹ৮Εͨ • ซͤͯϏϧυपΓΛGulp + Browserify͔Β npm-scripts + webpackʹҠߦͨ͠
  2. αϯϓϧ: View component /* Logo.css */ .logo { width: 200px;

    height: 200px; } // index.ios.js import React from 'react'; import { AppRegistry, Text, View } from 'react-native'; import styles from './styles'; function AwesomeProject() { return ( <View style={styles.container}> <Text style={styles.hello}> Hello, World! </Text> </View> ); } AppRegistry.registerComponent('AwesomeProject', () => AwesomeProject);
  3. αϯϓϧ: Styling // styles.ios.js import { StyleSheet } from 'react-native';

    export default StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#F5FCFF', }, hello: { fontSize: 20, }, }); ComponentͷϨΠΞ΢τ ʹ͸FlexboxΛ࢖͏
  4. αϯϓϧ /* Logo.css */ .logo { width: 200px; height: 200px;

    } import React, { Component } from 'react'; import { AppRegistry, Button, Text, View } from 'react-native'; import { StackNavigator } from 'react-navigation'; import styles from './styles'; class Home extends Component { static navigationOptions = { title: 'Home' }; render() { const { navigate } = this.props.navigation; return ( <View style={styles.container}> <Button onPress={() => navigate('Chat')} title="Chat with Rina" /> </View> ); } } … const AwesomeProject = StackNavigator({ Home: { screen: Home }, Chat: { screen: Chat }}); AppRegistry.registerComponent('AwesomeProject', () => AwesomeProject); keyͱComponentͷϚοϓ