'use strict';

var ColorPropType = require('ColorPropType');
var PickerIOS = require('PickerIOS');

var Platform = require('Platform');
var React = require('React');
var StyleSheet = require('StyleSheet');
var StyleSheetPropType = require('StyleSheetPropType');
var TextStylePropTypes = require('TextStylePropTypes');
var UnimplementedView = require('UnimplementedView');
var View = require('View');
var ViewStylePropTypes = require('ViewStylePropTypes');

var itemStylePropType = StyleSheetPropType(TextStylePropTypes);

var pickerStyleType = StyleSheetPropType({
  ...ViewStylePropTypes,
  color: ColorPropType,
});

var MODE_DIALOG = 'dialog';
var MODE_DROPDOWN = 'dropdown';

/**
 * Renders the native picker component on iOS and Android. Example:
 *
 *     <Picker
 *       selectedValue={this.state.language}
 *       onValueChange={(lang) => this.setState({language: lang})}>
Example #2
0
 * If `lit` is true, the Box's materials are affected by scene lighting.
 * If `wireframe` is true, the Box will render in a wireframe style.
 * If `texture` is specified, React VR looks up the corresponding image
 * and uses it to texture the Box. This can be a string, an asset() call, or a require().
 *
 * <Box
 *   lit={true}
 *   texture={asset('crate_512.png')}
 * />
 */
const Box = createReactClass({
  mixins: [NativeMethodsMixin],

  propTypes: {
    ...View.propTypes,
    style: StyleSheetPropType(LayoutAndTransformColorPropTypes),

    /**
     * The lit property specifies if the Model will be affected by lights placed in the scene.
     */
    lit: PropTypes.bool,

    /**
     * The texture property specifies the url of the texture to be used for the Model.
     * To make texture repeat, pass an object with `repeat` property, for example:
     * `texture={{ ...asset('path/to/texture.jpg'), repeat: [4, 4] }}`
     *
     * First and second element in `repeat` sets how many times texture is repeated
     * in x and y directions.
     */
    texture: PropTypes.oneOfType([
 /**
  * These styles will be applied to the scroll view content container which
  * wraps all of the child views. Example:
  *
  *   return (
  *     <ScrollView contentContainerStyle={styles.contentContainer}>
  *     </ScrollView>
  *   );
  *   ...
  *   var styles = StyleSheet.create({
  *     contentContainer: {
  *       paddingVertical: 20
  *     }
  *   });
  */
 contentContainerStyle: StyleSheetPropType(ViewStylePropTypes),
 /**
  * A floating-point number that determines how quickly the scroll view
  * decelerates after the user lifts their finger. You may also use string
  * shortcuts `"normal"` and `"fast"` which match the underlying iOS settings
  * for `UIScrollViewDecelerationRateNormal` and
  * `UIScrollViewDecelerationRateFast` respectively.
  *   - normal: 0.998 (the default)
  *   - fast: 0.99
  * @platform ios
  */
 decelerationRate: PropTypes.oneOfType([
   PropTypes.oneOf(['fast', 'normal']),
   PropTypes.number,
 ]),
 /**
Example #4
0
'use strict';

import React, { Component, PropTypes } from 'react';
import {
    Text,
    TouchableOpacity,
  }from 'react-native';
import StyleSheetPropType from 'StyleSheetPropType';
import ViewStylePropTypes from 'ViewStylePropTypes';
import TextStylePropTypes from 'TextStylePropTypes';

let ViewStylePropType = StyleSheetPropType(ViewStylePropTypes);
let TextStylePropType = StyleSheetPropType(TextStylePropTypes);

const propTypes = {
  onPress: PropTypes.func,
  disabled: PropTypes.bool,
  style: TextStylePropType,
  containerStyle: ViewStylePropType,
  text: PropTypes.string
}

class Button extends React.Component {
  constructor (props) {
    super(props);

    this.onPress = this.onPress.bind(this);
  }

  onPress () {
    if (this.props.disabled) {
var NativeModules = require('NativeModules');
var ReactIOSViewAttributes = require('ReactIOSViewAttributes');
var StyleSheet = require('StyleSheet');
var createReactIOSNativeComponentClass = require('createReactIOSNativeComponentClass');
var PropTypes = require('ReactPropTypes');
var StyleSheetPropType = require('StyleSheetPropType');
var VideoResizeMode = require('./VideoResizeMode');
var VideoStylePropTypes = require('./VideoStylePropTypes');
var NativeMethodsMixin = require('NativeMethodsMixin');
var flattenStyle = require('flattenStyle');
var merge = require('merge');

var Video = React.createClass({
  propTypes: {
    source: PropTypes.string,
    style: StyleSheetPropType(VideoStylePropTypes),
    repeat: PropTypes.bool,
  },

  mixins: [NativeMethodsMixin],

  viewConfig: {
    uiViewClassName: 'UIView',
    validAttributes: ReactIOSViewAttributes.UIView
  },

  render: function() {
    var style = flattenStyle([styles.base, this.props.style]);
    var source = this.props.source;

    var resizeMode;
Example #6
0
const EdgeInsetsPropType = require('EdgeInsetsPropType');
const NativeMethodsMixin = require('NativeMethodsMixin');
const Platform = require('Platform');
const React = require('React');
const PropTypes = require('prop-types');
const ReactNativeViewAttributes = require('ReactNativeViewAttributes');
const StyleSheetPropType = require('StyleSheetPropType');
const TextStylePropTypes = require('TextStylePropTypes');
const Touchable = require('Touchable');

const createReactClass = require('create-react-class');
const createReactNativeComponentClass = require('createReactNativeComponentClass');
const mergeFast = require('mergeFast');
const processColor = require('processColor');

const stylePropType = StyleSheetPropType(TextStylePropTypes);

const viewConfig = {
  validAttributes: mergeFast(ReactNativeViewAttributes.UIView, {
    isHighlighted: true,
    numberOfLines: true,
    ellipsizeMode: true,
    allowFontScaling: true,
    disabled: true,
    selectable: true,
    selectionColor: true,
    adjustsFontSizeToFit: true,
    minimumFontScale: true,
    textBreakStrategy: true,
  }),
  uiViewClassName: 'RCTText',
Example #7
0
var Image = React.createClass({
  propTypes: {
    /**
     * `uri` is a string representing the resource identifier for the image, which
     * could be an http address, a local file path, or the name of a static image
     * resource (which should be wrapped in the `require('image!name')` function).
     */
    source: PropTypes.oneOfType([
      PropTypes.shape({
        uri: PropTypes.string,
      }),
      // Opaque type returned by require('./image.jpg')
      PropTypes.number,
    ]).isRequired,
    style: StyleSheetPropType(ImageStylePropTypes),
    /**
     * Used to locate this view in end-to-end tests.
     */
    testID: PropTypes.string,
  },

  statics: {
    resizeMode: ImageResizeMode,
  },

  mixins: [NativeMethodsMixin],

  /**
   * `NativeMethodsMixin` will look for this when invoking `setNativeProps`. We
   * make `this` look like an actual native component class. Since it can render
Example #8
0
'use strict';

import React from 'react-native';
const {
	Image,
	Text,
	View,
	PropTypes,
	TouchableOpacity,
	StyleSheet,
} = React;
import StyleSheetPropType from 'StyleSheetPropType';
import ViewStylePropTypes from 'ViewStylePropTypes';

let ViewStylePropType = StyleSheetPropType(ViewStylePropTypes);

const propTypes = {
	style: ViewStylePropType,
  detail: PropTypes.object,
  programId: PropTypes.string,
};

//视频详细信息(名称,主演等)布局
class VideoDetailLayout extends React.Component {
	constructor(props) {
		super(props);
    
    this.state = {
      isDescriptionShow: true,    //详细信息
    };
    
Example #9
0
  AccessibilityTraits,
} = require('ViewAccessibility');

var TVViewPropTypes = {};
if (Platform.isTVOS) {
  TVViewPropTypes = require('TVViewPropTypes');
}

import type {
  AccessibilityComponentType,
  AccessibilityTrait,
} from 'ViewAccessibility';
import type {EdgeInsetsProp} from 'EdgeInsetsPropType';
import type {TVViewProps} from 'TVViewPropTypes';

const stylePropType = StyleSheetPropType(ViewStylePropTypes);

// There's no easy way to create a different type if(Platform.isTVOS):
// so we must include TVViewProps
export type ViewProps = {
  accessible?: bool,
  accessibilityLabel?: React$PropType$Primitive<any>,
  accessibilityComponentType?: AccessibilityComponentType,
  accessibilityLiveRegion?: 'none' | 'polite' | 'assertive',
  importantForAccessibility?: 'auto'| 'yes'| 'no'| 'no-hide-descendants',
  accessibilityTraits?: AccessibilityTrait | Array<AccessibilityTrait>,
  accessibilityViewIsModal?: bool,
  onAccessibilityTap?: Function,
  onMagicTap?: Function,
  testID?: string,
  nativeID?: string,
var ReactChildren = require('react/lib/ReactChildren');
var ReactPropTypes = require('react/lib/ReactPropTypes');
var StyleSheet = require('StyleSheet');
var StyleSheetPropType = require('StyleSheetPropType');
var View = require('View');
var ViewStylePropTypes = require('ViewStylePropTypes');

var processColor = require('processColor');
var requireNativeComponent = require('requireNativeComponent');

var REF_PICKER = 'picker';
var MODE_DIALOG = 'dialog';
var MODE_DROPDOWN = 'dropdown';

var pickerStyleType = StyleSheetPropType({
  ...ViewStylePropTypes,
  color: ColorPropType,
});

type Event = Object;

/**
 * Not exposed as a public API - use <Picker> instead.
 */
var PickerAndroid = React.createClass({

  propTypes: {
    ...View.propTypes,
    style: pickerStyleType,
    selectedValue: React.PropTypes.any,
    enabled: ReactPropTypes.bool,
    mode: ReactPropTypes.oneOf(['dialog', 'dropdown']),
Example #11
0
 * is required to begin video playback.
 *
 * Example Usage:
 * ```
 * <Video style={{width: 3.0, height:2.0}} source={{uri: 'assets/my-video.webm'}} />
 * ```
 *
 * For an example of using with VideoControles,
 * see [MediaPlayerState](docs/mediaplayerstate.html)
 */
const Video = createReactClass({
  mixins: [NativeMethodsMixin],

  propTypes: {
    ...View.propTypes,
    style: StyleSheetPropType(LayoutAndTransformTintPropTypes),

    /**
     * source of video in the form of `{uri: 'http', format: FORMAT}`
     *
     * format(optional): the video format, e.g mp4, webm, etc.
     *
     * metaData(optional): the video meta data, used for customized video player
     *
     * Source can be an array of sources with different formats, and VideoPano will
     * choose one of the formats that current browser supports. If format is not specified,
     * it can be chose whatever format is supported.
     */
    source: PropTypes.oneOfType([
      PropTypes.shape({
        uri: PropTypes.string,
 *
 */
const CylindricalPanel = createReactClass({
  mixins: [NativeMethodsMixin],

  propTypes: {
    ...View.propTypes,

    layer: PropTypes.shape({
      width: PropTypes.number.isRequired,
      height: PropTypes.number.isRequired,
      radius: PropTypes.number,
      density: PropTypes.number,
    }).isRequired,

    style: StyleSheetPropType(LayoutAndTransformOpacityPropTypes),
  },

  getChildContext(): Object {
    return {isOnLayer: true};
  },
  childContextTypes: {
    isOnLayer: PropTypes.bool,
  },
  contextTypes: {
    isOnLayer: PropTypes.bool,
  },

  getDefaultProps: function() {
    return {};
  },
Example #13
0
 * This is a controlled component version of RCTPickerIOS
 */
'use strict';

const NativeMethodsMixin = require('NativeMethodsMixin');
const React = require('React');
const PropTypes = require('prop-types');
const StyleSheet = require('StyleSheet');
const StyleSheetPropType = require('StyleSheetPropType');
const TextStylePropTypes = require('TextStylePropTypes');
const View = require('View');
const ViewPropTypes = require('ViewPropTypes');
const processColor = require('processColor');

const createReactClass = require('create-react-class');
const itemStylePropType = StyleSheetPropType(TextStylePropTypes);
const requireNativeComponent = require('requireNativeComponent');

const PickerIOS = createReactClass({
  displayName: 'PickerIOS',
  mixins: [NativeMethodsMixin],

  propTypes: {
    ...ViewPropTypes,
    itemStyle: itemStylePropType,
    onValueChange: PropTypes.func,
    selectedValue: PropTypes.any, // string or integer basically
  },

  getInitialState: function() {
    return this._stateFromProps(this.props);