rnd

react-native-device-orientation

dispatch device orientation

Showing:

Popularity

Downloads/wk

1

GitHub Stars

2

Maintenance

Last Commit

6yrs ago

Contributors

1

Package

Dependencies

0

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

react-native-device-orientation

Dispatch device orientation.

Usage

Add the BrewingDeviceOrientation to your Xcode like this

Example Usage React Native


'use strict';

var React = require('react-native');
var {
  AppRegistry,
  StyleSheet,
  Text,
  View,
  NativeModules,
  NativeAppEventEmitter
} = React;

var orientation = React.createClass({
  getInitialState() {

    return { orientation: 'No Orientation.' };
  },
  componentDidMount() {
    NativeModules.BrewingDeviceOrientation.getOrientation((orientation) => {
      NativeAppEventEmitter.addListener(
        'orientationOnChange',
        (response) => this.setState({orientation: response.orientation})
      );
      this.setState({orientation});
    });


  },
  render: function() {
    return (
      <Text style={{marginTop: 44}}>{this.state.orientation}</Text>
    );
  }
});

var styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
  instructions: {
    textAlign: 'center',
    color: '#333333',
    marginBottom: 5,
  },
});

AppRegistry.registerComponent('orientation', () => orientation);

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial