React Snippets
ts/tsx js/jsx 代码提示
/**
* Created by MeePwn
* https://github.com/maybewaityou
*
* description:
*
*/
import $1 from '$2';
import styled from 'styled-components';
import { NavigationActions } from 'react-navigation';
import { actionCreator, actions, ActionsObservable, BATCH_ACTIONS, epicCreator, flowable, IAction, mutate, replace } from 'mario-meditation';
import { $1 } from 'mario-utilities';
import { $1 } from 'mario-architecture-components';
import {
Button,
Image,
ImageStyle,
StyleSheet,
Text,
TextStyle,
View,
ViewStyle,
} from 'react-native';
this.props.
this.state.
this.setState({
$1
});
this.setState((prevState: any, props: any) => ({
$1
}));
source={$1}
style={$1}
numberOfLines={$1}
activeOpacity={$1}
resizeMode=$1
'cover'
'contain'
'stretch'
'repeat'
'center'
onPress={$1}
onChangeText={$1}
onChange={$1}
value={$1}
multiline={$1}
actionCreator($1)
createAction($1)($2)$3
$1(state: any, payload: any) { return mutate(state, { $1: payload }); },
($1) => {
$2
}
setTimeout(() => {
$1
});
new Promise((resolve, reject) => {
$1
});
$1.forEach((item: any, index: number) => {
$2
});
$1.map((item: any) => $2);
$1.filter((item: any) => $2);
const { $2 } = $1;
const [ $2 ] = $1;
@bind(({ }: any) => {
$1
})
public constructor(props: Readonly<${1:IProps}>) {
super(props);
$1
}
public componentWillMount() {
$1
}
public componentDidMount() {
$1
}
public componentWillUnmount() {
$1
}
public componentWillReceiveProps(nextProps: Readonly<any>) {
$1
}
public componentWillUpdate(nextProps: Readonly<any>, nextState: Readonly<any>) {
$1
}
public shouldComponentUpdate(nextProps: Readonly<any>, nextState: Readonly<any>) {
$1
}
public componentDidUpdate(prevProps: Readonly<any>, prevState: Readonly<any>) {
$1
}
public componentDidCatch(error: Error, errorInfo: ErrorInfo) {
$1
}
public render() {
return (
$1
);
}
$1: PropTypes.$2,
$1: PropTypes.$2.isRequired,
const styles = StyleSheet.create<IStyle>({
container: {
$1
},
});
flex: $1,
justifyContent: '${1:center}',
alignItems: '${1:center}',
alignSelf: '${1:center}',
'flex-start'
'flex-end'
'center'
'space-between'
'space-around'
borderBottomWidth: $1,
borderLeftWidth: $1,
borderRightWidth: $1,
borderTopWidth: $1,
borderWidth: $1,
flexDirection: $1,
'row'
'row-reverse'
'column'
'column-reverse'
height: $1,
width: $1,
margin: $1,
marginBottom: $1,
marginLeft: $1,
marginRight: $1,
marginTop: $1,
marginHorizontal: $1,
marginVertical: $1,
maxHeight: $1,
maxWidth: $1,
minHeight: $1,
minWidth: $1,
overflow: $1,
'visible'
'hidden'
'scroll'
padding: $1,
paddingBottom: $1,
paddingHorizontal: $1,
paddingLeft: $1,
paddingRight: $1,
paddingTop: $1,
paddingVertical: $1,
position: $1,
zIndex: $1,
top: $1,
left: $1,
right: $1,
bottom: $1,
fontSize: $1,
fontWeight: '$1',
'bold'
backgroundColor: '$1',
borderColor: '$1',
borderTopColor: '$1',
borderRightColor: '$1',
borderBottomColor: '$1',
borderLeftColor: '$1',
borderRadius: $1,
borderTopLeftRadius: $1,
borderTopRightRadius: $1,
borderBottomLeftRadius: $1,
borderBottomRightRadius: $1,
borderStyle: '$1',
'solid'
'dotted'
'dashed'
opacity: $1
$1Epic(action$: ActionsObservable, state$: StateObservable<any>, dependencies: any) {
return epicCreator(action$)($2)((action: IAction) =>
$3Task(action.payload)
.pipe(
map((response: any) => {
$4
return actionCreator(NETWORK_SUCCESS);
}),
catchError((error: IError) => {
return flowable(actionCreator(NETWORK_FAILURE));
}),
),
);
},
/**
* Created by MeePwn
* https://github.com/maybewaityou
*
* description:
*
*/
import React from 'react';
import { IViewModelProps } from '../view-model/index';
export default (props: Readonly<IViewModelProps>) => (
<div style={styles.container}>
</div>
);
const styles = {
container: {
},
};
/**
* Created by MeePwn
* https://github.com/maybewaityou
*
* description:
*
*/
import React from 'react';
import {
Button,
Image,
ImageStyle,
StyleSheet,
Text,
TextStyle,
View,
ViewStyle,
} from 'react-native';
import { IViewModelProps } from '../view-model/index';
export interface IStyle {
container: ViewStyle;
}
export default (props: Readonly<IViewModelProps>) => (
<View style={styles.container}>
</View>
);
const styles = StyleSheet.create<IStyle>({
container: {
},
});
/**
* Created by MeePwn
* https://github.com/maybewaityou
*
* description:
*
*/
import { mario, bind } from 'mario-meditation';
import { inject, ViewModel } from 'mario-architecture-components';
import { $1Selector } from '../selector/index';
import { $1ViewModel, IViewModelProps } from '../view-model/index';
import { $1View } from '../view/index';
mario.model(require('../models/index'));
export default bind($1Selector)(inject<IViewModelProps, ViewModel<IViewModelProps>>($1View, $1ViewModel));
/**
* Created by MeePwn
* https://github.com/maybewaityou
*
* description:
*
*/
import { mario, bind } from 'mario-meditation';
import { inject, ViewModel } from 'mario-architecture-components';
import { $1Selector } from '../selector/index';
import { $1ViewModel, IViewModelProps } from '../view-model/index';
import { $1View } from '../view/index';
export default dynamic({
models: () => [ require('../models/index') ],
component: () => Promise.resolve(bind($1Selector)(inject<IViewModelProps, ViewModel<IViewModelProps>>($1View, $1ViewModel))),
});
/**
* Created by MeePwn
* https://github.com/maybewaityou
*
* description:
*
*/
import { actionCreator, actions, ActionsObservable, BATCH_ACTIONS, epicCreator, flowable, IAction, mutate } from 'mario-meditation';
import { log, toString } from 'mario-utilities';
import { map, catchError } from 'rxjs/operators';
import { NETWORK_FAILURE, NETWORK_SUCCESS } from 'dataflow/actions';
import { IError, IResponse } from 'task';
// import { } from '../actions/index';
// import { } from '../task/index';
export default {
name: '$1',
immutable: true,
initialState: {
},
epics: {
},
};
/**
* Created by MeePwn
* https://github.com/maybewaityou
*
* description:
*
*/
import { ViewModel } from 'mario-architecture-components';
import { actions, actionCreator, createAction, IAction } from 'mario-meditation';
import { } from '../actions/index';
export interface IModel {
}
export interface IHandlers {
}
export interface IViewModelProps extends IModel, IHandlers {
navigation: any;
dispatch: (action: IAction) => any;
}
export default class extends ViewModel<IViewModelProps> {
public handlers = {
};
}