Troila Mobile Ui

Troila Mobile Ui

  • Docs
  • API
  • Help
  • Blog

›Components

Troila Mobile Ui

  • Getting Started

Components

  • Text
  • ListView
  • List
  • TextInput
  • InputItem
  • Step
  • SpringAnimatedView

卓朗云桌面-内部组件

  • request (请求类)
  • BackgroundButton
  • ExtendsBackButton
  • HeaderTitleButton
  • HeaderImageButton
  • 注意事项
  • 不同平台和设备的入口

SpringAnimatedView

弹性动画

规则

  • 受控组件
  • nativeEvent必传,用于控制布局

Example

iOS Android

Code

import React, { Component } from 'react';
import {
    View,
    StyleSheet,
    Text,
    TouchableOpacity,
} from 'react-native';
import { SpringAnimatedView } from 'troila-mobile-ui';


export default class Example extends Component {
    state = {
        show: false,
        nativeEvent: null,
    }
    render() {
        const {
            show,
            nativeEvent,
        } = this.state
        return (
            <View style={styles.container}>
                <View style={{ alignItems: 'center', }}>
                    {
                        [1, 2, 3].map((item, i) => (
                            <Button
                                title={'切换动画'}
                                onPress={({ nativeEvent}) => {
                                    this.setState({
                                        show: !show,
                                        nativeEvent,
                                    })
                                }}
                                style={{ marginTop: 100, }}
                                key={i}
                            />
                        ))
                    }
                </View>
                <SpringAnimatedView
                    show={show}
                    nativeEvent={nativeEvent}
                >
                    <Button
                        title={'切换动画'}
                        onPress={() => {
                            this.setState({
                                show: !show
                            })
                        }}
                    />
                </SpringAnimatedView>
            </View>
        );
    }
}



class Button extends Component {
    render() {
        const {
            title,
            onPress,
            style,
        } = this.props
        return (
            <TouchableOpacity
                style={[styles.button1, style]}
                activeOpacity={1}
                onPress={onPress}
                ref={(e) => { this.button = e }}
            >
                <Text style={styles.text1}>{title}</Text>
            </TouchableOpacity>
        );
    }
    getRef = () => {
        return this.button
    }
}




const styles = StyleSheet.create({
    container: {
        flex: 1,
    },
    button1: {
        height: 40,
        justifyContent: 'center',
        borderWidth: 1,
        borderColor: '#efefef',
        padding: 10,
        borderRadius: 5,
        marginBottom: 10,
        backgroundColor: '#fff',
    },
    text1: {
        fontSize: 20,
        color: '#333',
    },
})

Props

属性说明类型默认值
show是否显示Booleantrue
nativeEventonPress的参数Objectnull
← Steprequest →
  • 规则
  • Example
  • Code
  • Props
Troila Mobile Ui
Docs
Getting Started (or other categories)Guides (or other categories)API Reference (or other categories)
Community
User ShowcaseStack OverflowProject ChatTwitter
More
BlogGitHubStar
Facebook Open Source
Copyright © 2018 Your Name or Your Company Name