How to use the universal-platform.select function in universal-platform

To help you get started, we’ve selected a few universal-platform 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 alibaba / rax / components / rax-navigation / src / views / HeaderBackButton.js View on Github external
type State = {
  initialTextWidth?: number,
};

class HeaderBackButton extends PureComponent {
  static propTypes = {
    onPress: PropTypes.func.isRequired,
    title: PropTypes.string,
    tintColor: PropTypes.string,
    truncatedTitle: PropTypes.string,
    width: PropTypes.number,
  };

  static defaultProps = {
    tintColor: Platform.select({
      ios: '#037aff',
    }),
    truncatedTitle: 'Back',
  };

  state = {};

  _onTextLayout = (e) => {
    if (this.state.initialTextWidth) {
      return;
    }
    this.setState({
      initialTextWidth: e.nativeEvent.layout.x + e.nativeEvent.layout.width,
    });
  };
github alibaba / rax / examples / uikit / Button.js View on Github external
},
  iconRight: {
    marginLeft: 10 * 2
  },
  small: {
    padding: 12 * 2
  },
  smallFont: {
    fontSize: normalize(14 * 2)
  },
  activityIndicatorStyle: {
    marginHorizontal: 10,
    height: 0
  },
  raised: {
    ...Platform.select({
      ios: {
        shadowColor: 'rgba(0,0,0, .4)',
        shadowOffset: {height: 1, width: 1},
        shadowOpacity: 1,
        shadowRadius: 1
      },
      android: {
        elevation: 2
      }
    })
  }
});

export default Button;
github alibaba / rax / examples / uikit / Card.js View on Github external
}
      { !image && children}
    
  
;

const styles = StyleSheet.create({
  container: {
    backgroundColor: 'white',
    borderColor: colors.grey5,
    borderWidth: 1,
    padding: 15 * 2,
    margin: 15 * 2,
    marginBottom: 0,
    ...Platform.select({
      ios: {
        shadowColor: 'rgba(0,0,0, .2)',
        shadowOffset: {height: 0, width: 0},
        shadowOpacity: 1,
        shadowRadius: 1
      },
      android: {
        elevation: 1
      }
    })
  },
  imageTitle: {
    fontSize: normalize(14 * 2),
    marginBottom: 8 * 2,
    color: colors.grey1,
    fontWeight: '500'

universal-platform

A universal Platform API.

BSD-3-Clause
Latest version published 6 years ago

Package Health Score

57 / 100
Full package analysis

Popular universal-platform functions