This file contains hidden or 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
| class TouchableCustom extends Component { | |
| constructor() { | |
| super(); | |
| this.state = { active: false }; | |
| this.onPressIn = () => this.setState({ active: true }); | |
| this.onPressOut = () => this.setState({ active: false }); | |
| } | |
| render() { | |
| const { active } = this.state; |
This file contains hidden or 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
| { | |
| module: { | |
| loaders: [{ | |
| // This is specifically for Cssta | |
| test: /\.jsx?$/, | |
| loader: 'babel-loader', | |
| options: { | |
| plugins: [ | |
| ['babel-plugin-cssta', { output: 'dist/styles.css' }], | |
| 'transform-es2015-modules-commonjs', |
This file contains hidden or 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 { createComponent, Component } from 'react'; | |
| import { Dimensions } from 'react-native'; | |
| /* | |
| Matches components based on screen min/max width/height queries. Uses component from the first size | |
| descriptor that matches the screen. | |
| Depends upon https://github.com/facebook/react-native/pull/9701 | |
| type Size = { |
This file contains hidden or 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
| const plugin = (instance) => { | |
| instance.extend('parseParenFreeIfStatement', () => function parseParenFreeIfStatement(node) { | |
| this.next(); | |
| node.test = this.parseExpression(); | |
| node.consequent = this.parseBlock(false); | |
| node.alternate = this.eat(tt._else) ? this.parseParenFreeElseStatement() : null; | |
| return this.finishNode(node, 'IfStatement'); | |
| }); | |
| instance.extend('parseParenFreeElseStatement', () => function parseParenFreeElseStatement() { |
This file contains hidden or 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
| const plugin = (instance) => { | |
| instance.extend('parseIfStatement', inner => function (node) { | |
| this.next(); | |
| const isParenFree = this.match(tokenTypes.parenL); | |
| node.test = isParenFree | |
| ? this.parseExpression() | |
| : this.parseParenExpression(); | |
| node.consequent = isParenFree | |
| ? this.parseBlock(false) |
This file contains hidden or 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
| pp.parseStatement = function (declaration, topLevel) { | |
| let node = this.startNode(); | |
| if (this.match(tokenTypes._if)) { | |
| return this.parseIfStatement(node); | |
| } else { | |
| ... | |
| } | |
| } |
This file contains hidden or 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
| const { plugins } = require('babylon/lib/parser'); | |
| const pluginName = 'swift-blocks'; | |
| const plugin = createSwiftBlocksPlugin(); | |
| plugins[pluginName] = 'swift-blocks'; | |
| module.exports = () => ({ | |
| manipulateOptions(opts, parserOpts) { | |
| parserOpts.plugins.push(pluginName); | |
| }, |
This file contains hidden or 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
| export default function () { | |
| return { | |
| manipulateOptions(opts, parserOpts) { | |
| parserOpts.plugins.push("jsx"); | |
| } | |
| }; | |
| } |
This file contains hidden or 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
| if condition { | |
| doSomething(); | |
| } |