How to use the reactxp.Component function in reactxp

To help you get started, we’ve selected a few reactxp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / reactxp / extensions / virtuallistview / src / VirtualListCell.tsx View on Github external
overflowVisible: RX.Styles.createViewStyle({
        overflow: 'visible'
    }),
    overflowHidden: RX.Styles.createViewStyle({
        overflow: 'hidden'
    })
};

const _isNativeMacOS = RX.Platform.getType() === 'macos';
const _skypeEaseInAnimationCurve = RX.Animated.Easing.CubicBezier(1, 0, 0.78, 1);
const _skypeEaseOutAnimationCurve = RX.Animated.Easing.CubicBezier(0.33, 0, 0, 1);
const _keyCodeEnter = 13;
const _keyCodeSpace = 32;
const _keyCodeReturn = 3;

export class VirtualListCell extends RX.Component, RX.Stateless> {
    // Helper class used to render child elements. If we know that none of the children changed - we would like to skip
    // the render completely, to improve performance.
    private static StaticRenderer = class  extends
            RX.Component, RX.Stateless> {
        constructor(props: StaticRendererProps) {
            super(props);
        }

        shouldComponentUpdate(nextProps: StaticRendererProps): boolean {
            return nextProps.shouldUpdate ||
                this.props.isFocused !== nextProps.isFocused ||
                this.props.isSelected !== nextProps.isSelected;
        }

        render() {
            // If we don't have an item to render, return null here
github microsoft / reactxp / samples / hello-world / src / controls / ToggleSwitch.tsx View on Github external
top: 0,
        bottom: 0,
        left: 0,
        right: 0,
        borderRadius: 15
    }),
    toggleKnob: RX.Styles.createViewStyle({
        top: 2,
        height: 26,
        width: 26,
        borderRadius: 13,
        backgroundColor: 'white'
    })
};

export class ToggleSwitch extends RX.Component {
    private _knobLeftAnimationValue: RX.Animated.Value;
    private _knobLeftAnimationStyle: RX.Types.AnimatedViewStyleRuleSet;

    private _toggleColorAnimationValue: RX.Animated.Value;
    private _toggleColorAnimationStyle: RX.Types.AnimatedViewStyleRuleSet;

    constructor(props: ToggleSwitchProps) {
        super(props);

        // This value controls the left offset of the knob, which we will
        // animate when the user toggles the control.
        this._knobLeftAnimationValue = RX.Animated.createValue(props.value ? KNOB_LEFT_ON : KNOB_LEFT_OFF);
        this._knobLeftAnimationStyle = RX.Styles.createAnimatedViewStyle({
            left: this._knobLeftAnimationValue
        });
github microsoft / reactxp / samples / hello-world / src / views / SecondPanel.tsx View on Github external
width: 320
    }),
    roundButton: RX.Styles.createViewStyle({
        margin: 16,
        borderRadius: 16,
        backgroundColor: '#7d88a9'
    }),
    buttonText: RX.Styles.createTextStyle({
        fontSize: 16,
        marginVertical: 6,
        marginHorizontal: 12,
        color: 'white'
    })
};

export class SecondPanel extends RX.Component {
    readonly state: SecondPanelState = {
        progressValue: 0,
        toggleValue: true
    };

    private _progressTimerToken: number | undefined;
    private _mountedVideo: RXVideo | undefined;

    componentDidMount() {
        this._startProgressIndicator();
    }

    componentWillUnmount() {
        this._stopProgressIndicator();
    }
github microsoft / reactxp / samples / ImageList / src / controls / SearchField.tsx View on Github external
value: string;
}

const _styles = {
    input: RX.Styles.createTextInputStyle({
        borderStyle: 'solid',
        borderColor: '#999',
        borderWidth: 1,
        fontSize: 16,
        padding: 5,
        margin: 10,
        height: 30
    })
};

export class SearchField extends RX.Component {
    readonly state: SearchFieldState = { value: '' };

    render() {
        return (
            
        );
    }

    private _handleChangeText = (value: string) => (
github microsoft / reactxp / samples / hello-world-js / src / views / SecondPanel.js View on Github external
width: 320
    }),
    roundButton: RX.Styles.createViewStyle({
        margin: 16,
        borderRadius: 16,
        backgroundColor: '#7d88a9'
    }),
    buttonText: RX.Styles.createTextStyle({
        fontSize: 16,
        marginVertical: 6,
        marginHorizontal: 12,
        color: 'white'
    })
};

export class SecondPanel extends RX.Component {
    _progressTimerToken;

    constructor(props) {
        super(props);
        this.state = {
            toggleValue: true,
            progressValue: 0
        };
    }

    componentDidMount() {
        this._startProgressIndicator();
    }

    componentWillUnmount() {
        this._stopProgressIndicator();
github microsoft / reactxp / extensions / video / src / native-common / Video.tsx View on Github external
* RN-specific implementation of the cross-platform Video abstraction.
 */

import * as React from 'react';
import * as RX from 'reactxp';
import { default as RNVideo, VideoInfo, VideoBufferInfo } from 'react-native-video';

import * as Types from '../common/Types';

export interface VideoState {
    isPlaying?: boolean;
    isMuted?: boolean;
    duration?: number;
}

class Video extends RX.Component {
    private _mountedComponent: RNVideo|null = null;

    constructor(props: Types.VideoProps) {
        super(props);

        this.state = {
            isPlaying: false,
            isMuted: false
        };
    }

    render() {
        const source = typeof this.props.source === 'number'
            ? this.props.source
            : { uri: this.props.source };
        return (
github microsoft / reactxp / samples / ImageList / src / views / RootView.tsx View on Github external
main: RX.Styles.createViewStyle({
        alignSelf: 'stretch',
        flex: 1
    }),
    images: RX.Styles.createViewStyle({
        marginTop: 10,
        padding: 10,
        alignSelf: 'stretch',
        flex: 1
    }),
    statusSpacer: RX.Styles.createViewStyle({
        marginTop: 22
    })
};

class RootView extends RX.Component {
    render() {
        return (
            
                
                
                    
                
            
        );
    }

    private _updateImages = (query: string) => (
        ImageStore.updateImages(query)
github microsoft / reactxp / samples / hello-world-js / src / controls / ProgressIndicator.js View on Github external
/**
 * ProgressIndicator.js
 * Copyright: Microsoft 2017
 *
 * Circular progress indicator that shows off the use of ImageSVG
 * ReactXP extension.
 */

import * as RX from 'reactxp';
import React from 'react';
import RXImageSvg, { SvgPath as RXSvgPath } from 'reactxp-imagesvg';

export class ProgressIndicator extends RX.Component {
    render() {
        const size = this.props.size;
        const path = this._buildPath();

        return (
            
                
            
        );
    }

reactxp

Cross-platform abstraction layer for writing React-based applications a single time that work identically across web, React Native, and Electron distribution

MIT
Latest version published 5 years ago

Package Health Score

59 / 100
Full package analysis