Question: Using Jquery How can I select an option by either its value or text in 1 statement?

```
<select>
   <option value="0">One</option>
   <option value="1">Two</option>
</select>

```

I can do these 2 statements individually but how can I combine the following 2 statements into 1 select OR statement?

```
$('select option[text="Two"]'); //This selects by text

$('select option[value="4"]'); //This selects by value

```

Answer: 
You can use react-native-orientation to detect and perform changes on orientation change.

```
var Orientation = require('react-native-orientation');

```

Also use Dimension class which return size(width, height).

```
Dimensions.get('window')

```

Use these methods to play with orientations

```
componentDidMount() {
    Orientation.lockToPortrait(); //this will lock the view to Portrait
    //Orientation.lockToLandscape(); //this will lock the view to Landscape
    //Orientation.unlockAllOrientations(); //this will unlock the view to all Orientations
    // self = this;
    console.log('componentDidMount');
    Orientation.addOrientationListener(this._orientationDidChange);
  }

  componentWillUnmount() {
    console.log('componentWillUnmount');
    Orientation.getOrientation((err,orientation)=> {
        console.log("Current Device Orientation: ", orientation);
    });
    Orientation.removeOrientationListener(this._orientationDidChange);
  }

  _orientationDidChange(orientation) {

    console.log('Orientation changed to '+orientation);
    console.log(self);

     if (orientation == 'LANDSCAPE') {
       //do something with landscape layout
       screenWidth=Dimensions.get('window').width;
       console.log('screenWidth:'+screenWidth);
     } else {
       //do something with portrait layout
       screenWidth=Dimensions.get('window').width;
       console.log('screenWidth:'+screenWidth);

     }

     self.setState({
       screenWidth:screenWidth
     });

   }

```

I also used this but It's performance is too low.

Hope that helps...
Neither `onLayout` or `Dimensions.addEventListener` worked for us in React 16.3.

Here's a flexbox hack which made the image resize on change of orientation. (We also used React's nice but poorly documented ImageBackground component to get text on top of the image):

```
      <View style={styles.container}>
        <View style={styles.imageRowWithResizeHack}>
          <ImageBackground
            style={styles.imageContainer}
            imageStyle={styles.thumbnailImg}
            source={{ uri: thumbnailUrl }}
          >
            <View style={styles.imageText}>
              <Text style={styles.partnerName}>{partnerName}</Text>
              <Text style={styles.title}>{title.toUpperCase()}</Text>
            </View>
          </ImageBackground>
          <View style={styles.imageHeight} />
        </View>
      </View>

const styles = StyleSheet.create({
  container: {
    position: 'relative',
    flex: 1
  },
  imageRowWithResizeHack: {
    flex: 1,
    flexDirection: 'row'
  },
  imageContainer: {
    flex: 1
  },
  imageHeight: {
    height: 200
  },
  thumbnailImg: {
    resizeMode: 'cover'
  },
  imageText: {
    position: 'absolute',
    top: 30,
    left: TEXT_PADDING_LEFT
  },
  partnerName: {
    fontWeight: '800',
    fontSize: 20,
    color: PARTNER_NAME_COLOR
  },
  title: {
    color: COLOR_PRIMARY_TEXT,
    fontSize: 90,
    fontWeight: '700',
    marginTop: 10,
    marginBottom: 20
  },
});

```

The `imageHeight` style will set the height of the View component (which is invisible to the user), and Flexbox will then automatically flex the image on the same row to be of the same height. So you're basically setting the height of the image in an indirect manner. Flex will ensure it flexes to fill the entire container on orientation change.